196 }
197
198 static unsigned int hash_code(oop java_string);
199 static unsigned int hash_code_noupdate(oop java_string);
200
201 // Compare strings (of different types/encodings), length is the string (array) length
202 static bool equals(oop java_string, const jchar* chars, int len);
203 static bool equals(oop java_string, const char* utf8_str, size_t utf8_len);
204 static bool equals(oop str1, oop str2);
205 static inline bool value_equals(typeArrayOop str_value1, typeArrayOop str_value2);
206
207 // Conversion between '.' and '/' formats, and allocate a String from the result.
208 static Handle externalize_classname(Symbol* java_name, TRAPS);
209
210 // Conversion
211 static Symbol* as_symbol(oop java_string);
212 static Symbol* as_symbol_or_null(oop java_string);
213
214 // Tester
215 static inline bool is_instance(oop obj);
216
217 // Debugging
218 static void print(oop java_string, outputStream* st, int max_length = MaxStringPrintSize);
219 friend class JavaClasses;
220 friend class StringTable;
221 };
222
223
224 // Interface to java.lang.Class objects
225
226 #define CLASS_INJECTED_FIELDS(macro) \
227 macro(java_lang_Class, klass, intptr_signature, false) \
228 macro(java_lang_Class, array_klass, intptr_signature, false) \
229 macro(java_lang_Class, oop_size, int_signature, false) \
230 macro(java_lang_Class, static_oop_field_count, int_signature, false) \
231 macro(java_lang_Class, source_file, object_signature, false) \
232 macro(java_lang_Class, init_lock, object_signature, false)
233
234 class java_lang_Class : AllStatic {
235 friend class VMStructs;
236 friend class JVMCIVMStructs;
237 friend class HeapShared;
238
239 private:
240
241 // The fake offsets are added by the class loader when java.lang.Class is loaded
242
243 static int _klass_offset;
244 static int _array_klass_offset;
245
246 static int _oop_size_offset;
247 static int _static_oop_field_count_offset;
248
249 static int _protection_domain_offset;
250 static int _init_lock_offset;
251 static int _signers_offset;
252 static int _class_loader_offset;
253 static int _module_offset;
254 static int _component_mirror_offset;
255 static int _name_offset;
256 static int _source_file_offset;
257 static int _classData_offset;
258 static int _classRedefinedCount_offset;
259 static int _reflectionData_offset;
260 static int _modifiers_offset;
261 static int _is_primitive_offset;
262 static int _raw_access_flags_offset;
263
264 static bool _offsets_computed;
265
266 static GrowableArray<Klass*>* _fixup_mirror_list;
267 static GrowableArray<Klass*>* _fixup_module_field_list;
268
269 static void set_init_lock(oop java_class, oop init_lock);
270 static void set_protection_domain(oop java_class, oop protection_domain);
271 static void set_class_loader(oop java_class, oop class_loader);
272 static void set_component_mirror(oop java_class, oop comp_mirror);
273 static void initialize_mirror_fields(InstanceKlass* ik, Handle mirror, Handle protection_domain,
274 Handle classData, TRAPS);
275 static void set_mirror_module_field(JavaThread* current, Klass* K, Handle mirror, Handle module);
276 public:
277 static void allocate_fixup_lists();
278 static void compute_offsets();
279
280 // Instance creation
281 static void allocate_mirror(Klass* k, bool is_scratch, Handle protection_domain, Handle classData,
282 Handle& mirror, Handle& comp_mirror, TRAPS); // returns mirror and comp_mirror
283 static void create_mirror(Klass* k, Handle class_loader, Handle module,
284 Handle protection_domain, Handle classData, TRAPS);
285 static void fixup_mirror(Klass* k, TRAPS);
286 static oop create_basic_type_mirror(const char* basic_type_name, BasicType type, TRAPS);
287
288 // Archiving
289 static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
290 static void create_scratch_mirror(Klass* k, TRAPS) NOT_CDS_JAVA_HEAP_RETURN;
291 static bool restore_archived_mirror(Klass *k, Handle class_loader, Handle module,
292 Handle protection_domain,
293 TRAPS) NOT_CDS_JAVA_HEAP_RETURN_(false);
294
295 static void fixup_module_field(Klass* k, Handle module);
299 static InstanceKlass* as_InstanceKlass(oop java_class);
300
301 static void set_klass(oop java_class, Klass* klass);
302 static BasicType as_BasicType(oop java_class, Klass** reference_klass = nullptr);
303 static Symbol* as_signature(oop java_class, bool intern_if_not_found);
304 static void print_signature(oop java_class, outputStream *st);
305 static const char* as_external_name(oop java_class);
306 // Testing
307 static bool is_instance(oop obj);
308
309 static bool is_primitive(oop java_class);
310 static void set_is_primitive(oop java_class);
311 static BasicType primitive_type(oop java_class);
312 static oop primitive_mirror(BasicType t);
313 // JVM_NewArray support
314 static Klass* array_klass_acquire(oop java_class);
315 static void release_set_array_klass(oop java_class, Klass* klass);
316 // compiler support for class operations
317 static int klass_offset() { CHECK_INIT(_klass_offset); }
318 static int array_klass_offset() { CHECK_INIT(_array_klass_offset); }
319 // Support for classRedefinedCount field
320 static int classRedefinedCount(oop the_class_mirror);
321 static void set_classRedefinedCount(oop the_class_mirror, int value);
322
323 // Support for embedded per-class oops
324 static oop protection_domain(oop java_class);
325 static oop init_lock(oop java_class);
326 static void clear_init_lock(oop java_class) {
327 set_init_lock(java_class, nullptr);
328 }
329 static oop component_mirror(oop java_class);
330 static int component_mirror_offset() { return _component_mirror_offset; }
331 static objArrayOop signers(oop java_class);
332 static oop class_data(oop java_class);
333 static void set_class_data(oop java_class, oop classData);
334 static void set_reflection_data(oop java_class, oop reflection_data);
335 static int reflection_data_offset() { return _reflectionData_offset; }
336
337 static oop class_loader(oop java_class);
338 static void set_module(oop java_class, oop module);
815 static void set_signature(oop constructor, oop value);
816 static void set_annotations(oop constructor, oop value);
817 static void set_parameter_annotations(oop method, oop value);
818
819 // Debugging
820 friend class JavaClasses;
821 };
822
823
824 // Interface to java.lang.reflect.Field objects
825
826 class java_lang_reflect_Field : public java_lang_reflect_AccessibleObject {
827 private:
828 // Note that to reduce dependencies on the JDK we compute these
829 // offsets at run-time.
830 static int _clazz_offset;
831 static int _name_offset;
832 static int _type_offset;
833 static int _slot_offset;
834 static int _modifiers_offset;
835 static int _trusted_final_offset;
836 static int _signature_offset;
837 static int _annotations_offset;
838
839 static void compute_offsets();
840
841 public:
842 static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
843
844 // Allocation
845 static Handle create(TRAPS);
846
847 // Accessors
848 static oop clazz(oop reflect);
849 static void set_clazz(oop reflect, oop value);
850
851 static oop name(oop field);
852 static void set_name(oop field, oop value);
853
854 static oop type(oop field);
855 static void set_type(oop field, oop value);
856
857 static int slot(oop reflect);
858 static void set_slot(oop reflect, int value);
859
860 static int modifiers(oop field);
861 static void set_modifiers(oop field, int value);
862
863 static void set_trusted_final(oop field);
864
865 static void set_signature(oop constructor, oop value);
866 static void set_annotations(oop constructor, oop value);
867
868 // Debugging
869 friend class JavaClasses;
870 };
871
872 class java_lang_reflect_Parameter {
873 private:
874 // Note that to reduce dependencies on the JDK we compute these
875 // offsets at run-time.
876 static int _name_offset;
877 static int _modifiers_offset;
878 static int _index_offset;
879 static int _executable_offset;
880
881 static void compute_offsets();
882
883 public:
965
966 // Debugging
967 friend class JavaClasses;
968 };
969
970
971 // Interface to java.lang primitive type boxing objects:
972 // - java.lang.Boolean
973 // - java.lang.Character
974 // - java.lang.Float
975 // - java.lang.Double
976 // - java.lang.Byte
977 // - java.lang.Short
978 // - java.lang.Integer
979 // - java.lang.Long
980
981 // This could be separated out into 8 individual classes.
982
983 class java_lang_boxing_object: AllStatic {
984 private:
985 static int _value_offset;
986 static int _long_value_offset;
987
988 static void compute_offsets();
989 static oop initialize_and_allocate(BasicType type, TRAPS);
990 public:
991 // Allocation. Returns a boxed value, or null for invalid type.
992 static oop create(BasicType type, jvalue* value, TRAPS);
993 // Accessors. Returns the basic type being boxed, or T_ILLEGAL for invalid oop.
994 static BasicType get_value(oop box, jvalue* value);
995 static BasicType set_value(oop box, jvalue* value);
996 static BasicType basic_type(oop box);
997 static bool is_instance(oop box) { return basic_type(box) != T_ILLEGAL; }
998 static bool is_instance(oop box, BasicType type) { return basic_type(box) == type; }
999 static void print(oop box, outputStream* st) { jvalue value; print(get_value(box, &value), &value, st); }
1000 static void print(BasicType type, jvalue* value, outputStream* st);
1001
1002 static int value_offset(BasicType type) {
1003 return is_double_word_type(type) ? _long_value_offset : _value_offset;
1004 }
1005
1006 static void serialize_offsets(SerializeClosure* f);
1007
1008 // Debugging
1009 friend class JavaClasses;
1010 };
1011
1012
1013
1014 // Interface to java.lang.ref.Reference objects
1015
1016 class java_lang_ref_Reference: AllStatic {
1017 static int _referent_offset;
1018 static int _queue_offset;
1019 static int _next_offset;
1020 static int _discovered_offset;
1021
1022 static bool _offsets_initialized;
1023
1345 static void set_flags(oop mname, int flags);
1346
1347 // Link through ResolvedMethodName field to get Method*
1348 static Method* vmtarget(oop mname);
1349 static void set_method(oop mname, oop method);
1350
1351 static intptr_t vmindex(oop mname);
1352 static void set_vmindex(oop mname, intptr_t index);
1353
1354 // Testers
1355 static bool is_subclass(Klass* klass) {
1356 return klass->is_subclass_of(vmClasses::MemberName_klass());
1357 }
1358 static bool is_instance(oop obj);
1359
1360 static bool is_method(oop obj);
1361
1362 // Relevant integer codes (keep these in synch. with MethodHandleNatives.Constants):
1363 enum {
1364 MN_IS_METHOD = 0x00010000, // method (not constructor)
1365 MN_IS_CONSTRUCTOR = 0x00020000, // constructor
1366 MN_IS_FIELD = 0x00040000, // field
1367 MN_IS_TYPE = 0x00080000, // nested type
1368 MN_CALLER_SENSITIVE = 0x00100000, // @CallerSensitive annotation detected
1369 MN_TRUSTED_FINAL = 0x00200000, // trusted final field
1370 MN_HIDDEN_MEMBER = 0x00400000, // @Hidden annotation detected
1371 MN_REFERENCE_KIND_SHIFT = 24, // refKind
1372 MN_REFERENCE_KIND_MASK = 0x0F000000 >> MN_REFERENCE_KIND_SHIFT,
1373 MN_NESTMATE_CLASS = 0x00000001,
1374 MN_HIDDEN_CLASS = 0x00000002,
1375 MN_STRONG_LOADER_LINK = 0x00000004,
1376 MN_ACCESS_VM_ANNOTATIONS = 0x00000008,
1377 // Lookup modes
1378 MN_MODULE_MODE = 0x00000010,
1379 MN_UNCONDITIONAL_MODE = 0x00000020,
1380 MN_TRUSTED_MODE = -1
1381 };
1382
1383 // Accessors for code generation:
1384 static int clazz_offset() { CHECK_INIT(_clazz_offset); }
1385 static int type_offset() { CHECK_INIT(_type_offset); }
1386 static int flags_offset() { CHECK_INIT(_flags_offset); }
1387 static int method_offset() { CHECK_INIT(_method_offset); }
1388 static int vmindex_offset() { CHECK_INIT(_vmindex_offset); }
1389 };
1390
1391
1392 // Interface to java.lang.invoke.MethodType objects
1856 class java_lang_Short_ShortCache : AllStatic {
1857 private:
1858 static int _static_cache_offset;
1859 public:
1860 static Symbol* symbol();
1861 static void compute_offsets(InstanceKlass* k);
1862 static objArrayOop cache(InstanceKlass *k);
1863 static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1864 };
1865
1866 class java_lang_Byte_ByteCache : AllStatic {
1867 private:
1868 static int _static_cache_offset;
1869 public:
1870 static Symbol* symbol();
1871 static void compute_offsets(InstanceKlass* k);
1872 static objArrayOop cache(InstanceKlass *k);
1873 static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1874 };
1875
1876
1877 // Interface to java.lang.InternalError objects
1878
1879 #define INTERNALERROR_INJECTED_FIELDS(macro) \
1880 macro(java_lang_InternalError, during_unsafe_access, bool_signature, false)
1881
1882 class java_lang_InternalError : AllStatic {
1883 private:
1884 static int _during_unsafe_access_offset;
1885 public:
1886 static jboolean during_unsafe_access(oop internal_error);
1887 static void set_during_unsafe_access(oop internal_error);
1888 static void compute_offsets();
1889 static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1890 };
1891
1892 // Use to declare fields that need to be injected into Java classes
1893 // for the JVM to use. The name_index and signature_index are
1894 // declared in vmSymbols. The may_be_java flag is used to declare
1895 // fields that might already exist in Java but should be injected if
1896 // they don't. Otherwise the field is unconditionally injected and
|
196 }
197
198 static unsigned int hash_code(oop java_string);
199 static unsigned int hash_code_noupdate(oop java_string);
200
201 // Compare strings (of different types/encodings), length is the string (array) length
202 static bool equals(oop java_string, const jchar* chars, int len);
203 static bool equals(oop java_string, const char* utf8_str, size_t utf8_len);
204 static bool equals(oop str1, oop str2);
205 static inline bool value_equals(typeArrayOop str_value1, typeArrayOop str_value2);
206
207 // Conversion between '.' and '/' formats, and allocate a String from the result.
208 static Handle externalize_classname(Symbol* java_name, TRAPS);
209
210 // Conversion
211 static Symbol* as_symbol(oop java_string);
212 static Symbol* as_symbol_or_null(oop java_string);
213
214 // Tester
215 static inline bool is_instance(oop obj);
216 static inline bool is_instance_without_asserts(oop obj);
217
218 // Debugging
219 static void print(oop java_string, outputStream* st, int max_length = MaxStringPrintSize);
220 friend class JavaClasses;
221 friend class StringTable;
222 };
223
224
225 // Interface to java.lang.Class objects
226
227 #define CLASS_INJECTED_FIELDS(macro) \
228 macro(java_lang_Class, klass, intptr_signature, false) \
229 macro(java_lang_Class, array_klass, intptr_signature, false) \
230 macro(java_lang_Class, oop_size, int_signature, false) \
231 macro(java_lang_Class, static_oop_field_count, int_signature, false) \
232 macro(java_lang_Class, source_file, object_signature, false) \
233 macro(java_lang_Class, init_lock, object_signature, false)
234
235 class java_lang_Class : AllStatic {
236 friend class VMStructs;
237 friend class JVMCIVMStructs;
238 friend class HeapShared;
239
240 private:
241
242 // The fake offsets are added by the class loader when java.lang.Class is loaded
243
244 static int _klass_offset;
245 static int _array_klass_offset;
246
247 static int _oop_size_offset;
248 static int _static_oop_field_count_offset;
249
250 static int _protection_domain_offset;
251 static int _init_lock_offset;
252 static int _signers_offset;
253 static int _class_loader_offset;
254 static int _module_offset;
255 static int _component_mirror_offset;
256
257 static int _name_offset;
258 static int _source_file_offset;
259 static int _classData_offset;
260 static int _classRedefinedCount_offset;
261 static int _reflectionData_offset;
262 static int _modifiers_offset;
263 static int _is_primitive_offset;
264 static int _is_identity_offset;
265 static int _raw_access_flags_offset;
266
267 static bool _offsets_computed;
268
269 static GrowableArray<Klass*>* _fixup_mirror_list;
270 static GrowableArray<Klass*>* _fixup_module_field_list;
271
272 static void set_init_lock(oop java_class, oop init_lock);
273 static void set_protection_domain(oop java_class, oop protection_domain);
274 static void set_class_loader(oop java_class, oop class_loader);
275 static void set_component_mirror(oop java_class, oop comp_mirror);
276 static void initialize_mirror_fields(InstanceKlass* ik, Handle mirror, Handle protection_domain,
277 Handle classData, TRAPS);
278 static void set_mirror_module_field(JavaThread* current, Klass* K, Handle mirror, Handle module);
279 static void set_is_identity(oop java_class, bool value);
280 public:
281 static void allocate_fixup_lists();
282 static void compute_offsets();
283
284 // Instance creation
285 static void allocate_mirror(Klass* k, bool is_scratch, Handle protection_domain, Handle classData,
286 Handle& mirror, Handle& comp_mirror, TRAPS); // returns mirror and comp_mirror
287 static void create_mirror(Klass* k, Handle class_loader, Handle module,
288 Handle protection_domain, Handle classData, TRAPS);
289 static void fixup_mirror(Klass* k, TRAPS);
290 static oop create_basic_type_mirror(const char* basic_type_name, BasicType type, TRAPS);
291
292 // Archiving
293 static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
294 static void create_scratch_mirror(Klass* k, TRAPS) NOT_CDS_JAVA_HEAP_RETURN;
295 static bool restore_archived_mirror(Klass *k, Handle class_loader, Handle module,
296 Handle protection_domain,
297 TRAPS) NOT_CDS_JAVA_HEAP_RETURN_(false);
298
299 static void fixup_module_field(Klass* k, Handle module);
303 static InstanceKlass* as_InstanceKlass(oop java_class);
304
305 static void set_klass(oop java_class, Klass* klass);
306 static BasicType as_BasicType(oop java_class, Klass** reference_klass = nullptr);
307 static Symbol* as_signature(oop java_class, bool intern_if_not_found);
308 static void print_signature(oop java_class, outputStream *st);
309 static const char* as_external_name(oop java_class);
310 // Testing
311 static bool is_instance(oop obj);
312
313 static bool is_primitive(oop java_class);
314 static void set_is_primitive(oop java_class);
315 static BasicType primitive_type(oop java_class);
316 static oop primitive_mirror(BasicType t);
317 // JVM_NewArray support
318 static Klass* array_klass_acquire(oop java_class);
319 static void release_set_array_klass(oop java_class, Klass* klass);
320 // compiler support for class operations
321 static int klass_offset() { CHECK_INIT(_klass_offset); }
322 static int array_klass_offset() { CHECK_INIT(_array_klass_offset); }
323
324 // Support for classRedefinedCount field
325 static int classRedefinedCount(oop the_class_mirror);
326 static void set_classRedefinedCount(oop the_class_mirror, int value);
327
328 // Support for embedded per-class oops
329 static oop protection_domain(oop java_class);
330 static oop init_lock(oop java_class);
331 static void clear_init_lock(oop java_class) {
332 set_init_lock(java_class, nullptr);
333 }
334 static oop component_mirror(oop java_class);
335 static int component_mirror_offset() { return _component_mirror_offset; }
336 static objArrayOop signers(oop java_class);
337 static oop class_data(oop java_class);
338 static void set_class_data(oop java_class, oop classData);
339 static void set_reflection_data(oop java_class, oop reflection_data);
340 static int reflection_data_offset() { return _reflectionData_offset; }
341
342 static oop class_loader(oop java_class);
343 static void set_module(oop java_class, oop module);
820 static void set_signature(oop constructor, oop value);
821 static void set_annotations(oop constructor, oop value);
822 static void set_parameter_annotations(oop method, oop value);
823
824 // Debugging
825 friend class JavaClasses;
826 };
827
828
829 // Interface to java.lang.reflect.Field objects
830
831 class java_lang_reflect_Field : public java_lang_reflect_AccessibleObject {
832 private:
833 // Note that to reduce dependencies on the JDK we compute these
834 // offsets at run-time.
835 static int _clazz_offset;
836 static int _name_offset;
837 static int _type_offset;
838 static int _slot_offset;
839 static int _modifiers_offset;
840 static int _flags_offset;
841 static int _signature_offset;
842 static int _annotations_offset;
843
844 static void compute_offsets();
845
846 public:
847 static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
848
849 // Allocation
850 static Handle create(TRAPS);
851
852 // Accessors
853 static oop clazz(oop reflect);
854 static void set_clazz(oop reflect, oop value);
855
856 static oop name(oop field);
857 static void set_name(oop field, oop value);
858
859 static oop type(oop field);
860 static void set_type(oop field, oop value);
861
862 static int slot(oop reflect);
863 static void set_slot(oop reflect, int value);
864
865 static int modifiers(oop field);
866 static void set_modifiers(oop field, int value);
867
868 static void set_flags(oop field, int value);
869
870 static void set_signature(oop constructor, oop value);
871 static void set_annotations(oop constructor, oop value);
872
873 // Debugging
874 friend class JavaClasses;
875 };
876
877 class java_lang_reflect_Parameter {
878 private:
879 // Note that to reduce dependencies on the JDK we compute these
880 // offsets at run-time.
881 static int _name_offset;
882 static int _modifiers_offset;
883 static int _index_offset;
884 static int _executable_offset;
885
886 static void compute_offsets();
887
888 public:
970
971 // Debugging
972 friend class JavaClasses;
973 };
974
975
976 // Interface to java.lang primitive type boxing objects:
977 // - java.lang.Boolean
978 // - java.lang.Character
979 // - java.lang.Float
980 // - java.lang.Double
981 // - java.lang.Byte
982 // - java.lang.Short
983 // - java.lang.Integer
984 // - java.lang.Long
985
986 // This could be separated out into 8 individual classes.
987
988 class java_lang_boxing_object: AllStatic {
989 private:
990 static int* _offsets;
991
992 static void compute_offsets();
993 static oop initialize_and_allocate(BasicType type, TRAPS);
994 public:
995 // Allocation. Returns a boxed value, or null for invalid type.
996 static oop create(BasicType type, jvalue* value, TRAPS);
997 // Accessors. Returns the basic type being boxed, or T_ILLEGAL for invalid oop.
998 static BasicType get_value(oop box, jvalue* value);
999 static BasicType set_value(oop box, jvalue* value);
1000 static BasicType basic_type(oop box);
1001 static bool is_instance(oop box) { return basic_type(box) != T_ILLEGAL; }
1002 static bool is_instance(oop box, BasicType type) { return basic_type(box) == type; }
1003 static void print(oop box, outputStream* st) { jvalue value; print(get_value(box, &value), &value, st); }
1004 static void print(BasicType type, jvalue* value, outputStream* st);
1005
1006 static int value_offset(BasicType type) {
1007 assert(type >= T_BOOLEAN && type <= T_LONG, "BasicType out of range");
1008 assert(_offsets != nullptr, "Uninitialized offsets");
1009 return _offsets[type - T_BOOLEAN];
1010 }
1011
1012 static void serialize_offsets(SerializeClosure* f);
1013
1014 // Debugging
1015 friend class JavaClasses;
1016 };
1017
1018
1019
1020 // Interface to java.lang.ref.Reference objects
1021
1022 class java_lang_ref_Reference: AllStatic {
1023 static int _referent_offset;
1024 static int _queue_offset;
1025 static int _next_offset;
1026 static int _discovered_offset;
1027
1028 static bool _offsets_initialized;
1029
1351 static void set_flags(oop mname, int flags);
1352
1353 // Link through ResolvedMethodName field to get Method*
1354 static Method* vmtarget(oop mname);
1355 static void set_method(oop mname, oop method);
1356
1357 static intptr_t vmindex(oop mname);
1358 static void set_vmindex(oop mname, intptr_t index);
1359
1360 // Testers
1361 static bool is_subclass(Klass* klass) {
1362 return klass->is_subclass_of(vmClasses::MemberName_klass());
1363 }
1364 static bool is_instance(oop obj);
1365
1366 static bool is_method(oop obj);
1367
1368 // Relevant integer codes (keep these in synch. with MethodHandleNatives.Constants):
1369 enum {
1370 MN_IS_METHOD = 0x00010000, // method (not constructor)
1371 MN_IS_OBJECT_CONSTRUCTOR = 0x00020000, // constructor
1372 MN_IS_FIELD = 0x00040000, // field
1373 MN_IS_TYPE = 0x00080000, // nested type
1374 MN_CALLER_SENSITIVE = 0x00100000, // @CallerSensitive annotation detected
1375 MN_TRUSTED_FINAL = 0x00200000, // trusted final field
1376 MN_HIDDEN_MEMBER = 0x00400000, // @Hidden annotation detected
1377 MN_NULL_RESTRICTED_FIELD = 0x00800000, // null-restricted field
1378 MN_REFERENCE_KIND_SHIFT = 24, // refKind
1379 MN_REFERENCE_KIND_MASK = 0x0F000000 >> MN_REFERENCE_KIND_SHIFT, // 4 bits
1380 MN_LAYOUT_SHIFT = 28, // field layout
1381 MN_LAYOUT_MASK = 0x70000000 >> MN_LAYOUT_SHIFT, // 3 bits
1382 MN_NESTMATE_CLASS = 0x00000001,
1383 MN_HIDDEN_CLASS = 0x00000002,
1384 MN_STRONG_LOADER_LINK = 0x00000004,
1385 MN_ACCESS_VM_ANNOTATIONS = 0x00000008,
1386 // Lookup modes
1387 MN_MODULE_MODE = 0x00000010,
1388 MN_UNCONDITIONAL_MODE = 0x00000020,
1389 MN_TRUSTED_MODE = -1
1390 };
1391
1392 // Accessors for code generation:
1393 static int clazz_offset() { CHECK_INIT(_clazz_offset); }
1394 static int type_offset() { CHECK_INIT(_type_offset); }
1395 static int flags_offset() { CHECK_INIT(_flags_offset); }
1396 static int method_offset() { CHECK_INIT(_method_offset); }
1397 static int vmindex_offset() { CHECK_INIT(_vmindex_offset); }
1398 };
1399
1400
1401 // Interface to java.lang.invoke.MethodType objects
1865 class java_lang_Short_ShortCache : AllStatic {
1866 private:
1867 static int _static_cache_offset;
1868 public:
1869 static Symbol* symbol();
1870 static void compute_offsets(InstanceKlass* k);
1871 static objArrayOop cache(InstanceKlass *k);
1872 static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1873 };
1874
1875 class java_lang_Byte_ByteCache : AllStatic {
1876 private:
1877 static int _static_cache_offset;
1878 public:
1879 static Symbol* symbol();
1880 static void compute_offsets(InstanceKlass* k);
1881 static objArrayOop cache(InstanceKlass *k);
1882 static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1883 };
1884
1885 // Interface to java.lang.InternalError objects
1886
1887 #define INTERNALERROR_INJECTED_FIELDS(macro) \
1888 macro(java_lang_InternalError, during_unsafe_access, bool_signature, false)
1889
1890 class java_lang_InternalError : AllStatic {
1891 private:
1892 static int _during_unsafe_access_offset;
1893 public:
1894 static jboolean during_unsafe_access(oop internal_error);
1895 static void set_during_unsafe_access(oop internal_error);
1896 static void compute_offsets();
1897 static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1898 };
1899
1900 // Use to declare fields that need to be injected into Java classes
1901 // for the JVM to use. The name_index and signature_index are
1902 // declared in vmSymbols. The may_be_java flag is used to declare
1903 // fields that might already exist in Java but should be injected if
1904 // they don't. Otherwise the field is unconditionally injected and
|