Mercurial > hg > truffle
comparison src/share/vm/classfile/javaClasses.hpp @ 4137:04b9a2566eec
Merge with hsx23/hotspot.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Sat, 17 Dec 2011 21:40:27 +0100 |
parents | e5928e7dab26 |
children | 120820e30baa 8f972594effc |
comparison
equal
deleted
inserted
replaced
3737:9dc19b7d89a3 | 4137:04b9a2566eec |
---|---|
154 }; | 154 }; |
155 | 155 |
156 | 156 |
157 // Interface to java.lang.Class objects | 157 // Interface to java.lang.Class objects |
158 | 158 |
159 #define CLASS_INJECTED_FIELDS(macro) \ | |
160 macro(java_lang_Class, klass, object_signature, false) \ | |
161 macro(java_lang_Class, resolved_constructor, object_signature, false) \ | |
162 macro(java_lang_Class, array_klass, object_signature, false) \ | |
163 macro(java_lang_Class, oop_size, int_signature, false) \ | |
164 macro(java_lang_Class, static_oop_field_count, int_signature, false) | |
165 | |
159 class java_lang_Class : AllStatic { | 166 class java_lang_Class : AllStatic { |
160 friend class VMStructs; | 167 friend class VMStructs; |
168 | |
161 private: | 169 private: |
162 // The fake offsets are added by the class loader when java.lang.Class is loaded | 170 // The fake offsets are added by the class loader when java.lang.Class is loaded |
163 | 171 |
164 enum { | 172 static int _klass_offset; |
165 hc_number_of_fake_oop_fields = 3, | 173 static int _resolved_constructor_offset; |
166 hc_number_of_fake_int_fields = 2 | 174 static int _array_klass_offset; |
167 }; | 175 |
168 | 176 static int _oop_size_offset; |
169 static int klass_offset; | 177 static int _static_oop_field_count_offset; |
170 static int resolved_constructor_offset; | 178 |
171 static int array_klass_offset; | |
172 static int number_of_fake_oop_fields; | |
173 | |
174 static int oop_size_offset; | |
175 static int static_oop_field_count_offset; | |
176 | |
177 static void compute_offsets(); | |
178 static bool offsets_computed; | 179 static bool offsets_computed; |
179 static int classRedefinedCount_offset; | 180 static int classRedefinedCount_offset; |
180 static int parallelCapable_offset; | 181 |
181 | 182 public: |
182 public: | 183 static void compute_offsets(); |
184 | |
183 // Instance creation | 185 // Instance creation |
184 static oop create_mirror(KlassHandle k, TRAPS); | 186 static oop create_mirror(KlassHandle k, TRAPS); |
185 static void fixup_mirror(KlassHandle k, TRAPS); | 187 static void fixup_mirror(KlassHandle k, TRAPS); |
186 static oop create_basic_type_mirror(const char* basic_type_name, BasicType type, TRAPS); | 188 static oop create_basic_type_mirror(const char* basic_type_name, BasicType type, TRAPS); |
187 // Conversion | 189 // Conversion |
188 static klassOop as_klassOop(oop java_class); | 190 static klassOop as_klassOop(oop java_class); |
191 static void set_klass(oop java_class, klassOop klass); | |
189 static BasicType as_BasicType(oop java_class, klassOop* reference_klass = NULL); | 192 static BasicType as_BasicType(oop java_class, klassOop* reference_klass = NULL); |
190 static BasicType as_BasicType(oop java_class, KlassHandle* reference_klass) { | 193 static BasicType as_BasicType(oop java_class, KlassHandle* reference_klass) { |
191 klassOop refk_oop = NULL; | 194 klassOop refk_oop = NULL; |
192 BasicType result = as_BasicType(java_class, &refk_oop); | 195 BasicType result = as_BasicType(java_class, &refk_oop); |
193 (*reference_klass) = KlassHandle(refk_oop); | 196 (*reference_klass) = KlassHandle(refk_oop); |
207 static void set_resolved_constructor(oop java_class, methodOop constructor); | 210 static void set_resolved_constructor(oop java_class, methodOop constructor); |
208 // JVM_NewArray support | 211 // JVM_NewArray support |
209 static klassOop array_klass(oop java_class); | 212 static klassOop array_klass(oop java_class); |
210 static void set_array_klass(oop java_class, klassOop klass); | 213 static void set_array_klass(oop java_class, klassOop klass); |
211 // compiler support for class operations | 214 // compiler support for class operations |
212 static int klass_offset_in_bytes() { return klass_offset; } | 215 static int klass_offset_in_bytes() { return _klass_offset; } |
213 static int resolved_constructor_offset_in_bytes() { return resolved_constructor_offset; } | 216 static int resolved_constructor_offset_in_bytes() { return _resolved_constructor_offset; } |
214 static int array_klass_offset_in_bytes() { return array_klass_offset; } | 217 static int array_klass_offset_in_bytes() { return _array_klass_offset; } |
215 // Support for classRedefinedCount field | 218 // Support for classRedefinedCount field |
216 static int classRedefinedCount(oop the_class_mirror); | 219 static int classRedefinedCount(oop the_class_mirror); |
217 static void set_classRedefinedCount(oop the_class_mirror, int value); | 220 static void set_classRedefinedCount(oop the_class_mirror, int value); |
218 // Support for parallelCapable field | |
219 static bool parallelCapable(oop the_class_mirror); | |
220 | 221 |
221 static int oop_size(oop java_class); | 222 static int oop_size(oop java_class); |
222 static void set_oop_size(oop java_class, int size); | 223 static void set_oop_size(oop java_class, int size); |
223 static int static_oop_field_count(oop java_class); | 224 static int static_oop_field_count(oop java_class); |
224 static void set_static_oop_field_count(oop java_class, int size); | 225 static void set_static_oop_field_count(oop java_class, int size); |
391 hc_backtrace_offset = 0, | 392 hc_backtrace_offset = 0, |
392 hc_detailMessage_offset = 1, | 393 hc_detailMessage_offset = 1, |
393 hc_cause_offset = 2, // New since 1.4 | 394 hc_cause_offset = 2, // New since 1.4 |
394 hc_stackTrace_offset = 3 // New since 1.4 | 395 hc_stackTrace_offset = 3 // New since 1.4 |
395 }; | 396 }; |
397 enum { | |
398 hc_static_unassigned_stacktrace_offset = 0 // New since 1.7 | |
399 }; | |
396 // Trace constants | 400 // Trace constants |
397 enum { | 401 enum { |
398 trace_methods_offset = 0, | 402 trace_methods_offset = 0, |
399 trace_bcis_offset = 1, | 403 trace_bcis_offset = 1, |
400 trace_next_offset = 2, | 404 trace_next_offset = 2, |
404 | 408 |
405 static int backtrace_offset; | 409 static int backtrace_offset; |
406 static int detailMessage_offset; | 410 static int detailMessage_offset; |
407 static int cause_offset; | 411 static int cause_offset; |
408 static int stackTrace_offset; | 412 static int stackTrace_offset; |
413 static int static_unassigned_stacktrace_offset; | |
409 | 414 |
410 // Printing | 415 // Printing |
411 static char* print_stack_element_to_buffer(methodOop method, int bci); | 416 static char* print_stack_element_to_buffer(methodOop method, int bci); |
412 static void print_to_stream(Handle stream, const char* str); | 417 static void print_to_stream(Handle stream, const char* str); |
413 // StackTrace (programmatic access, new since 1.4) | 418 // StackTrace (programmatic access, new since 1.4) |
414 static void clear_stacktrace(oop throwable); | 419 static void clear_stacktrace(oop throwable); |
415 // No stack trace available | 420 // No stack trace available |
416 static const char* no_stack_trace_message(); | 421 static const char* no_stack_trace_message(); |
422 // Stacktrace (post JDK 1.7.0 to allow immutability protocol to be followed) | |
423 static void set_stacktrace(oop throwable, oop st_element_array); | |
424 static oop unassigned_stacktrace(); | |
417 | 425 |
418 public: | 426 public: |
419 // Backtrace | 427 // Backtrace |
420 static oop backtrace(oop throwable); | 428 static oop backtrace(oop throwable); |
421 static void set_backtrace(oop throwable, oop value); | 429 static void set_backtrace(oop throwable, oop value); |
436 | 444 |
437 // Allocate space for backtrace (created but stack trace not filled in) | 445 // Allocate space for backtrace (created but stack trace not filled in) |
438 static void allocate_backtrace(Handle throwable, TRAPS); | 446 static void allocate_backtrace(Handle throwable, TRAPS); |
439 // Fill in current stack trace for throwable with preallocated backtrace (no GC) | 447 // Fill in current stack trace for throwable with preallocated backtrace (no GC) |
440 static void fill_in_stack_trace_of_preallocated_backtrace(Handle throwable); | 448 static void fill_in_stack_trace_of_preallocated_backtrace(Handle throwable); |
441 | |
442 // Fill in current stack trace, can cause GC | 449 // Fill in current stack trace, can cause GC |
443 static void fill_in_stack_trace(Handle throwable, methodHandle method, TRAPS); | 450 static void fill_in_stack_trace(Handle throwable, methodHandle method, TRAPS); |
444 static void fill_in_stack_trace(Handle throwable, methodHandle method = methodHandle()); | 451 static void fill_in_stack_trace(Handle throwable, methodHandle method = methodHandle()); |
445 // Programmatic access to stack trace | 452 // Programmatic access to stack trace |
446 static oop get_stack_trace_element(oop throwable, int index, TRAPS); | 453 static oop get_stack_trace_element(oop throwable, int index, TRAPS); |
763 } | 770 } |
764 static void set_referent(oop ref, oop value) { | 771 static void set_referent(oop ref, oop value) { |
765 ref->obj_field_put(referent_offset, value); | 772 ref->obj_field_put(referent_offset, value); |
766 } | 773 } |
767 static void set_referent_raw(oop ref, oop value) { | 774 static void set_referent_raw(oop ref, oop value) { |
768 ref->obj_field_raw_put(referent_offset, value); | 775 ref->obj_field_put_raw(referent_offset, value); |
769 } | 776 } |
770 static HeapWord* referent_addr(oop ref) { | 777 static HeapWord* referent_addr(oop ref) { |
771 return ref->obj_field_addr<HeapWord>(referent_offset); | 778 return ref->obj_field_addr<HeapWord>(referent_offset); |
772 } | 779 } |
773 static oop next(oop ref) { | 780 static oop next(oop ref) { |
775 } | 782 } |
776 static void set_next(oop ref, oop value) { | 783 static void set_next(oop ref, oop value) { |
777 ref->obj_field_put(next_offset, value); | 784 ref->obj_field_put(next_offset, value); |
778 } | 785 } |
779 static void set_next_raw(oop ref, oop value) { | 786 static void set_next_raw(oop ref, oop value) { |
780 ref->obj_field_raw_put(next_offset, value); | 787 ref->obj_field_put_raw(next_offset, value); |
781 } | 788 } |
782 static HeapWord* next_addr(oop ref) { | 789 static HeapWord* next_addr(oop ref) { |
783 return ref->obj_field_addr<HeapWord>(next_offset); | 790 return ref->obj_field_addr<HeapWord>(next_offset); |
784 } | 791 } |
785 static oop discovered(oop ref) { | 792 static oop discovered(oop ref) { |
787 } | 794 } |
788 static void set_discovered(oop ref, oop value) { | 795 static void set_discovered(oop ref, oop value) { |
789 ref->obj_field_put(discovered_offset, value); | 796 ref->obj_field_put(discovered_offset, value); |
790 } | 797 } |
791 static void set_discovered_raw(oop ref, oop value) { | 798 static void set_discovered_raw(oop ref, oop value) { |
792 ref->obj_field_raw_put(discovered_offset, value); | 799 ref->obj_field_put_raw(discovered_offset, value); |
793 } | 800 } |
794 static HeapWord* discovered_addr(oop ref) { | 801 static HeapWord* discovered_addr(oop ref) { |
795 return ref->obj_field_addr<HeapWord>(discovered_offset); | 802 return ref->obj_field_addr<HeapWord>(discovered_offset); |
796 } | 803 } |
797 // Accessors for statics | 804 // Accessors for statics |
826 }; | 833 }; |
827 | 834 |
828 | 835 |
829 // Interface to java.lang.invoke.MethodHandle objects | 836 // Interface to java.lang.invoke.MethodHandle objects |
830 | 837 |
838 #define METHODHANDLE_INJECTED_FIELDS(macro) \ | |
839 macro(java_lang_invoke_MethodHandle, vmentry, intptr_signature, false) \ | |
840 macro(java_lang_invoke_MethodHandle, vmtarget, object_signature, true) | |
841 | |
831 class MethodHandleEntry; | 842 class MethodHandleEntry; |
832 | 843 |
833 class java_lang_invoke_MethodHandle: AllStatic { | 844 class java_lang_invoke_MethodHandle: AllStatic { |
834 friend class JavaClasses; | 845 friend class JavaClasses; |
835 | 846 |
836 private: | 847 private: |
837 static int _vmentry_offset; // assembly code trampoline for MH | 848 static int _vmentry_offset; // assembly code trampoline for MH |
838 static int _vmtarget_offset; // class-specific target reference | 849 static int _vmtarget_offset; // class-specific target reference |
839 static int _type_offset; // the MethodType of this MH | 850 static int _type_offset; // the MethodType of this MH |
840 static int _vmslots_offset; // OPTIONAL hoisted type.form.vmslots | |
841 | 851 |
842 static void compute_offsets(); | 852 static void compute_offsets(); |
843 | 853 |
844 public: | 854 public: |
845 // Accessors | 855 // Accessors |
851 | 861 |
852 static MethodHandleEntry* vmentry(oop mh); | 862 static MethodHandleEntry* vmentry(oop mh); |
853 static void set_vmentry(oop mh, MethodHandleEntry* data); | 863 static void set_vmentry(oop mh, MethodHandleEntry* data); |
854 | 864 |
855 static int vmslots(oop mh); | 865 static int vmslots(oop mh); |
856 static void init_vmslots(oop mh); | |
857 static int compute_vmslots(oop mh); | |
858 | 866 |
859 // Testers | 867 // Testers |
860 static bool is_subclass(klassOop klass) { | 868 static bool is_subclass(klassOop klass) { |
861 return Klass::cast(klass)->is_subclass_of(SystemDictionary::MethodHandle_klass()); | 869 return Klass::cast(klass)->is_subclass_of(SystemDictionary::MethodHandle_klass()); |
862 } | 870 } |
866 | 874 |
867 // Accessors for code generation: | 875 // Accessors for code generation: |
868 static int type_offset_in_bytes() { return _type_offset; } | 876 static int type_offset_in_bytes() { return _type_offset; } |
869 static int vmtarget_offset_in_bytes() { return _vmtarget_offset; } | 877 static int vmtarget_offset_in_bytes() { return _vmtarget_offset; } |
870 static int vmentry_offset_in_bytes() { return _vmentry_offset; } | 878 static int vmentry_offset_in_bytes() { return _vmentry_offset; } |
871 static int vmslots_offset_in_bytes() { return _vmslots_offset; } | 879 }; |
872 }; | 880 |
881 #define DIRECTMETHODHANDLE_INJECTED_FIELDS(macro) \ | |
882 macro(java_lang_invoke_DirectMethodHandle, vmindex, int_signature, true) | |
873 | 883 |
874 class java_lang_invoke_DirectMethodHandle: public java_lang_invoke_MethodHandle { | 884 class java_lang_invoke_DirectMethodHandle: public java_lang_invoke_MethodHandle { |
875 friend class JavaClasses; | 885 friend class JavaClasses; |
876 | 886 |
877 private: | 887 private: |
878 // _vmtarget_offset; // method or class or interface | |
879 static int _vmindex_offset; // negative or vtable idx or itable idx | 888 static int _vmindex_offset; // negative or vtable idx or itable idx |
880 static void compute_offsets(); | 889 static void compute_offsets(); |
881 | 890 |
882 public: | 891 public: |
883 // Accessors | 892 // Accessors |
973 | 982 |
974 static int conversion_offset_in_bytes() { return _conversion_offset; } | 983 static int conversion_offset_in_bytes() { return _conversion_offset; } |
975 }; | 984 }; |
976 | 985 |
977 | 986 |
987 // A simple class that maintains an invocation count | |
988 class java_lang_invoke_CountingMethodHandle: public java_lang_invoke_MethodHandle { | |
989 friend class JavaClasses; | |
990 | |
991 private: | |
992 static int _vmcount_offset; | |
993 static void compute_offsets(); | |
994 | |
995 public: | |
996 // Accessors | |
997 static int vmcount(oop mh); | |
998 static void set_vmcount(oop mh, int count); | |
999 | |
1000 // Testers | |
1001 static bool is_subclass(klassOop klass) { | |
1002 return SystemDictionary::CountingMethodHandle_klass() != NULL && | |
1003 Klass::cast(klass)->is_subclass_of(SystemDictionary::CountingMethodHandle_klass()); | |
1004 } | |
1005 static bool is_instance(oop obj) { | |
1006 return obj != NULL && is_subclass(obj->klass()); | |
1007 } | |
1008 | |
1009 // Accessors for code generation: | |
1010 static int vmcount_offset_in_bytes() { return _vmcount_offset; } | |
1011 }; | |
1012 | |
1013 | |
1014 | |
978 // Interface to java.lang.invoke.MemberName objects | 1015 // Interface to java.lang.invoke.MemberName objects |
979 // (These are a private interface for Java code to query the class hierarchy.) | 1016 // (These are a private interface for Java code to query the class hierarchy.) |
1017 | |
1018 #define MEMBERNAME_INJECTED_FIELDS(macro) \ | |
1019 macro(java_lang_invoke_MemberName, vmtarget, object_signature, true) | |
980 | 1020 |
981 class java_lang_invoke_MemberName: AllStatic { | 1021 class java_lang_invoke_MemberName: AllStatic { |
982 friend class JavaClasses; | 1022 friend class JavaClasses; |
983 | 1023 |
984 private: | 1024 private: |
1085 static int rtype_offset_in_bytes() { return _rtype_offset; } | 1125 static int rtype_offset_in_bytes() { return _rtype_offset; } |
1086 static int ptypes_offset_in_bytes() { return _ptypes_offset; } | 1126 static int ptypes_offset_in_bytes() { return _ptypes_offset; } |
1087 static int form_offset_in_bytes() { return _form_offset; } | 1127 static int form_offset_in_bytes() { return _form_offset; } |
1088 }; | 1128 }; |
1089 | 1129 |
1130 #define METHODTYPEFORM_INJECTED_FIELDS(macro) \ | |
1131 macro(java_lang_invoke_MethodTypeForm, vmslots, int_signature, true) \ | |
1132 macro(java_lang_invoke_MethodTypeForm, vmlayout, object_signature, true) | |
1133 | |
1090 class java_lang_invoke_MethodTypeForm: AllStatic { | 1134 class java_lang_invoke_MethodTypeForm: AllStatic { |
1091 friend class JavaClasses; | 1135 friend class JavaClasses; |
1092 | 1136 |
1093 private: | 1137 private: |
1094 static int _vmslots_offset; // number of argument slots needed | 1138 static int _vmslots_offset; // number of argument slots needed |
1099 static void compute_offsets(); | 1143 static void compute_offsets(); |
1100 | 1144 |
1101 public: | 1145 public: |
1102 // Accessors | 1146 // Accessors |
1103 static int vmslots(oop mtform); | 1147 static int vmslots(oop mtform); |
1148 static void set_vmslots(oop mtform, int vmslots); | |
1149 | |
1104 static oop erasedType(oop mtform); | 1150 static oop erasedType(oop mtform); |
1105 static oop genericInvoker(oop mtform); | 1151 static oop genericInvoker(oop mtform); |
1106 | 1152 |
1107 static oop vmlayout(oop mtform); | 1153 static oop vmlayout(oop mtform); |
1108 static oop init_vmlayout(oop mtform, oop cookie); | 1154 static oop init_vmlayout(oop mtform, oop cookie); |
1120 class java_lang_invoke_CallSite: AllStatic { | 1166 class java_lang_invoke_CallSite: AllStatic { |
1121 friend class JavaClasses; | 1167 friend class JavaClasses; |
1122 | 1168 |
1123 private: | 1169 private: |
1124 static int _target_offset; | 1170 static int _target_offset; |
1125 static int _caller_method_offset; | |
1126 static int _caller_bci_offset; | |
1127 | 1171 |
1128 static void compute_offsets(); | 1172 static void compute_offsets(); |
1129 | 1173 |
1130 public: | 1174 public: |
1131 // Accessors | 1175 // Accessors |
1132 static oop target(oop site); | 1176 static oop target( oop site) { return site->obj_field( _target_offset); } |
1133 static void set_target(oop site, oop target); | 1177 static void set_target( oop site, oop target) { site->obj_field_put( _target_offset, target); } |
1134 | 1178 |
1135 static oop caller_method(oop site); | 1179 static volatile oop target_volatile(oop site) { return site->obj_field_volatile( _target_offset); } |
1136 static void set_caller_method(oop site, oop ref); | 1180 static void set_target_volatile(oop site, oop target) { site->obj_field_put_volatile(_target_offset, target); } |
1137 | |
1138 static jint caller_bci(oop site); | |
1139 static void set_caller_bci(oop site, jint bci); | |
1140 | 1181 |
1141 // Testers | 1182 // Testers |
1142 static bool is_subclass(klassOop klass) { | 1183 static bool is_subclass(klassOop klass) { |
1143 return Klass::cast(klass)->is_subclass_of(SystemDictionary::CallSite_klass()); | 1184 return Klass::cast(klass)->is_subclass_of(SystemDictionary::CallSite_klass()); |
1144 } | 1185 } |
1146 return obj != NULL && is_subclass(obj->klass()); | 1187 return obj != NULL && is_subclass(obj->klass()); |
1147 } | 1188 } |
1148 | 1189 |
1149 // Accessors for code generation: | 1190 // Accessors for code generation: |
1150 static int target_offset_in_bytes() { return _target_offset; } | 1191 static int target_offset_in_bytes() { return _target_offset; } |
1151 static int caller_method_offset_in_bytes() { return _caller_method_offset; } | |
1152 static int caller_bci_offset_in_bytes() { return _caller_bci_offset; } | |
1153 }; | 1192 }; |
1154 | 1193 |
1155 | 1194 |
1156 // Interface to java.security.AccessControlContext objects | 1195 // Interface to java.security.AccessControlContext objects |
1157 | 1196 |
1178 private: | 1217 private: |
1179 enum { | 1218 enum { |
1180 hc_parent_offset = 0 | 1219 hc_parent_offset = 0 |
1181 }; | 1220 }; |
1182 | 1221 |
1222 static bool offsets_computed; | |
1183 static int parent_offset; | 1223 static int parent_offset; |
1224 static int parallelCapable_offset; | |
1225 | |
1226 static void compute_offsets(); | |
1184 | 1227 |
1185 public: | 1228 public: |
1186 static oop parent(oop loader); | 1229 static oop parent(oop loader); |
1230 | |
1231 // Support for parallelCapable field | |
1232 static bool parallelCapable(oop the_class_mirror); | |
1187 | 1233 |
1188 static bool is_trusted_loader(oop loader); | 1234 static bool is_trusted_loader(oop loader); |
1189 | 1235 |
1190 // Fix for 4474172 | 1236 // Fix for 4474172 |
1191 static oop non_reflection_class_loader(oop loader); | 1237 static oop non_reflection_class_loader(oop loader); |
1304 public: | 1350 public: |
1305 static void initialize(TRAPS); | 1351 static void initialize(TRAPS); |
1306 static oop get_owner_threadObj(oop obj); | 1352 static oop get_owner_threadObj(oop obj); |
1307 }; | 1353 }; |
1308 | 1354 |
1355 // Use to declare fields that need to be injected into Java classes | |
1356 // for the JVM to use. The name_index and signature_index are | |
1357 // declared in vmSymbols. The may_be_java flag is used to declare | |
1358 // fields that might already exist in Java but should be injected if | |
1359 // they don't. Otherwise the field is unconditionally injected and | |
1360 // the JVM uses the injected one. This is to ensure that name | |
1361 // collisions don't occur. In general may_be_java should be false | |
1362 // unless there's a good reason. | |
1363 | |
1364 class InjectedField { | |
1365 public: | |
1366 const SystemDictionary::WKID klass_id; | |
1367 const vmSymbols::SID name_index; | |
1368 const vmSymbols::SID signature_index; | |
1369 const bool may_be_java; | |
1370 | |
1371 | |
1372 klassOop klass() const { return SystemDictionary::well_known_klass(klass_id); } | |
1373 Symbol* name() const { return lookup_symbol(name_index); } | |
1374 Symbol* signature() const { return lookup_symbol(signature_index); } | |
1375 | |
1376 int compute_offset(); | |
1377 | |
1378 // Find the Symbol for this index | |
1379 static Symbol* lookup_symbol(int symbol_index) { | |
1380 return vmSymbols::symbol_at((vmSymbols::SID)symbol_index); | |
1381 } | |
1382 }; | |
1383 | |
1384 #define DECLARE_INJECTED_FIELD_ENUM(klass, name, signature, may_be_java) \ | |
1385 klass##_##name##_enum, | |
1386 | |
1387 #define ALL_INJECTED_FIELDS(macro) \ | |
1388 CLASS_INJECTED_FIELDS(macro) \ | |
1389 METHODHANDLE_INJECTED_FIELDS(macro) \ | |
1390 DIRECTMETHODHANDLE_INJECTED_FIELDS(macro) \ | |
1391 MEMBERNAME_INJECTED_FIELDS(macro) \ | |
1392 METHODTYPEFORM_INJECTED_FIELDS(macro) | |
1393 | |
1309 // Interface to hard-coded offset checking | 1394 // Interface to hard-coded offset checking |
1310 | 1395 |
1311 class JavaClasses : AllStatic { | 1396 class JavaClasses : AllStatic { |
1312 private: | 1397 private: |
1398 | |
1399 static InjectedField _injected_fields[]; | |
1400 | |
1313 static bool check_offset(const char *klass_name, int offset, const char *field_name, const char* field_sig) PRODUCT_RETURN0; | 1401 static bool check_offset(const char *klass_name, int offset, const char *field_name, const char* field_sig) PRODUCT_RETURN0; |
1314 static bool check_static_offset(const char *klass_name, int hardcoded_offset, const char *field_name, const char* field_sig) PRODUCT_RETURN0; | 1402 static bool check_static_offset(const char *klass_name, int hardcoded_offset, const char *field_name, const char* field_sig) PRODUCT_RETURN0; |
1315 static bool check_constant(const char *klass_name, int constant, const char *field_name, const char* field_sig) PRODUCT_RETURN0; | 1403 static bool check_constant(const char *klass_name, int constant, const char *field_name, const char* field_sig) PRODUCT_RETURN0; |
1316 public: | 1404 |
1405 public: | |
1406 enum InjectedFieldID { | |
1407 ALL_INJECTED_FIELDS(DECLARE_INJECTED_FIELD_ENUM) | |
1408 MAX_enum | |
1409 }; | |
1410 | |
1411 static int compute_injected_offset(InjectedFieldID id); | |
1412 | |
1317 static void compute_hard_coded_offsets(); | 1413 static void compute_hard_coded_offsets(); |
1318 static void compute_offsets(); | 1414 static void compute_offsets(); |
1319 static void check_offsets() PRODUCT_RETURN; | 1415 static void check_offsets() PRODUCT_RETURN; |
1320 }; | 1416 |
1417 static InjectedField* get_injected(Symbol* class_name, int* field_count); | |
1418 }; | |
1419 | |
1420 #undef DECLARE_INJECTED_FIELD_ENUM | |
1321 | 1421 |
1322 #endif // SHARE_VM_CLASSFILE_JAVACLASSES_HPP | 1422 #endif // SHARE_VM_CLASSFILE_JAVACLASSES_HPP |