< prev index next >

src/hotspot/share/classfile/javaClasses.hpp

Print this page

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



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



 244   static void initialize_mirror_fields(Klass* k, Handle mirror, Handle protection_domain,
 245                                        Handle classData, TRAPS);
 246   static void set_mirror_module_field(JavaThread* current, Klass* K, Handle mirror, Handle module);
 247  public:
 248   static void allocate_fixup_lists();
 249   static void compute_offsets();
 250 
 251   // Instance creation
 252   static void create_mirror(Klass* k, Handle class_loader, Handle module,
 253                             Handle protection_domain, Handle classData, TRAPS);
 254   static void fixup_mirror(Klass* k, TRAPS);
 255   static oop  create_basic_type_mirror(const char* basic_type_name, BasicType type, TRAPS);

 256   static void update_archived_primitive_mirror_native_pointers(oop archived_mirror) NOT_CDS_JAVA_HEAP_RETURN;
 257   static void update_archived_mirror_native_pointers(oop archived_mirror) NOT_CDS_JAVA_HEAP_RETURN;
 258 
 259   // Archiving
 260   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
 261   static void archive_basic_type_mirrors() NOT_CDS_JAVA_HEAP_RETURN;
 262   static oop  archive_mirror(Klass* k) NOT_CDS_JAVA_HEAP_RETURN_(NULL);
 263   static oop  process_archived_mirror(Klass* k, oop mirror, oop archived_mirror)
 264                                       NOT_CDS_JAVA_HEAP_RETURN_(NULL);
 265   static bool restore_archived_mirror(Klass *k, Handle class_loader, Handle module,
 266                                       Handle protection_domain,
 267                                       TRAPS) NOT_CDS_JAVA_HEAP_RETURN_(false);
 268 
 269   static void fixup_module_field(Klass* k, Handle module);
 270 
 271   // Conversion
 272   static Klass* as_Klass(oop java_class);
 273   static void set_klass(oop java_class, Klass* klass);
 274   static BasicType as_BasicType(oop java_class, Klass** reference_klass = NULL);
 275   static Symbol* as_signature(oop java_class, bool intern_if_not_found);
 276   static void print_signature(oop java_class, outputStream *st);
 277   static const char* as_external_name(oop java_class);
 278   // Testing
 279   static bool is_instance(oop obj);
 280 
 281   static bool is_primitive(oop java_class);
 282   static BasicType primitive_type(oop java_class);
 283   static oop primitive_mirror(BasicType t);
 284   // JVM_NewArray support
 285   static Klass* array_klass_acquire(oop java_class);
 286   static void release_set_array_klass(oop java_class, Klass* klass);
 287   // compiler support for class operations
 288   static int klass_offset()                { CHECK_INIT(_klass_offset); }
 289   static int array_klass_offset()          { CHECK_INIT(_array_klass_offset); }



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





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

