< prev index next >

src/hotspot/share/classfile/javaClasses.hpp

Print this page

 213 
 214 class java_lang_Class : AllStatic {
 215   friend class VMStructs;
 216   friend class JVMCIVMStructs;
 217 
 218  private:
 219 
 220   // The fake offsets are added by the class loader when java.lang.Class is loaded
 221 
 222   static int _klass_offset;
 223   static int _array_klass_offset;
 224 
 225   static int _oop_size_offset;
 226   static int _static_oop_field_count_offset;
 227 
 228   static int _protection_domain_offset;
 229   static int _signers_offset;
 230   static int _class_loader_offset;
 231   static int _module_offset;
 232   static int _component_mirror_offset;

 233   static int _name_offset;
 234   static int _source_file_offset;
 235   static int _classData_offset;
 236   static int _classRedefinedCount_offset;
 237 
 238   static bool _offsets_computed;
 239 
 240   static GrowableArray<Klass*>* _fixup_mirror_list;
 241   static GrowableArray<Klass*>* _fixup_module_field_list;
 242 
 243   static void set_protection_domain(oop java_class, oop protection_domain);
 244   static void set_class_loader(oop java_class, oop class_loader);
 245   static void set_component_mirror(oop java_class, oop comp_mirror);

 246   static void initialize_mirror_fields(Klass* k, Handle mirror, Handle protection_domain,
 247                                        Handle classData, TRAPS);
 248   static void set_mirror_module_field(JavaThread* current, Klass* K, Handle mirror, Handle module);
 249  public:
 250   static void allocate_fixup_lists();
 251   static void compute_offsets();
 252 
 253   // Instance creation
 254   static void allocate_mirror(Klass* k, bool is_scratch, Handle protection_domain, Handle classData,
 255                               Handle& mirror, Handle& comp_mirror, TRAPS); // returns mirror and comp_mirror
 256   static void create_mirror(Klass* k, Handle class_loader, Handle module,
 257                             Handle protection_domain, Handle classData, TRAPS);
 258   static void fixup_mirror(Klass* k, TRAPS);
 259   static oop  create_basic_type_mirror(const char* basic_type_name, BasicType type, TRAPS);
 260 
 261   // Archiving
 262   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
 263   static void create_scratch_mirror(Klass* k, TRAPS) NOT_CDS_JAVA_HEAP_RETURN;
 264   static bool restore_archived_mirror(Klass *k, Handle class_loader, Handle module,
 265                                       Handle protection_domain,

 269 
 270   // Conversion
 271   static Klass* as_Klass(oop java_class);
 272   static void set_klass(oop java_class, Klass* klass);
 273   static BasicType as_BasicType(oop java_class, Klass** reference_klass = nullptr);
 274   static Symbol* as_signature(oop java_class, bool intern_if_not_found);
 275   static void print_signature(oop java_class, outputStream *st);
 276   static const char* as_external_name(oop java_class);
 277   // Testing
 278   static bool is_instance(oop obj);
 279 
 280   static bool is_primitive(oop java_class);
 281   static BasicType primitive_type(oop java_class);
 282   static oop primitive_mirror(BasicType t);
 283   // JVM_NewArray support
 284   static Klass* array_klass_acquire(oop java_class);
 285   static void release_set_array_klass(oop java_class, Klass* klass);
 286   // compiler support for class operations
 287   static int klass_offset()                { CHECK_INIT(_klass_offset); }
 288   static int array_klass_offset()          { CHECK_INIT(_array_klass_offset); }


 289   // Support for classRedefinedCount field
 290   static int classRedefinedCount(oop the_class_mirror);
 291   static void set_classRedefinedCount(oop the_class_mirror, int value);
 292 
 293   // Support for embedded per-class oops
 294   static oop  protection_domain(oop java_class);
 295   static oop  component_mirror(oop java_class);

 296   static objArrayOop  signers(oop java_class);
 297   static void set_signers(oop java_class, objArrayOop signers);
 298   static oop  class_data(oop java_class);
 299   static void set_class_data(oop java_class, oop classData);
 300 
 301   static int component_mirror_offset() { return _component_mirror_offset; }
 302 
 303   static oop class_loader(oop java_class);
 304   static void set_module(oop java_class, oop module);
 305   static oop module(oop java_class);
 306 
 307   static oop name(Handle java_class, TRAPS);
 308 
 309   static oop source_file(oop java_class);
 310   static void set_source_file(oop java_class, oop source_file);
 311 
 312   static size_t oop_size(oop java_class);
 313   static void set_oop_size(HeapWord* java_class, size_t size);
 314   static int static_oop_field_count(oop java_class);
 315   static void set_static_oop_field_count(oop java_class, int size);
 316 
 317   static GrowableArray<Klass*>* fixup_mirror_list() {
 318     return _fixup_mirror_list;
 319   }
 320   static void set_fixup_mirror_list(GrowableArray<Klass*>* v) {
 321     _fixup_mirror_list = v;
 322   }

 742   static void set_signature(oop constructor, oop value);
 743   static void set_annotations(oop constructor, oop value);
 744   static void set_parameter_annotations(oop method, oop value);
 745 
 746   // Debugging
 747   friend class JavaClasses;
 748 };
 749 
 750 
 751 // Interface to java.lang.reflect.Field objects
 752 
 753 class java_lang_reflect_Field : public java_lang_reflect_AccessibleObject {
 754  private:
 755   // Note that to reduce dependencies on the JDK we compute these
 756   // offsets at run-time.
 757   static int _clazz_offset;
 758   static int _name_offset;
 759   static int _type_offset;
 760   static int _slot_offset;
 761   static int _modifiers_offset;
 762   static int _trusted_final_offset;
 763   static int _signature_offset;
 764   static int _annotations_offset;
 765 
 766   static void compute_offsets();
 767 
 768  public:
 769   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
 770 
 771   // Allocation
 772   static Handle create(TRAPS);
 773 
 774   // Accessors
 775   static oop clazz(oop reflect);
 776   static void set_clazz(oop reflect, oop value);
 777 
 778   static oop name(oop field);
 779   static void set_name(oop field, oop value);
 780 
 781   static oop type(oop field);
 782   static void set_type(oop field, oop value);
 783 
 784   static int slot(oop reflect);
 785   static void set_slot(oop reflect, int value);
 786 
 787   static int modifiers(oop field);
 788   static void set_modifiers(oop field, int value);
 789 
 790   static void set_trusted_final(oop field);
 791 
 792   static void set_signature(oop constructor, oop value);
 793   static void set_annotations(oop constructor, oop value);
 794 
 795   // Debugging
 796   friend class JavaClasses;
 797 };
 798 
 799 class java_lang_reflect_Parameter {
 800  private:
 801   // Note that to reduce dependencies on the JDK we compute these
 802   // offsets at run-time.
 803   static int _name_offset;
 804   static int _modifiers_offset;
 805   static int _index_offset;
 806   static int _executable_offset;
 807 
 808   static void compute_offsets();
 809 
 810  public:

1269   static void       set_flags(oop mname, int flags);
1270 
1271   // Link through ResolvedMethodName field to get Method*
1272   static Method*        vmtarget(oop mname);
1273   static void       set_method(oop mname, oop method);
1274 
1275   static intptr_t       vmindex(oop mname);
1276   static void       set_vmindex(oop mname, intptr_t index);
1277 
1278   // Testers
1279   static bool is_subclass(Klass* klass) {
1280     return klass->is_subclass_of(vmClasses::MemberName_klass());
1281   }
1282   static bool is_instance(oop obj);
1283 
1284   static bool is_method(oop obj);
1285 
1286   // Relevant integer codes (keep these in synch. with MethodHandleNatives.Constants):
1287   enum {
1288     MN_IS_METHOD             = 0x00010000, // method (not constructor)
1289     MN_IS_CONSTRUCTOR        = 0x00020000, // constructor
1290     MN_IS_FIELD              = 0x00040000, // field
1291     MN_IS_TYPE               = 0x00080000, // nested type
1292     MN_CALLER_SENSITIVE      = 0x00100000, // @CallerSensitive annotation detected
1293     MN_TRUSTED_FINAL         = 0x00200000, // trusted final field
1294     MN_HIDDEN_MEMBER         = 0x00400000, // @Hidden annotation detected
1295     MN_REFERENCE_KIND_SHIFT  = 24, // refKind
1296     MN_REFERENCE_KIND_MASK   = 0x0F000000 >> MN_REFERENCE_KIND_SHIFT,


1297     MN_NESTMATE_CLASS        = 0x00000001,
1298     MN_HIDDEN_CLASS          = 0x00000002,
1299     MN_STRONG_LOADER_LINK    = 0x00000004,
1300     MN_ACCESS_VM_ANNOTATIONS = 0x00000008,
1301     // Lookup modes
1302     MN_MODULE_MODE           = 0x00000010,
1303     MN_UNCONDITIONAL_MODE    = 0x00000020,
1304     MN_TRUSTED_MODE          = -1
1305   };
1306 
1307   // Accessors for code generation:
1308   static int clazz_offset()   { CHECK_INIT(_clazz_offset); }
1309   static int type_offset()    { CHECK_INIT(_type_offset); }
1310   static int flags_offset()   { CHECK_INIT(_flags_offset); }
1311   static int method_offset()  { CHECK_INIT(_method_offset); }
1312   static int vmindex_offset() { CHECK_INIT(_vmindex_offset); }
1313 };
1314 
1315 
1316 // Interface to java.lang.invoke.MethodType objects

1840 class java_lang_Short_ShortCache : AllStatic {
1841  private:
1842   static int _static_cache_offset;
1843  public:
1844   static Symbol* symbol();
1845   static void compute_offsets(InstanceKlass* k);
1846   static objArrayOop  cache(InstanceKlass *k);
1847   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1848 };
1849 
1850 class java_lang_Byte_ByteCache : AllStatic {
1851  private:
1852   static int _static_cache_offset;
1853  public:
1854   static Symbol* symbol();
1855   static void compute_offsets(InstanceKlass* k);
1856   static objArrayOop  cache(InstanceKlass *k);
1857   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1858 };
1859 
1860 
1861 // Interface to java.lang.InternalError objects
1862 
1863 #define INTERNALERROR_INJECTED_FIELDS(macro)                      \
1864   macro(java_lang_InternalError, during_unsafe_access, bool_signature, false)
1865 
1866 class java_lang_InternalError : AllStatic {
1867  private:
1868   static int _during_unsafe_access_offset;
1869  public:
1870   static jboolean during_unsafe_access(oop internal_error);
1871   static void set_during_unsafe_access(oop internal_error);
1872   static void compute_offsets();
1873   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1874 };
1875 
1876 // Use to declare fields that need to be injected into Java classes
1877 // for the JVM to use.  The name_index and signature_index are
1878 // declared in vmSymbols.  The may_be_java flag is used to declare
1879 // fields that might already exist in Java but should be injected if
1880 // they don't.  Otherwise the field is unconditionally injected and

 213 
 214 class java_lang_Class : AllStatic {
 215   friend class VMStructs;
 216   friend class JVMCIVMStructs;
 217 
 218  private:
 219 
 220   // The fake offsets are added by the class loader when java.lang.Class is loaded
 221 
 222   static int _klass_offset;
 223   static int _array_klass_offset;
 224 
 225   static int _oop_size_offset;
 226   static int _static_oop_field_count_offset;
 227 
 228   static int _protection_domain_offset;
 229   static int _signers_offset;
 230   static int _class_loader_offset;
 231   static int _module_offset;
 232   static int _component_mirror_offset;
 233 
 234   static int _name_offset;
 235   static int _source_file_offset;
 236   static int _classData_offset;
 237   static int _classRedefinedCount_offset;
 238 
 239   static bool _offsets_computed;
 240 
 241   static GrowableArray<Klass*>* _fixup_mirror_list;
 242   static GrowableArray<Klass*>* _fixup_module_field_list;
 243 
 244   static void set_protection_domain(oop java_class, oop protection_domain);
 245   static void set_class_loader(oop java_class, oop class_loader);
 246   static void set_component_mirror(oop java_class, oop comp_mirror);
 247 
 248   static void initialize_mirror_fields(Klass* k, Handle mirror, Handle protection_domain,
 249                                        Handle classData, TRAPS);
 250   static void set_mirror_module_field(JavaThread* current, Klass* K, Handle mirror, Handle module);
 251  public:
 252   static void allocate_fixup_lists();
 253   static void compute_offsets();
 254 
 255   // Instance creation
 256   static void allocate_mirror(Klass* k, bool is_scratch, Handle protection_domain, Handle classData,
 257                               Handle& mirror, Handle& comp_mirror, TRAPS); // returns mirror and comp_mirror
 258   static void create_mirror(Klass* k, Handle class_loader, Handle module,
 259                             Handle protection_domain, Handle classData, TRAPS);
 260   static void fixup_mirror(Klass* k, TRAPS);
 261   static oop  create_basic_type_mirror(const char* basic_type_name, BasicType type, TRAPS);
 262 
 263   // Archiving
 264   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
 265   static void create_scratch_mirror(Klass* k, TRAPS) NOT_CDS_JAVA_HEAP_RETURN;
 266   static bool restore_archived_mirror(Klass *k, Handle class_loader, Handle module,
 267                                       Handle protection_domain,

 271 
 272   // Conversion
 273   static Klass* as_Klass(oop java_class);
 274   static void set_klass(oop java_class, Klass* klass);
 275   static BasicType as_BasicType(oop java_class, Klass** reference_klass = nullptr);
 276   static Symbol* as_signature(oop java_class, bool intern_if_not_found);
 277   static void print_signature(oop java_class, outputStream *st);
 278   static const char* as_external_name(oop java_class);
 279   // Testing
 280   static bool is_instance(oop obj);
 281 
 282   static bool is_primitive(oop java_class);
 283   static BasicType primitive_type(oop java_class);
 284   static oop primitive_mirror(BasicType t);
 285   // JVM_NewArray support
 286   static Klass* array_klass_acquire(oop java_class);
 287   static void release_set_array_klass(oop java_class, Klass* klass);
 288   // compiler support for class operations
 289   static int klass_offset()                { CHECK_INIT(_klass_offset); }
 290   static int array_klass_offset()          { CHECK_INIT(_array_klass_offset); }
 291   static int component_mirror_offset()     { CHECK_INIT(_component_mirror_offset); }
 292 
 293   // Support for classRedefinedCount field
 294   static int classRedefinedCount(oop the_class_mirror);
 295   static void set_classRedefinedCount(oop the_class_mirror, int value);
 296 
 297   // Support for embedded per-class oops
 298   static oop  protection_domain(oop java_class);
 299   static oop  component_mirror(oop java_class);
 300 
 301   static objArrayOop  signers(oop java_class);
 302   static void set_signers(oop java_class, objArrayOop signers);
 303   static oop  class_data(oop java_class);
 304   static void set_class_data(oop java_class, oop classData);
 305 


 306   static oop class_loader(oop java_class);
 307   static void set_module(oop java_class, oop module);
 308   static oop module(oop java_class);
 309 
 310   static oop name(Handle java_class, TRAPS);
 311 
 312   static oop source_file(oop java_class);
 313   static void set_source_file(oop java_class, oop source_file);
 314 
 315   static size_t oop_size(oop java_class);
 316   static void set_oop_size(HeapWord* java_class, size_t size);
 317   static int static_oop_field_count(oop java_class);
 318   static void set_static_oop_field_count(oop java_class, int size);
 319 
 320   static GrowableArray<Klass*>* fixup_mirror_list() {
 321     return _fixup_mirror_list;
 322   }
 323   static void set_fixup_mirror_list(GrowableArray<Klass*>* v) {
 324     _fixup_mirror_list = v;
 325   }

 745   static void set_signature(oop constructor, oop value);
 746   static void set_annotations(oop constructor, oop value);
 747   static void set_parameter_annotations(oop method, oop value);
 748 
 749   // Debugging
 750   friend class JavaClasses;
 751 };
 752 
 753 
 754 // Interface to java.lang.reflect.Field objects
 755 
 756 class java_lang_reflect_Field : public java_lang_reflect_AccessibleObject {
 757  private:
 758   // Note that to reduce dependencies on the JDK we compute these
 759   // offsets at run-time.
 760   static int _clazz_offset;
 761   static int _name_offset;
 762   static int _type_offset;
 763   static int _slot_offset;
 764   static int _modifiers_offset;
 765   static int _flags_offset;
 766   static int _signature_offset;
 767   static int _annotations_offset;
 768 
 769   static void compute_offsets();
 770 
 771  public:
 772   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
 773 
 774   // Allocation
 775   static Handle create(TRAPS);
 776 
 777   // Accessors
 778   static oop clazz(oop reflect);
 779   static void set_clazz(oop reflect, oop value);
 780 
 781   static oop name(oop field);
 782   static void set_name(oop field, oop value);
 783 
 784   static oop type(oop field);
 785   static void set_type(oop field, oop value);
 786 
 787   static int slot(oop reflect);
 788   static void set_slot(oop reflect, int value);
 789 
 790   static int modifiers(oop field);
 791   static void set_modifiers(oop field, int value);
 792 
 793   static void set_flags(oop field, int value);
 794 
 795   static void set_signature(oop constructor, oop value);
 796   static void set_annotations(oop constructor, oop value);
 797 
 798   // Debugging
 799   friend class JavaClasses;
 800 };
 801 
 802 class java_lang_reflect_Parameter {
 803  private:
 804   // Note that to reduce dependencies on the JDK we compute these
 805   // offsets at run-time.
 806   static int _name_offset;
 807   static int _modifiers_offset;
 808   static int _index_offset;
 809   static int _executable_offset;
 810 
 811   static void compute_offsets();
 812 
 813  public:

1272   static void       set_flags(oop mname, int flags);
1273 
1274   // Link through ResolvedMethodName field to get Method*
1275   static Method*        vmtarget(oop mname);
1276   static void       set_method(oop mname, oop method);
1277 
1278   static intptr_t       vmindex(oop mname);
1279   static void       set_vmindex(oop mname, intptr_t index);
1280 
1281   // Testers
1282   static bool is_subclass(Klass* klass) {
1283     return klass->is_subclass_of(vmClasses::MemberName_klass());
1284   }
1285   static bool is_instance(oop obj);
1286 
1287   static bool is_method(oop obj);
1288 
1289   // Relevant integer codes (keep these in synch. with MethodHandleNatives.Constants):
1290   enum {
1291     MN_IS_METHOD             = 0x00010000, // method (not constructor)
1292     MN_IS_OBJECT_CONSTRUCTOR = 0x00020000, // constructor
1293     MN_IS_FIELD              = 0x00040000, // field
1294     MN_IS_TYPE               = 0x00080000, // nested type
1295     MN_CALLER_SENSITIVE      = 0x00100000, // @CallerSensitive annotation detected
1296     MN_TRUSTED_FINAL         = 0x00200000, // trusted final field
1297     MN_HIDDEN_MEMBER         = 0x00400000, // @Hidden annotation detected
1298     MN_FLAT_FIELD            = 0x00800000, // flat field
1299     MN_NULL_RESTRICTED_FIELD = 0x01000000, // null-restricted field
1300     MN_REFERENCE_KIND_SHIFT  = 26, // refKind
1301     MN_REFERENCE_KIND_MASK   = 0x3C000000 >> MN_REFERENCE_KIND_SHIFT,
1302     MN_NESTMATE_CLASS        = 0x00000001,
1303     MN_HIDDEN_CLASS          = 0x00000002,
1304     MN_STRONG_LOADER_LINK    = 0x00000004,
1305     MN_ACCESS_VM_ANNOTATIONS = 0x00000008,
1306     // Lookup modes
1307     MN_MODULE_MODE           = 0x00000010,
1308     MN_UNCONDITIONAL_MODE    = 0x00000020,
1309     MN_TRUSTED_MODE          = -1
1310   };
1311 
1312   // Accessors for code generation:
1313   static int clazz_offset()   { CHECK_INIT(_clazz_offset); }
1314   static int type_offset()    { CHECK_INIT(_type_offset); }
1315   static int flags_offset()   { CHECK_INIT(_flags_offset); }
1316   static int method_offset()  { CHECK_INIT(_method_offset); }
1317   static int vmindex_offset() { CHECK_INIT(_vmindex_offset); }
1318 };
1319 
1320 
1321 // Interface to java.lang.invoke.MethodType objects

1845 class java_lang_Short_ShortCache : AllStatic {
1846  private:
1847   static int _static_cache_offset;
1848  public:
1849   static Symbol* symbol();
1850   static void compute_offsets(InstanceKlass* k);
1851   static objArrayOop  cache(InstanceKlass *k);
1852   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1853 };
1854 
1855 class java_lang_Byte_ByteCache : AllStatic {
1856  private:
1857   static int _static_cache_offset;
1858  public:
1859   static Symbol* symbol();
1860   static void compute_offsets(InstanceKlass* k);
1861   static objArrayOop  cache(InstanceKlass *k);
1862   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1863 };
1864 

1865 // Interface to java.lang.InternalError objects
1866 
1867 #define INTERNALERROR_INJECTED_FIELDS(macro)                      \
1868   macro(java_lang_InternalError, during_unsafe_access, bool_signature, false)
1869 
1870 class java_lang_InternalError : AllStatic {
1871  private:
1872   static int _during_unsafe_access_offset;
1873  public:
1874   static jboolean during_unsafe_access(oop internal_error);
1875   static void set_during_unsafe_access(oop internal_error);
1876   static void compute_offsets();
1877   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1878 };
1879 
1880 // Use to declare fields that need to be injected into Java classes
1881 // for the JVM to use.  The name_index and signature_index are
1882 // declared in vmSymbols.  The may_be_java flag is used to declare
1883 // fields that might already exist in Java but should be injected if
1884 // they don't.  Otherwise the field is unconditionally injected and
< prev index next >