733 } |
733 } |
734 } |
734 } |
735 } |
735 } |
736 |
736 |
737 |
737 |
738 void java_lang_Class::fixup_mirror(KlassHandle k, TRAPS) { |
738 void java_lang_Class::fixup_mirror(Klass* k, TRAPS) { |
739 assert(InstanceMirrorKlass::offset_of_static_fields() != 0, "must have been computed already"); |
739 assert(InstanceMirrorKlass::offset_of_static_fields() != 0, "must have been computed already"); |
740 |
740 |
741 // If the offset was read from the shared archive, it was fixed up already |
741 // If the offset was read from the shared archive, it was fixed up already |
742 if (!k->is_shared()) { |
742 if (!k->is_shared()) { |
743 if (k->is_instance_klass()) { |
743 if (k->is_instance_klass()) { |
744 // During bootstrap, java.lang.Class wasn't loaded so static field |
744 // During bootstrap, java.lang.Class wasn't loaded so static field |
745 // offsets were computed without the size added it. Go back and |
745 // offsets were computed without the size added it. Go back and |
746 // update all the static field offsets to included the size. |
746 // update all the static field offsets to included the size. |
747 for (JavaFieldStream fs(InstanceKlass::cast(k())); !fs.done(); fs.next()) { |
747 for (JavaFieldStream fs(InstanceKlass::cast(k)); !fs.done(); fs.next()) { |
748 if (fs.access_flags().is_static()) { |
748 if (fs.access_flags().is_static()) { |
749 int real_offset = fs.offset() + InstanceMirrorKlass::offset_of_static_fields(); |
749 int real_offset = fs.offset() + InstanceMirrorKlass::offset_of_static_fields(); |
750 fs.set_offset(real_offset); |
750 fs.set_offset(real_offset); |
751 } |
751 } |
752 } |
752 } |
753 } |
753 } |
754 } |
754 } |
755 create_mirror(k, Handle(), Handle(), Handle(), CHECK); |
755 create_mirror(k, Handle(), Handle(), Handle(), CHECK); |
756 } |
756 } |
757 |
757 |
758 void java_lang_Class::initialize_mirror_fields(KlassHandle k, |
758 void java_lang_Class::initialize_mirror_fields(Klass* k, |
759 Handle mirror, |
759 Handle mirror, |
760 Handle protection_domain, |
760 Handle protection_domain, |
761 TRAPS) { |
761 TRAPS) { |
762 // Allocate a simple java object for a lock. |
762 // Allocate a simple java object for a lock. |
763 // This needs to be a java object because during class initialization |
763 // This needs to be a java object because during class initialization |
767 |
767 |
768 // Set protection domain also |
768 // Set protection domain also |
769 set_protection_domain(mirror(), protection_domain()); |
769 set_protection_domain(mirror(), protection_domain()); |
770 |
770 |
771 // Initialize static fields |
771 // Initialize static fields |
772 InstanceKlass::cast(k())->do_local_static_fields(&initialize_static_field, mirror, CHECK); |
772 InstanceKlass::cast(k)->do_local_static_fields(&initialize_static_field, mirror, CHECK); |
773 } |
773 } |
774 |
774 |
775 // Set the java.lang.reflect.Module module field in the java_lang_Class mirror |
775 // Set the java.lang.reflect.Module module field in the java_lang_Class mirror |
776 void java_lang_Class::set_mirror_module_field(KlassHandle k, Handle mirror, Handle module, TRAPS) { |
776 void java_lang_Class::set_mirror_module_field(Klass* k, Handle mirror, Handle module, TRAPS) { |
777 if (module.is_null()) { |
777 if (module.is_null()) { |
778 // During startup, the module may be NULL only if java.base has not been defined yet. |
778 // During startup, the module may be NULL only if java.base has not been defined yet. |
779 // Put the class on the fixup_module_list to patch later when the java.lang.reflect.Module |
779 // Put the class on the fixup_module_list to patch later when the java.lang.reflect.Module |
780 // for java.base is known. |
780 // for java.base is known. |
781 assert(!Universe::is_module_initialized(), "Incorrect java.lang.reflect.Module pre module system initialization"); |
781 assert(!Universe::is_module_initialized(), "Incorrect java.lang.reflect.Module pre module system initialization"); |
789 GrowableArray<Klass*>* list = |
789 GrowableArray<Klass*>* list = |
790 new (ResourceObj::C_HEAP, mtModule) GrowableArray<Klass*>(500, true); |
790 new (ResourceObj::C_HEAP, mtModule) GrowableArray<Klass*>(500, true); |
791 set_fixup_module_field_list(list); |
791 set_fixup_module_field_list(list); |
792 } |
792 } |
793 k->class_loader_data()->inc_keep_alive(); |
793 k->class_loader_data()->inc_keep_alive(); |
794 fixup_module_field_list()->push(k()); |
794 fixup_module_field_list()->push(k); |
795 } else { |
795 } else { |
796 javabase_was_defined = true; |
796 javabase_was_defined = true; |
797 } |
797 } |
798 } |
798 } |
799 |
799 |
812 "Incorrect java.lang.reflect.Module specification while creating mirror"); |
812 "Incorrect java.lang.reflect.Module specification while creating mirror"); |
813 set_module(mirror(), module()); |
813 set_module(mirror(), module()); |
814 } |
814 } |
815 } |
815 } |
816 |
816 |
817 void java_lang_Class::create_mirror(KlassHandle k, Handle class_loader, |
817 void java_lang_Class::create_mirror(Klass* k, Handle class_loader, |
818 Handle module, Handle protection_domain, TRAPS) { |
818 Handle module, Handle protection_domain, TRAPS) { |
819 assert(k->java_mirror() == NULL, "should only assign mirror once"); |
819 assert(k->java_mirror() == NULL, "should only assign mirror once"); |
820 // Use this moment of initialization to cache modifier_flags also, |
820 // Use this moment of initialization to cache modifier_flags also, |
821 // to support Class.getModifiers(). Instance classes recalculate |
821 // to support Class.getModifiers(). Instance classes recalculate |
822 // the cached flags after the class file is parsed, but before the |
822 // the cached flags after the class file is parsed, but before the |
829 // Allocate mirror (java.lang.Class instance) |
829 // Allocate mirror (java.lang.Class instance) |
830 oop mirror_oop = InstanceMirrorKlass::cast(SystemDictionary::Class_klass())->allocate_instance(k, CHECK); |
830 oop mirror_oop = InstanceMirrorKlass::cast(SystemDictionary::Class_klass())->allocate_instance(k, CHECK); |
831 Handle mirror(THREAD, mirror_oop); |
831 Handle mirror(THREAD, mirror_oop); |
832 |
832 |
833 // Setup indirection from mirror->klass |
833 // Setup indirection from mirror->klass |
834 if (!k.is_null()) { |
834 if (k != NULL) { |
835 java_lang_Class::set_klass(mirror(), k()); |
835 java_lang_Class::set_klass(mirror(), k); |
836 } |
836 } |
837 |
837 |
838 InstanceMirrorKlass* mk = InstanceMirrorKlass::cast(mirror->klass()); |
838 InstanceMirrorKlass* mk = InstanceMirrorKlass::cast(mirror->klass()); |
839 assert(oop_size(mirror()) == mk->instance_size(k), "should have been set"); |
839 assert(oop_size(mirror()) == mk->instance_size(k), "should have been set"); |
840 |
840 |
842 |
842 |
843 // It might also have a component mirror. This mirror must already exist. |
843 // It might also have a component mirror. This mirror must already exist. |
844 if (k->is_array_klass()) { |
844 if (k->is_array_klass()) { |
845 oop comp_mirror; |
845 oop comp_mirror; |
846 if (k->is_typeArray_klass()) { |
846 if (k->is_typeArray_klass()) { |
847 BasicType type = TypeArrayKlass::cast(k())->element_type(); |
847 BasicType type = TypeArrayKlass::cast(k)->element_type(); |
848 comp_mirror = Universe::java_mirror(type); |
848 comp_mirror = Universe::java_mirror(type); |
849 } else { |
849 } else { |
850 assert(k->is_objArray_klass(), "Must be"); |
850 assert(k->is_objArray_klass(), "Must be"); |
851 Klass* element_klass = ObjArrayKlass::cast(k())->element_klass(); |
851 Klass* element_klass = ObjArrayKlass::cast(k)->element_klass(); |
852 assert(element_klass != NULL, "Must have an element klass"); |
852 assert(element_klass != NULL, "Must have an element klass"); |
853 comp_mirror = element_klass->java_mirror(); |
853 comp_mirror = element_klass->java_mirror(); |
854 } |
854 } |
855 assert(comp_mirror != NULL, "must have a mirror"); |
855 assert(comp_mirror != NULL, "must have a mirror"); |
856 |
856 |
857 // Two-way link between the array klass and its component mirror: |
857 // Two-way link between the array klass and its component mirror: |
858 // (array_klass) k -> mirror -> component_mirror -> array_klass -> k |
858 // (array_klass) k -> mirror -> component_mirror -> array_klass -> k |
859 set_component_mirror(mirror(), comp_mirror); |
859 set_component_mirror(mirror(), comp_mirror); |
860 set_array_klass(comp_mirror, k()); |
860 set_array_klass(comp_mirror, k); |
861 } else { |
861 } else { |
862 assert(k->is_instance_klass(), "Must be"); |
862 assert(k->is_instance_klass(), "Must be"); |
863 |
863 |
864 initialize_mirror_fields(k, mirror, protection_domain, THREAD); |
864 initialize_mirror_fields(k, mirror, protection_domain, THREAD); |
865 if (HAS_PENDING_EXCEPTION) { |
865 if (HAS_PENDING_EXCEPTION) { |
879 // set the module field in the java_lang_Class instance |
879 // set the module field in the java_lang_Class instance |
880 set_mirror_module_field(k, mirror, module, THREAD); |
880 set_mirror_module_field(k, mirror, module, THREAD); |
881 |
881 |
882 // Setup indirection from klass->mirror last |
882 // Setup indirection from klass->mirror last |
883 // after any exceptions can happen during allocations. |
883 // after any exceptions can happen during allocations. |
884 if (!k.is_null()) { |
884 if (k != NULL) { |
885 k->set_java_mirror(mirror()); |
885 k->set_java_mirror(mirror()); |
886 } |
886 } |
887 } else { |
887 } else { |
888 if (fixup_mirror_list() == NULL) { |
888 if (fixup_mirror_list() == NULL) { |
889 GrowableArray<Klass*>* list = |
889 GrowableArray<Klass*>* list = |
890 new (ResourceObj::C_HEAP, mtClass) GrowableArray<Klass*>(40, true); |
890 new (ResourceObj::C_HEAP, mtClass) GrowableArray<Klass*>(40, true); |
891 set_fixup_mirror_list(list); |
891 set_fixup_mirror_list(list); |
892 } |
892 } |
893 fixup_mirror_list()->push(k()); |
893 fixup_mirror_list()->push(k); |
894 } |
894 } |
895 } |
895 } |
896 |
896 |
897 void java_lang_Class::fixup_module_field(KlassHandle k, Handle module) { |
897 void java_lang_Class::fixup_module_field(Klass* k, Handle module) { |
898 assert(_module_offset != 0, "must have been computed already"); |
898 assert(_module_offset != 0, "must have been computed already"); |
899 java_lang_Class::set_module(k->java_mirror(), module()); |
899 java_lang_Class::set_module(k->java_mirror(), module()); |
900 } |
900 } |
901 |
901 |
902 int java_lang_Class::oop_size(oop java_class) { |
902 int java_lang_Class::oop_size(oop java_class) { |
1874 // Call getCause() which doesn't necessarily return the _cause field. |
1874 // Call getCause() which doesn't necessarily return the _cause field. |
1875 EXCEPTION_MARK; |
1875 EXCEPTION_MARK; |
1876 JavaValue cause(T_OBJECT); |
1876 JavaValue cause(T_OBJECT); |
1877 JavaCalls::call_virtual(&cause, |
1877 JavaCalls::call_virtual(&cause, |
1878 throwable, |
1878 throwable, |
1879 KlassHandle(THREAD, throwable->klass()), |
1879 throwable->klass(), |
1880 vmSymbols::getCause_name(), |
1880 vmSymbols::getCause_name(), |
1881 vmSymbols::void_throwable_signature(), |
1881 vmSymbols::void_throwable_signature(), |
1882 THREAD); |
1882 THREAD); |
1883 // Ignore any exceptions. we are in the middle of exception handling. Same as classic VM. |
1883 // Ignore any exceptions. we are in the middle of exception handling. Same as classic VM. |
1884 if (HAS_PENDING_EXCEPTION) { |
1884 if (HAS_PENDING_EXCEPTION) { |
1902 void java_lang_Throwable::java_printStackTrace(Handle throwable, TRAPS) { |
1902 void java_lang_Throwable::java_printStackTrace(Handle throwable, TRAPS) { |
1903 assert(throwable->is_a(SystemDictionary::Throwable_klass()), "Throwable instance expected"); |
1903 assert(throwable->is_a(SystemDictionary::Throwable_klass()), "Throwable instance expected"); |
1904 JavaValue result(T_VOID); |
1904 JavaValue result(T_VOID); |
1905 JavaCalls::call_virtual(&result, |
1905 JavaCalls::call_virtual(&result, |
1906 throwable, |
1906 throwable, |
1907 KlassHandle(THREAD, SystemDictionary::Throwable_klass()), |
1907 SystemDictionary::Throwable_klass(), |
1908 vmSymbols::printStackTrace_name(), |
1908 vmSymbols::printStackTrace_name(), |
1909 vmSymbols::void_method_signature(), |
1909 vmSymbols::void_method_signature(), |
1910 THREAD); |
1910 THREAD); |
1911 } |
1911 } |
1912 |
1912 |
2151 } |
2151 } |
2152 } |
2152 } |
2153 |
2153 |
2154 oop java_lang_StackTraceElement::create(const methodHandle& method, int bci, TRAPS) { |
2154 oop java_lang_StackTraceElement::create(const methodHandle& method, int bci, TRAPS) { |
2155 // Allocate java.lang.StackTraceElement instance |
2155 // Allocate java.lang.StackTraceElement instance |
2156 Klass* k = SystemDictionary::StackTraceElement_klass(); |
2156 InstanceKlass* k = SystemDictionary::StackTraceElement_klass(); |
2157 assert(k != NULL, "must be loaded in 1.4+"); |
2157 assert(k != NULL, "must be loaded in 1.4+"); |
2158 instanceKlassHandle ik (THREAD, k); |
2158 if (k->should_be_initialized()) { |
2159 if (ik->should_be_initialized()) { |
2159 k->initialize(CHECK_0); |
2160 ik->initialize(CHECK_0); |
2160 } |
2161 } |
2161 |
2162 |
2162 Handle element = k->allocate_instance_handle(CHECK_0); |
2163 Handle element = ik->allocate_instance_handle(CHECK_0); |
|
2164 |
2163 |
2165 int version = method->constants()->version(); |
2164 int version = method->constants()->version(); |
2166 fill_in(element, method->method_holder(), method, version, bci, method->name(), CHECK_0); |
2165 fill_in(element, method->method_holder(), method, version, bci, method->name(), CHECK_0); |
2167 return element(); |
2166 return element(); |
2168 } |
2167 } |
2487 |
2486 |
2488 Handle java_lang_reflect_Constructor::create(TRAPS) { |
2487 Handle java_lang_reflect_Constructor::create(TRAPS) { |
2489 assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem"); |
2488 assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem"); |
2490 Symbol* name = vmSymbols::java_lang_reflect_Constructor(); |
2489 Symbol* name = vmSymbols::java_lang_reflect_Constructor(); |
2491 Klass* k = SystemDictionary::resolve_or_fail(name, true, CHECK_NH); |
2490 Klass* k = SystemDictionary::resolve_or_fail(name, true, CHECK_NH); |
2492 instanceKlassHandle klass (THREAD, k); |
2491 InstanceKlass* ik = InstanceKlass::cast(k); |
2493 // Ensure it is initialized |
2492 // Ensure it is initialized |
2494 klass->initialize(CHECK_NH); |
2493 ik->initialize(CHECK_NH); |
2495 return klass->allocate_instance_handle(THREAD); |
2494 return ik->allocate_instance_handle(THREAD); |
2496 } |
2495 } |
2497 |
2496 |
2498 oop java_lang_reflect_Constructor::clazz(oop reflect) { |
2497 oop java_lang_reflect_Constructor::clazz(oop reflect) { |
2499 assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem"); |
2498 assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem"); |
2500 return reflect->obj_field(clazz_offset); |
2499 return reflect->obj_field(clazz_offset); |
2627 |
2626 |
2628 Handle java_lang_reflect_Field::create(TRAPS) { |
2627 Handle java_lang_reflect_Field::create(TRAPS) { |
2629 assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem"); |
2628 assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem"); |
2630 Symbol* name = vmSymbols::java_lang_reflect_Field(); |
2629 Symbol* name = vmSymbols::java_lang_reflect_Field(); |
2631 Klass* k = SystemDictionary::resolve_or_fail(name, true, CHECK_NH); |
2630 Klass* k = SystemDictionary::resolve_or_fail(name, true, CHECK_NH); |
2632 instanceKlassHandle klass (THREAD, k); |
2631 InstanceKlass* ik = InstanceKlass::cast(k); |
2633 // Ensure it is initialized |
2632 // Ensure it is initialized |
2634 klass->initialize(CHECK_NH); |
2633 ik->initialize(CHECK_NH); |
2635 return klass->allocate_instance_handle(THREAD); |
2634 return ik->allocate_instance_handle(THREAD); |
2636 } |
2635 } |
2637 |
2636 |
2638 oop java_lang_reflect_Field::clazz(oop reflect) { |
2637 oop java_lang_reflect_Field::clazz(oop reflect) { |
2639 assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem"); |
2638 assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem"); |
2640 return reflect->obj_field(clazz_offset); |
2639 return reflect->obj_field(clazz_offset); |
2754 |
2753 |
2755 Handle java_lang_reflect_Parameter::create(TRAPS) { |
2754 Handle java_lang_reflect_Parameter::create(TRAPS) { |
2756 assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem"); |
2755 assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem"); |
2757 Symbol* name = vmSymbols::java_lang_reflect_Parameter(); |
2756 Symbol* name = vmSymbols::java_lang_reflect_Parameter(); |
2758 Klass* k = SystemDictionary::resolve_or_fail(name, true, CHECK_NH); |
2757 Klass* k = SystemDictionary::resolve_or_fail(name, true, CHECK_NH); |
2759 instanceKlassHandle klass (THREAD, k); |
2758 InstanceKlass* ik = InstanceKlass::cast(k); |
2760 // Ensure it is initialized |
2759 // Ensure it is initialized |
2761 klass->initialize(CHECK_NH); |
2760 ik->initialize(CHECK_NH); |
2762 return klass->allocate_instance_handle(THREAD); |
2761 return ik->allocate_instance_handle(THREAD); |
2763 } |
2762 } |
2764 |
2763 |
2765 oop java_lang_reflect_Parameter::name(oop param) { |
2764 oop java_lang_reflect_Parameter::name(oop param) { |
2766 assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem"); |
2765 assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem"); |
2767 return param->obj_field(name_offset); |
2766 return param->obj_field(name_offset); |
2810 Handle java_lang_reflect_Module::create(Handle loader, Handle module_name, TRAPS) { |
2809 Handle java_lang_reflect_Module::create(Handle loader, Handle module_name, TRAPS) { |
2811 assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem"); |
2810 assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem"); |
2812 |
2811 |
2813 Symbol* name = vmSymbols::java_lang_reflect_Module(); |
2812 Symbol* name = vmSymbols::java_lang_reflect_Module(); |
2814 Klass* k = SystemDictionary::resolve_or_fail(name, true, CHECK_NH); |
2813 Klass* k = SystemDictionary::resolve_or_fail(name, true, CHECK_NH); |
2815 instanceKlassHandle klass (THREAD, k); |
2814 InstanceKlass* ik = InstanceKlass::cast(k); |
2816 |
2815 Handle jlrmh = ik->allocate_instance_handle(CHECK_NH); |
2817 Handle jlrmh = klass->allocate_instance_handle(CHECK_NH); |
|
2818 JavaValue result(T_VOID); |
2816 JavaValue result(T_VOID); |
2819 JavaCalls::call_special(&result, jlrmh, KlassHandle(THREAD, klass()), |
2817 JavaCalls::call_special(&result, jlrmh, ik, |
2820 vmSymbols::object_initializer_name(), |
2818 vmSymbols::object_initializer_name(), |
2821 vmSymbols::java_lang_reflect_module_init_signature(), |
2819 vmSymbols::java_lang_reflect_module_init_signature(), |
2822 loader, module_name, CHECK_NH); |
2820 loader, module_name, CHECK_NH); |
2823 return jlrmh; |
2821 return jlrmh; |
2824 } |
2822 } |
2877 module->address_field_put(_module_entry_offset, (address)module_entry); |
2875 module->address_field_put(_module_entry_offset, (address)module_entry); |
2878 } |
2876 } |
2879 |
2877 |
2880 Handle reflect_ConstantPool::create(TRAPS) { |
2878 Handle reflect_ConstantPool::create(TRAPS) { |
2881 assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem"); |
2879 assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem"); |
2882 Klass* k = SystemDictionary::reflect_ConstantPool_klass(); |
2880 InstanceKlass* k = SystemDictionary::reflect_ConstantPool_klass(); |
2883 instanceKlassHandle klass (THREAD, k); |
|
2884 // Ensure it is initialized |
2881 // Ensure it is initialized |
2885 klass->initialize(CHECK_NH); |
2882 k->initialize(CHECK_NH); |
2886 return klass->allocate_instance_handle(THREAD); |
2883 return k->allocate_instance_handle(THREAD); |
2887 } |
2884 } |
2888 |
2885 |
2889 |
2886 |
2890 void reflect_ConstantPool::set_cp(oop reflect, ConstantPool* value) { |
2887 void reflect_ConstantPool::set_cp(oop reflect, ConstantPool* value) { |
2891 assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem"); |
2888 assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem"); |
2919 } |
2916 } |
2920 |
2917 |
2921 oop java_lang_boxing_object::initialize_and_allocate(BasicType type, TRAPS) { |
2918 oop java_lang_boxing_object::initialize_and_allocate(BasicType type, TRAPS) { |
2922 Klass* k = SystemDictionary::box_klass(type); |
2919 Klass* k = SystemDictionary::box_klass(type); |
2923 if (k == NULL) return NULL; |
2920 if (k == NULL) return NULL; |
2924 instanceKlassHandle h (THREAD, k); |
2921 InstanceKlass* ik = InstanceKlass::cast(k); |
2925 if (!h->is_initialized()) h->initialize(CHECK_0); |
2922 if (!ik->is_initialized()) ik->initialize(CHECK_0); |
2926 return h->allocate_instance(THREAD); |
2923 return ik->allocate_instance(THREAD); |
2927 } |
2924 } |
2928 |
2925 |
2929 |
2926 |
2930 oop java_lang_boxing_object::create(BasicType type, jvalue* value, TRAPS) { |
2927 oop java_lang_boxing_object::create(BasicType type, jvalue* value, TRAPS) { |
2931 oop box = initialize_and_allocate(type, CHECK_0); |
2928 oop box = initialize_and_allocate(type, CHECK_0); |
3892 bool JavaClasses::check_offset(const char *klass_name, int hardcoded_offset, const char *field_name, const char* field_sig) { |
3889 bool JavaClasses::check_offset(const char *klass_name, int hardcoded_offset, const char *field_name, const char* field_sig) { |
3893 EXCEPTION_MARK; |
3890 EXCEPTION_MARK; |
3894 fieldDescriptor fd; |
3891 fieldDescriptor fd; |
3895 TempNewSymbol klass_sym = SymbolTable::new_symbol(klass_name, CATCH); |
3892 TempNewSymbol klass_sym = SymbolTable::new_symbol(klass_name, CATCH); |
3896 Klass* k = SystemDictionary::resolve_or_fail(klass_sym, true, CATCH); |
3893 Klass* k = SystemDictionary::resolve_or_fail(klass_sym, true, CATCH); |
3897 instanceKlassHandle h_klass (THREAD, k); |
3894 InstanceKlass* ik = InstanceKlass::cast(k); |
3898 TempNewSymbol f_name = SymbolTable::new_symbol(field_name, CATCH); |
3895 TempNewSymbol f_name = SymbolTable::new_symbol(field_name, CATCH); |
3899 TempNewSymbol f_sig = SymbolTable::new_symbol(field_sig, CATCH); |
3896 TempNewSymbol f_sig = SymbolTable::new_symbol(field_sig, CATCH); |
3900 if (!h_klass->find_local_field(f_name, f_sig, &fd)) { |
3897 if (!ik->find_local_field(f_name, f_sig, &fd)) { |
3901 tty->print_cr("Nonstatic field %s.%s not found", klass_name, field_name); |
3898 tty->print_cr("Nonstatic field %s.%s not found", klass_name, field_name); |
3902 return false; |
3899 return false; |
3903 } |
3900 } |
3904 if (fd.is_static()) { |
3901 if (fd.is_static()) { |
3905 tty->print_cr("Nonstatic field %s.%s appears to be static", klass_name, field_name); |
3902 tty->print_cr("Nonstatic field %s.%s appears to be static", klass_name, field_name); |
3918 bool JavaClasses::check_static_offset(const char *klass_name, int hardcoded_offset, const char *field_name, const char* field_sig) { |
3915 bool JavaClasses::check_static_offset(const char *klass_name, int hardcoded_offset, const char *field_name, const char* field_sig) { |
3919 EXCEPTION_MARK; |
3916 EXCEPTION_MARK; |
3920 fieldDescriptor fd; |
3917 fieldDescriptor fd; |
3921 TempNewSymbol klass_sym = SymbolTable::new_symbol(klass_name, CATCH); |
3918 TempNewSymbol klass_sym = SymbolTable::new_symbol(klass_name, CATCH); |
3922 Klass* k = SystemDictionary::resolve_or_fail(klass_sym, true, CATCH); |
3919 Klass* k = SystemDictionary::resolve_or_fail(klass_sym, true, CATCH); |
3923 instanceKlassHandle h_klass (THREAD, k); |
3920 InstanceKlass* ik = InstanceKlass::cast(k); |
3924 TempNewSymbol f_name = SymbolTable::new_symbol(field_name, CATCH); |
3921 TempNewSymbol f_name = SymbolTable::new_symbol(field_name, CATCH); |
3925 TempNewSymbol f_sig = SymbolTable::new_symbol(field_sig, CATCH); |
3922 TempNewSymbol f_sig = SymbolTable::new_symbol(field_sig, CATCH); |
3926 if (!h_klass->find_local_field(f_name, f_sig, &fd)) { |
3923 if (!ik->find_local_field(f_name, f_sig, &fd)) { |
3927 tty->print_cr("Static field %s.%s not found", klass_name, field_name); |
3924 tty->print_cr("Static field %s.%s not found", klass_name, field_name); |
3928 return false; |
3925 return false; |
3929 } |
3926 } |
3930 if (!fd.is_static()) { |
3927 if (!fd.is_static()) { |
3931 tty->print_cr("Static field %s.%s appears to be nonstatic", klass_name, field_name); |
3928 tty->print_cr("Static field %s.%s appears to be nonstatic", klass_name, field_name); |
3943 bool JavaClasses::check_constant(const char *klass_name, int hardcoded_constant, const char *field_name, const char* field_sig) { |
3940 bool JavaClasses::check_constant(const char *klass_name, int hardcoded_constant, const char *field_name, const char* field_sig) { |
3944 EXCEPTION_MARK; |
3941 EXCEPTION_MARK; |
3945 fieldDescriptor fd; |
3942 fieldDescriptor fd; |
3946 TempNewSymbol klass_sym = SymbolTable::new_symbol(klass_name, CATCH); |
3943 TempNewSymbol klass_sym = SymbolTable::new_symbol(klass_name, CATCH); |
3947 Klass* k = SystemDictionary::resolve_or_fail(klass_sym, true, CATCH); |
3944 Klass* k = SystemDictionary::resolve_or_fail(klass_sym, true, CATCH); |
3948 instanceKlassHandle h_klass (THREAD, k); |
3945 InstanceKlass* ik = InstanceKlass::cast(k); |
3949 TempNewSymbol f_name = SymbolTable::new_symbol(field_name, CATCH); |
3946 TempNewSymbol f_name = SymbolTable::new_symbol(field_name, CATCH); |
3950 TempNewSymbol f_sig = SymbolTable::new_symbol(field_sig, CATCH); |
3947 TempNewSymbol f_sig = SymbolTable::new_symbol(field_sig, CATCH); |
3951 if (!h_klass->find_local_field(f_name, f_sig, &fd)) { |
3948 if (!ik->find_local_field(f_name, f_sig, &fd)) { |
3952 tty->print_cr("Static field %s.%s not found", klass_name, field_name); |
3949 tty->print_cr("Static field %s.%s not found", klass_name, field_name); |
3953 return false; |
3950 return false; |
3954 } |
3951 } |
3955 if (!fd.is_static() || !fd.has_initial_value()) { |
3952 if (!fd.is_static() || !fd.has_initial_value()) { |
3956 tty->print_cr("Static field %s.%s appears to be non-constant", klass_name, field_name); |
3953 tty->print_cr("Static field %s.%s appears to be non-constant", klass_name, field_name); |