1291   static void       set_flags(oop mname, int flags);
1292 
1293   // Link through ResolvedMethodName field to get Method*
1294   static Method*        vmtarget(oop mname);
1295   static void       set_method(oop mname, oop method);
1296 
1297   static intptr_t       vmindex(oop mname);
1298   static void       set_vmindex(oop mname, intptr_t index);
1299 
1300   // Testers
1301   static bool is_subclass(Klass* klass) {
1302     return klass->is_subclass_of(vmClasses::MemberName_klass());
1303   }
1304   static bool is_instance(oop obj);
1305 
1306   static bool is_method(oop obj);
1307 
1308   // Relevant integer codes (keep these in synch. with MethodHandleNatives.Constants):
1309   enum {
1310     MN_IS_METHOD             = 0x00010000, // method (not constructor)
1311     MN_IS_CONSTRUCTOR        = 0x00020000, // constructor
1312     MN_IS_FIELD              = 0x00040000, // field
1313     MN_IS_TYPE               = 0x00080000, // nested type
1314     MN_CALLER_SENSITIVE      = 0x00100000, // @CallerSensitive annotation detected
1315     MN_TRUSTED_FINAL         = 0x00200000, // trusted final field

1316     MN_REFERENCE_KIND_SHIFT  = 24, // refKind
1317     MN_REFERENCE_KIND_MASK   = 0x0F000000 >> MN_REFERENCE_KIND_SHIFT,
1318     // The SEARCH_* bits are not for MN.flags but for the matchFlags argument of MHN.getMembers:
1319     MN_SEARCH_SUPERCLASSES   = 0x00100000, // walk super classes
1320     MN_SEARCH_INTERFACES     = 0x00200000, // walk implemented interfaces
1321     MN_NESTMATE_CLASS        = 0x00000001,
1322     MN_HIDDEN_CLASS          = 0x00000002,
1323     MN_STRONG_LOADER_LINK    = 0x00000004,
1324     MN_ACCESS_VM_ANNOTATIONS = 0x00000008,
1325     // Lookup modes
1326     MN_MODULE_MODE           = 0x00000010,
1327     MN_UNCONDITIONAL_MODE    = 0x00000020,
1328     MN_TRUSTED_MODE          = -1
1329   };
1330 
1331   // Accessors for code generation:
1332   static int clazz_offset()   { CHECK_INIT(_clazz_offset); }
1333   static int type_offset()    { CHECK_INIT(_type_offset); }
1334   static int flags_offset()   { CHECK_INIT(_flags_offset); }
1335   static int method_offset()  { CHECK_INIT(_method_offset); }

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

 211 
 212 class java_lang_Class : AllStatic {
 213   friend class VMStructs;
 214   friend class JVMCIVMStructs;
 215 
 216  private:
 217 
 218   // The fake offsets are added by the class loader when java.lang.Class is loaded
 219 
 220   static int _klass_offset;
 221   static int _array_klass_offset;
 222 
 223   static int _oop_size_offset;
 224   static int _static_oop_field_count_offset;
 225 
 226   static int _protection_domain_offset;
 227   static int _signers_offset;
 228   static int _class_loader_offset;
 229   static int _module_offset;
 230   static int _component_mirror_offset;
 231   static int _primary_mirror_offset;
 232   static int _secondary_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   static void set_primary_mirror(oop java_class, oop comp_mirror);
 248   static void set_secondary_mirror(oop java_class, oop comp_mirror);
 249 
 250   static void initialize_mirror_fields(Klass* k, Handle mirror, Handle protection_domain,
 251                                        Handle classData, TRAPS);
 252   static void set_mirror_module_field(JavaThread* current, Klass* K, Handle mirror, Handle module);
 253  public:
 254   static void allocate_fixup_lists();
 255   static void compute_offsets();
 256 
 257   // Instance creation
 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   static oop  create_secondary_mirror(Klass* k, Handle mirror, TRAPS);
 263   static void update_archived_primitive_mirror_native_pointers(oop archived_mirror) NOT_CDS_JAVA_HEAP_RETURN;
 264   static void update_archived_mirror_native_pointers(oop archived_mirror) NOT_CDS_JAVA_HEAP_RETURN;
 265 
 266   // Archiving
 267   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
 268   static void archive_basic_type_mirrors() NOT_CDS_JAVA_HEAP_RETURN;
 269   static oop  archive_mirror(Klass* k) NOT_CDS_JAVA_HEAP_RETURN_(NULL);
 270   static oop  process_archived_mirror(Klass* k, oop mirror, oop archived_mirror)
 271                                       NOT_CDS_JAVA_HEAP_RETURN_(NULL);
 272   static bool restore_archived_mirror(Klass *k, Handle class_loader, Handle module,
 273                                       Handle protection_domain,
 274                                       TRAPS) NOT_CDS_JAVA_HEAP_RETURN_(false);
 275 
 276   static void fixup_module_field(Klass* k, Handle module);
 277 
 278   // Conversion
 279   static Klass* as_Klass(oop java_class);
 280   static void set_klass(oop java_class, Klass* klass);
 281   static BasicType as_BasicType(oop java_class, Klass** reference_klass = NULL);
 282   static Symbol* as_signature(oop java_class, bool intern_if_not_found);
 283   static void print_signature(oop java_class, outputStream *st);
 284   static const char* as_external_name(oop java_class);
 285   // Testing
 286   static bool is_instance(oop obj);
 287 
 288   static bool is_primitive(oop java_class);
 289   static BasicType primitive_type(oop java_class);
 290   static oop primitive_mirror(BasicType t);
 291   // JVM_NewArray support
 292   static Klass* array_klass_acquire(oop java_class);
 293   static void release_set_array_klass(oop java_class, Klass* klass);
 294   // compiler support for class operations
 295   static int klass_offset()                { CHECK_INIT(_klass_offset); }
 296   static int array_klass_offset()          { CHECK_INIT(_array_klass_offset); }
 297   static int component_mirror_offset()     { CHECK_INIT(_component_mirror_offset); }
 298   static int primary_mirror_offset()       { CHECK_INIT(_primary_mirror_offset); }
 299   static int secondary_mirror_offset()     { CHECK_INIT(_secondary_mirror_offset); }
 300   // Support for classRedefinedCount field
 301   static int classRedefinedCount(oop the_class_mirror);
 302   static void set_classRedefinedCount(oop the_class_mirror, int value);
 303 
 304   // Support for embedded per-class oops
 305   static oop  protection_domain(oop java_class);
 306   static oop  component_mirror(oop java_class);
 307   static oop  primary_mirror(oop java_class);
 308   static oop  secondary_mirror(oop java_class);
 309   static bool is_primary_mirror(oop java_class);
 310   static bool is_secondary_mirror(oop java_class);
 311 
 312   static objArrayOop  signers(oop java_class);
 313   static void set_signers(oop java_class, objArrayOop signers);
 314   static oop  class_data(oop java_class);
 315   static void set_class_data(oop java_class, oop classData);
 316 


 317   static oop class_loader(oop java_class);
 318   static void set_module(oop java_class, oop module);
 319   static oop module(oop java_class);
 320 
 321   static oop name(Handle java_class, TRAPS);
 322 
 323   static oop source_file(oop java_class);
 324   static void set_source_file(oop java_class, oop source_file);
 325 
 326   static size_t oop_size(oop java_class);
 327   static void set_oop_size(HeapWord* java_class, size_t size);
 328   static int static_oop_field_count(oop java_class);
 329   static void set_static_oop_field_count(oop java_class, int size);
 330 
 331   static GrowableArray<Klass*>* fixup_mirror_list() {
 332     return _fixup_mirror_list;
 333   }
 334   static void set_fixup_mirror_list(GrowableArray<Klass*>* v) {
 335     _fixup_mirror_list = v;
 336   }

1304   static void       set_flags(oop mname, int flags);
1305 
1306   // Link through ResolvedMethodName field to get Method*
1307   static Method*        vmtarget(oop mname);
1308   static void       set_method(oop mname, oop method);
1309 
1310   static intptr_t       vmindex(oop mname);
1311   static void       set_vmindex(oop mname, intptr_t index);
1312 
1313   // Testers
1314   static bool is_subclass(Klass* klass) {
1315     return klass->is_subclass_of(vmClasses::MemberName_klass());
1316   }
1317   static bool is_instance(oop obj);
1318 
1319   static bool is_method(oop obj);
1320 
1321   // Relevant integer codes (keep these in synch. with MethodHandleNatives.Constants):
1322   enum {
1323     MN_IS_METHOD             = 0x00010000, // method (not constructor)
1324     MN_IS_OBJECT_CONSTRUCTOR = 0x00020000, // constructor
1325     MN_IS_FIELD              = 0x00040000, // field
1326     MN_IS_TYPE               = 0x00080000, // nested type
1327     MN_CALLER_SENSITIVE      = 0x00100000, // @CallerSensitive annotation detected
1328     MN_TRUSTED_FINAL         = 0x00200000, // trusted final field
1329     MN_FLATTENED             = 0x00400000, // flattened field
1330     MN_REFERENCE_KIND_SHIFT  = 24, // refKind
1331     MN_REFERENCE_KIND_MASK   = 0x0F000000 >> MN_REFERENCE_KIND_SHIFT,
1332     // The SEARCH_* bits are not for MN.flags but for the matchFlags argument of MHN.getMembers:
1333     MN_SEARCH_SUPERCLASSES   = 0x00100000, // walk super classes
1334     MN_SEARCH_INTERFACES     = 0x00200000, // walk implemented interfaces
1335     MN_NESTMATE_CLASS        = 0x00000001,
1336     MN_HIDDEN_CLASS          = 0x00000002,
1337     MN_STRONG_LOADER_LINK    = 0x00000004,
1338     MN_ACCESS_VM_ANNOTATIONS = 0x00000008,
1339     // Lookup modes
1340     MN_MODULE_MODE           = 0x00000010,
1341     MN_UNCONDITIONAL_MODE    = 0x00000020,
1342     MN_TRUSTED_MODE          = -1
1343   };
1344 
1345   // Accessors for code generation:
1346   static int clazz_offset()   { CHECK_INIT(_clazz_offset); }
1347   static int type_offset()    { CHECK_INIT(_type_offset); }
1348   static int flags_offset()   { CHECK_INIT(_flags_offset); }
1349   static int method_offset()  { CHECK_INIT(_method_offset); }

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

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