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



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





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

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_REFERENCE_KIND_SHIFT  = 24, // refKind
1295     MN_REFERENCE_KIND_MASK   = 0x0F000000 >> MN_REFERENCE_KIND_SHIFT,
1296     // The SEARCH_* bits are not for MN.flags but for the matchFlags argument of MHN.getMembers:
1297     MN_SEARCH_SUPERCLASSES   = 0x00100000, // walk super classes
1298     MN_SEARCH_INTERFACES     = 0x00200000, // walk implemented interfaces
1299     MN_NESTMATE_CLASS        = 0x00000001,
1300     MN_HIDDEN_CLASS          = 0x00000002,
1301     MN_STRONG_LOADER_LINK    = 0x00000004,
1302     MN_ACCESS_VM_ANNOTATIONS = 0x00000008,
1303     // Lookup modes
1304     MN_MODULE_MODE           = 0x00000010,
1305     MN_UNCONDITIONAL_MODE    = 0x00000020,
1306     MN_TRUSTED_MODE          = -1
1307   };
1308 
1309   // Accessors for code generation:
1310   static int clazz_offset()   { CHECK_INIT(_clazz_offset); }
1311   static int type_offset()    { CHECK_INIT(_type_offset); }
1312   static int flags_offset()   { CHECK_INIT(_flags_offset); }
1313   static int method_offset()  { CHECK_INIT(_method_offset); }

1813 class java_lang_Short_ShortCache : AllStatic {
1814  private:
1815   static int _static_cache_offset;
1816  public:
1817   static Symbol* symbol();
1818   static void compute_offsets(InstanceKlass* k);
1819   static objArrayOop  cache(InstanceKlass *k);
1820   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1821 };
1822 
1823 class java_lang_Byte_ByteCache : AllStatic {
1824  private:
1825   static int _static_cache_offset;
1826  public:
1827   static Symbol* symbol();
1828   static void compute_offsets(InstanceKlass* k);
1829   static objArrayOop  cache(InstanceKlass *k);
1830   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1831 };
1832 
1833 
1834 // Interface to java.lang.InternalError objects
1835 
1836 #define INTERNALERROR_INJECTED_FIELDS(macro)                      \
1837   macro(java_lang_InternalError, during_unsafe_access, bool_signature, false)
1838 
1839 class java_lang_InternalError : AllStatic {
1840  private:
1841   static int _during_unsafe_access_offset;
1842  public:
1843   static jboolean during_unsafe_access(oop internal_error);
1844   static void set_during_unsafe_access(oop internal_error);
1845   static void compute_offsets();
1846   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1847 };
1848 
1849 // Use to declare fields that need to be injected into Java classes
1850 // for the JVM to use.  The name_index and signature_index are
1851 // declared in vmSymbols.  The may_be_java flag is used to declare
1852 // fields that might already exist in Java but should be injected if
1853 // 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 
 264   // Archiving
 265   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
 266   static void archive_basic_type_mirrors() NOT_CDS_JAVA_HEAP_RETURN;
 267   static oop  archive_mirror(Klass* k) NOT_CDS_JAVA_HEAP_RETURN_(NULL);
 268   static oop  process_archived_mirror(Klass* k, oop mirror, oop archived_mirror)
 269                                       NOT_CDS_JAVA_HEAP_RETURN_(NULL);
 270   static bool restore_archived_mirror(Klass *k, Handle class_loader, Handle module,
 271                                       Handle protection_domain,
 272                                       TRAPS) NOT_CDS_JAVA_HEAP_RETURN_(false);
 273 
 274   static void fixup_module_field(Klass* k, Handle module);
 275 
 276   // Conversion
 277   static Klass* as_Klass(oop java_class);
 278   static void set_klass(oop java_class, Klass* klass);
 279   static BasicType as_BasicType(oop java_class, Klass** reference_klass = NULL);
 280   static Symbol* as_signature(oop java_class, bool intern_if_not_found);
 281   static void print_signature(oop java_class, outputStream *st);
 282   static const char* as_external_name(oop java_class);
 283   // Testing
 284   static bool is_instance(oop obj);
 285 
 286   static bool is_primitive(oop java_class);
 287   static BasicType primitive_type(oop java_class);
 288   static oop primitive_mirror(BasicType t);
 289   // JVM_NewArray support
 290   static Klass* array_klass_acquire(oop java_class);
 291   static void release_set_array_klass(oop java_class, Klass* klass);
 292   // compiler support for class operations
 293   static int klass_offset()                { CHECK_INIT(_klass_offset); }
 294   static int array_klass_offset()          { CHECK_INIT(_array_klass_offset); }
 295   static int component_mirror_offset()     { CHECK_INIT(_component_mirror_offset); }
 296   static int primary_mirror_offset()       { CHECK_INIT(_primary_mirror_offset); }
 297   static int secondary_mirror_offset()     { CHECK_INIT(_secondary_mirror_offset); }
 298   // Support for classRedefinedCount field
 299   static int classRedefinedCount(oop the_class_mirror);
 300   static void set_classRedefinedCount(oop the_class_mirror, int value);
 301 
 302   // Support for embedded per-class oops
 303   static oop  protection_domain(oop java_class);
 304   static oop  component_mirror(oop java_class);
 305   static oop  primary_mirror(oop java_class);
 306   static oop  secondary_mirror(oop java_class);
 307   static bool is_primary_mirror(oop java_class);
 308   static bool is_secondary_mirror(oop java_class);
 309 
 310   static objArrayOop  signers(oop java_class);
 311   static void set_signers(oop java_class, objArrayOop signers);
 312   static oop  class_data(oop java_class);
 313   static void set_class_data(oop java_class, oop classData);
 314 


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

1282   static void       set_flags(oop mname, int flags);
1283 
1284   // Link through ResolvedMethodName field to get Method*
1285   static Method*        vmtarget(oop mname);
1286   static void       set_method(oop mname, oop method);
1287 
1288   static intptr_t       vmindex(oop mname);
1289   static void       set_vmindex(oop mname, intptr_t index);
1290 
1291   // Testers
1292   static bool is_subclass(Klass* klass) {
1293     return klass->is_subclass_of(vmClasses::MemberName_klass());
1294   }
1295   static bool is_instance(oop obj);
1296 
1297   static bool is_method(oop obj);
1298 
1299   // Relevant integer codes (keep these in synch. with MethodHandleNatives.Constants):
1300   enum {
1301     MN_IS_METHOD             = 0x00010000, // method (not constructor)
1302     MN_IS_OBJECT_CONSTRUCTOR = 0x00020000, // constructor
1303     MN_IS_FIELD              = 0x00040000, // field
1304     MN_IS_TYPE               = 0x00080000, // nested type
1305     MN_CALLER_SENSITIVE      = 0x00100000, // @CallerSensitive annotation detected
1306     MN_TRUSTED_FINAL         = 0x00200000, // trusted final field
1307     MN_FLATTENED             = 0x00400000, // flattened field
1308     MN_REFERENCE_KIND_SHIFT  = 24, // refKind
1309     MN_REFERENCE_KIND_MASK   = 0x0F000000 >> MN_REFERENCE_KIND_SHIFT,
1310     // The SEARCH_* bits are not for MN.flags but for the matchFlags argument of MHN.getMembers:
1311     MN_SEARCH_SUPERCLASSES   = 0x00100000, // walk super classes
1312     MN_SEARCH_INTERFACES     = 0x00200000, // walk implemented interfaces
1313     MN_NESTMATE_CLASS        = 0x00000001,
1314     MN_HIDDEN_CLASS          = 0x00000002,
1315     MN_STRONG_LOADER_LINK    = 0x00000004,
1316     MN_ACCESS_VM_ANNOTATIONS = 0x00000008,
1317     // Lookup modes
1318     MN_MODULE_MODE           = 0x00000010,
1319     MN_UNCONDITIONAL_MODE    = 0x00000020,
1320     MN_TRUSTED_MODE          = -1
1321   };
1322 
1323   // Accessors for code generation:
1324   static int clazz_offset()   { CHECK_INIT(_clazz_offset); }
1325   static int type_offset()    { CHECK_INIT(_type_offset); }
1326   static int flags_offset()   { CHECK_INIT(_flags_offset); }
1327   static int method_offset()  { CHECK_INIT(_method_offset); }

1827 class java_lang_Short_ShortCache : AllStatic {
1828  private:
1829   static int _static_cache_offset;
1830  public:
1831   static Symbol* symbol();
1832   static void compute_offsets(InstanceKlass* k);
1833   static objArrayOop  cache(InstanceKlass *k);
1834   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1835 };
1836 
1837 class java_lang_Byte_ByteCache : AllStatic {
1838  private:
1839   static int _static_cache_offset;
1840  public:
1841   static Symbol* symbol();
1842   static void compute_offsets(InstanceKlass* k);
1843   static objArrayOop  cache(InstanceKlass *k);
1844   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1845 };
1846 

1847 // Interface to java.lang.InternalError objects
1848 
1849 #define INTERNALERROR_INJECTED_FIELDS(macro)                      \
1850   macro(java_lang_InternalError, during_unsafe_access, bool_signature, false)
1851 
1852 class java_lang_InternalError : AllStatic {
1853  private:
1854   static int _during_unsafe_access_offset;
1855  public:
1856   static jboolean during_unsafe_access(oop internal_error);
1857   static void set_during_unsafe_access(oop internal_error);
1858   static void compute_offsets();
1859   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1860 };
1861 
1862 // Use to declare fields that need to be injected into Java classes
1863 // for the JVM to use.  The name_index and signature_index are
1864 // declared in vmSymbols.  The may_be_java flag is used to declare
1865 // fields that might already exist in Java but should be injected if
1866 // they don't.  Otherwise the field is unconditionally injected and
< prev index next >