< prev index next >

src/hotspot/share/classfile/javaClasses.hpp

Print this page

 261 class java_lang_Class : AllStatic {
 262   friend class VMStructs;
 263   friend class JVMCIVMStructs;
 264 
 265  private:
 266 
 267   // The fake offsets are added by the class loader when java.lang.Class is loaded
 268 
 269   static int _klass_offset;
 270   static int _array_klass_offset;
 271 
 272   static int _oop_size_offset;
 273   static int _static_oop_field_count_offset;
 274 
 275   static int _protection_domain_offset;
 276   static int _init_lock_offset;
 277   static int _signers_offset;
 278   static int _class_loader_offset;
 279   static int _module_offset;
 280   static int _component_mirror_offset;



 281   static int _name_offset;
 282   static int _source_file_offset;
 283   static int _classData_offset;
 284   static int _classRedefinedCount_offset;
 285 
 286   static bool _offsets_computed;
 287 
 288   static GrowableArray<Klass*>* _fixup_mirror_list;
 289   static GrowableArray<Klass*>* _fixup_module_field_list;
 290 
 291   static void set_init_lock(oop java_class, oop init_lock);
 292   static void set_protection_domain(oop java_class, oop protection_domain);
 293   static void set_class_loader(oop java_class, oop class_loader);
 294   static void set_component_mirror(oop java_class, oop comp_mirror);



 295   static void initialize_mirror_fields(Klass* k, Handle mirror, Handle protection_domain,
 296                                        Handle classData, TRAPS);
 297   static void set_mirror_module_field(JavaThread* current, Klass* K, Handle mirror, Handle module);
 298  public:
 299   static void allocate_fixup_lists();
 300   static void compute_offsets();
 301 
 302   // Instance creation
 303   static void create_mirror(Klass* k, Handle class_loader, Handle module,
 304                             Handle protection_domain, Handle classData, TRAPS);
 305   static void fixup_mirror(Klass* k, TRAPS);
 306   static oop  create_basic_type_mirror(const char* basic_type_name, BasicType type, TRAPS);

 307   static void update_archived_primitive_mirror_native_pointers(oop archived_mirror) NOT_CDS_JAVA_HEAP_RETURN;
 308   static void update_archived_mirror_native_pointers(oop archived_mirror) NOT_CDS_JAVA_HEAP_RETURN;
 309 
 310   // Archiving
 311   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
 312   static void archive_basic_type_mirrors() NOT_CDS_JAVA_HEAP_RETURN;
 313   static oop  archive_mirror(Klass* k) NOT_CDS_JAVA_HEAP_RETURN_(NULL);
 314   static oop  process_archived_mirror(Klass* k, oop mirror, oop archived_mirror)
 315                                       NOT_CDS_JAVA_HEAP_RETURN_(NULL);
 316   static bool restore_archived_mirror(Klass *k, Handle class_loader, Handle module,
 317                                       Handle protection_domain,
 318                                       TRAPS) NOT_CDS_JAVA_HEAP_RETURN_(false);
 319 
 320   static void fixup_module_field(Klass* k, Handle module);
 321 
 322   // Conversion
 323   static Klass* as_Klass(oop java_class);
 324   static void set_klass(oop java_class, Klass* klass);
 325   static BasicType as_BasicType(oop java_class, Klass** reference_klass = NULL);
 326   static Symbol* as_signature(oop java_class, bool intern_if_not_found);
 327   static void print_signature(oop java_class, outputStream *st);
 328   static const char* as_external_name(oop java_class);
 329   // Testing
 330   static bool is_instance(oop obj);
 331 
 332   static bool is_primitive(oop java_class);
 333   static BasicType primitive_type(oop java_class);
 334   static oop primitive_mirror(BasicType t);
 335   // JVM_NewArray support
 336   static Klass* array_klass_acquire(oop java_class);
 337   static void release_set_array_klass(oop java_class, Klass* klass);
 338   // compiler support for class operations
 339   static int klass_offset()                { CHECK_INIT(_klass_offset); }
 340   static int array_klass_offset()          { CHECK_INIT(_array_klass_offset); }



 341   // Support for classRedefinedCount field
 342   static int classRedefinedCount(oop the_class_mirror);
 343   static void set_classRedefinedCount(oop the_class_mirror, int value);
 344 
 345   // Support for embedded per-class oops
 346   static oop  protection_domain(oop java_class);
 347   static oop  init_lock(oop java_class);
 348   static void clear_init_lock(oop java_class) {
 349     set_init_lock(java_class, NULL);
 350   }
 351   static oop  component_mirror(oop java_class);





 352   static objArrayOop  signers(oop java_class);
 353   static void set_signers(oop java_class, objArrayOop signers);
 354   static oop  class_data(oop java_class);
 355   static void set_class_data(oop java_class, oop classData);
 356 
 357   static int component_mirror_offset() { return _component_mirror_offset; }
 358 
 359   static oop class_loader(oop java_class);
 360   static void set_module(oop java_class, oop module);
 361   static oop module(oop java_class);
 362 
 363   static oop name(Handle java_class, TRAPS);
 364 
 365   static oop source_file(oop java_class);
 366   static void set_source_file(oop java_class, oop source_file);
 367 
 368   static int oop_size(oop java_class);
 369   static void set_oop_size(HeapWord* java_class, int size);
 370   static int static_oop_field_count(oop java_class);
 371   static void set_static_oop_field_count(oop java_class, int size);
 372 
 373   static GrowableArray<Klass*>* fixup_mirror_list() {
 374     return _fixup_mirror_list;
 375   }
 376   static void set_fixup_mirror_list(GrowableArray<Klass*>* v) {
 377     _fixup_mirror_list = v;
 378   }

1149   static void       set_flags(oop mname, int flags);
1150 
1151   // Link through ResolvedMethodName field to get Method*
1152   static Method*        vmtarget(oop mname);
1153   static void       set_method(oop mname, oop method);
1154 
1155   static intptr_t       vmindex(oop mname);
1156   static void       set_vmindex(oop mname, intptr_t index);
1157 
1158   // Testers
1159   static bool is_subclass(Klass* klass) {
1160     return klass->is_subclass_of(vmClasses::MemberName_klass());
1161   }
1162   static bool is_instance(oop obj);
1163 
1164   static bool is_method(oop obj);
1165 
1166   // Relevant integer codes (keep these in synch. with MethodHandleNatives.Constants):
1167   enum {
1168     MN_IS_METHOD             = 0x00010000, // method (not constructor)
1169     MN_IS_CONSTRUCTOR        = 0x00020000, // constructor
1170     MN_IS_FIELD              = 0x00040000, // field
1171     MN_IS_TYPE               = 0x00080000, // nested type
1172     MN_CALLER_SENSITIVE      = 0x00100000, // @CallerSensitive annotation detected
1173     MN_TRUSTED_FINAL         = 0x00200000, // trusted final field
1174     MN_REFERENCE_KIND_SHIFT  = 24, // refKind
1175     MN_REFERENCE_KIND_MASK   = 0x0F000000 >> MN_REFERENCE_KIND_SHIFT,
1176     // The SEARCH_* bits are not for MN.flags but for the matchFlags argument of MHN.getMembers:
1177     MN_SEARCH_SUPERCLASSES   = 0x00100000, // walk super classes
1178     MN_SEARCH_INTERFACES     = 0x00200000, // walk implemented interfaces
1179     MN_NESTMATE_CLASS        = 0x00000001,
1180     MN_HIDDEN_CLASS          = 0x00000002,
1181     MN_STRONG_LOADER_LINK    = 0x00000004,
1182     MN_ACCESS_VM_ANNOTATIONS = 0x00000008,
1183     // Lookup modes
1184     MN_MODULE_MODE           = 0x00000010,
1185     MN_UNCONDITIONAL_MODE    = 0x00000020,
1186     MN_TRUSTED_MODE          = -1
1187   };
1188 
1189   // Accessors for code generation:

1690 class java_lang_Short_ShortCache : AllStatic {
1691  private:
1692   static int _static_cache_offset;
1693  public:
1694   static Symbol* symbol();
1695   static void compute_offsets(InstanceKlass* k);
1696   static objArrayOop  cache(InstanceKlass *k);
1697   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1698 };
1699 
1700 class java_lang_Byte_ByteCache : AllStatic {
1701  private:
1702   static int _static_cache_offset;
1703  public:
1704   static Symbol* symbol();
1705   static void compute_offsets(InstanceKlass* k);
1706   static objArrayOop  cache(InstanceKlass *k);
1707   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1708 };
1709 
1710 
1711 // Interface to java.lang.InternalError objects
1712 
1713 #define INTERNALERROR_INJECTED_FIELDS(macro)                      \
1714   macro(java_lang_InternalError, during_unsafe_access, bool_signature, false)
1715 
1716 class java_lang_InternalError : AllStatic {
1717  private:
1718   static int _during_unsafe_access_offset;
1719  public:
1720   static jboolean during_unsafe_access(oop internal_error);
1721   static void set_during_unsafe_access(oop internal_error);
1722   static void compute_offsets();
1723   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1724 };
1725 
1726 // Use to declare fields that need to be injected into Java classes
1727 // for the JVM to use.  The name_index and signature_index are
1728 // declared in vmSymbols.  The may_be_java flag is used to declare
1729 // fields that might already exist in Java but should be injected if
1730 // they don't.  Otherwise the field is unconditionally injected and

 261 class java_lang_Class : AllStatic {
 262   friend class VMStructs;
 263   friend class JVMCIVMStructs;
 264 
 265  private:
 266 
 267   // The fake offsets are added by the class loader when java.lang.Class is loaded
 268 
 269   static int _klass_offset;
 270   static int _array_klass_offset;
 271 
 272   static int _oop_size_offset;
 273   static int _static_oop_field_count_offset;
 274 
 275   static int _protection_domain_offset;
 276   static int _init_lock_offset;
 277   static int _signers_offset;
 278   static int _class_loader_offset;
 279   static int _module_offset;
 280   static int _component_mirror_offset;
 281   static int _primary_mirror_offset;
 282   static int _secondary_mirror_offset;
 283 
 284   static int _name_offset;
 285   static int _source_file_offset;
 286   static int _classData_offset;
 287   static int _classRedefinedCount_offset;
 288 
 289   static bool _offsets_computed;
 290 
 291   static GrowableArray<Klass*>* _fixup_mirror_list;
 292   static GrowableArray<Klass*>* _fixup_module_field_list;
 293 
 294   static void set_init_lock(oop java_class, oop init_lock);
 295   static void set_protection_domain(oop java_class, oop protection_domain);
 296   static void set_class_loader(oop java_class, oop class_loader);
 297   static void set_component_mirror(oop java_class, oop comp_mirror);
 298   static void set_primary_mirror(oop java_class, oop comp_mirror);
 299   static void set_secondary_mirror(oop java_class, oop comp_mirror);
 300 
 301   static void initialize_mirror_fields(Klass* k, Handle mirror, Handle protection_domain,
 302                                        Handle classData, TRAPS);
 303   static void set_mirror_module_field(JavaThread* current, Klass* K, Handle mirror, Handle module);
 304  public:
 305   static void allocate_fixup_lists();
 306   static void compute_offsets();
 307 
 308   // Instance creation
 309   static void create_mirror(Klass* k, Handle class_loader, Handle module,
 310                             Handle protection_domain, Handle classData, TRAPS);
 311   static void fixup_mirror(Klass* k, TRAPS);
 312   static oop  create_basic_type_mirror(const char* basic_type_name, BasicType type, TRAPS);
 313   static oop  create_secondary_mirror(Klass* k, Handle mirror, TRAPS);
 314   static void update_archived_primitive_mirror_native_pointers(oop archived_mirror) NOT_CDS_JAVA_HEAP_RETURN;
 315   static void update_archived_mirror_native_pointers(oop archived_mirror) NOT_CDS_JAVA_HEAP_RETURN;
 316 
 317   // Archiving
 318   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
 319   static void archive_basic_type_mirrors() NOT_CDS_JAVA_HEAP_RETURN;
 320   static oop  archive_mirror(Klass* k) NOT_CDS_JAVA_HEAP_RETURN_(NULL);
 321   static oop  process_archived_mirror(Klass* k, oop mirror, oop archived_mirror)
 322                                       NOT_CDS_JAVA_HEAP_RETURN_(NULL);
 323   static bool restore_archived_mirror(Klass *k, Handle class_loader, Handle module,
 324                                       Handle protection_domain,
 325                                       TRAPS) NOT_CDS_JAVA_HEAP_RETURN_(false);
 326 
 327   static void fixup_module_field(Klass* k, Handle module);
 328 
 329   // Conversion
 330   static Klass* as_Klass(oop java_class);
 331   static void set_klass(oop java_class, Klass* klass);
 332   static BasicType as_BasicType(oop java_class, Klass** reference_klass = NULL);
 333   static Symbol* as_signature(oop java_class, bool intern_if_not_found);
 334   static void print_signature(oop java_class, outputStream *st);
 335   static const char* as_external_name(oop java_class);
 336   // Testing
 337   static bool is_instance(oop obj);
 338 
 339   static bool is_primitive(oop java_class);
 340   static BasicType primitive_type(oop java_class);
 341   static oop primitive_mirror(BasicType t);
 342   // JVM_NewArray support
 343   static Klass* array_klass_acquire(oop java_class);
 344   static void release_set_array_klass(oop java_class, Klass* klass);
 345   // compiler support for class operations
 346   static int klass_offset()                { CHECK_INIT(_klass_offset); }
 347   static int array_klass_offset()          { CHECK_INIT(_array_klass_offset); }
 348   static int component_mirror_offset()     { CHECK_INIT(_component_mirror_offset); }
 349   static int primary_mirror_offset()       { CHECK_INIT(_primary_mirror_offset); }
 350   static int secondary_mirror_offset()     { CHECK_INIT(_secondary_mirror_offset); }
 351   // Support for classRedefinedCount field
 352   static int classRedefinedCount(oop the_class_mirror);
 353   static void set_classRedefinedCount(oop the_class_mirror, int value);
 354 
 355   // Support for embedded per-class oops
 356   static oop  protection_domain(oop java_class);
 357   static oop  init_lock(oop java_class);
 358   static void clear_init_lock(oop java_class) {
 359     set_init_lock(java_class, NULL);
 360   }
 361   static oop  component_mirror(oop java_class);
 362   static oop  primary_mirror(oop java_class);
 363   static oop  secondary_mirror(oop java_class);
 364   static bool is_primary_mirror(oop java_class);
 365   static bool is_secondary_mirror(oop java_class);
 366 
 367   static objArrayOop  signers(oop java_class);
 368   static void set_signers(oop java_class, objArrayOop signers);
 369   static oop  class_data(oop java_class);
 370   static void set_class_data(oop java_class, oop classData);
 371 


 372   static oop class_loader(oop java_class);
 373   static void set_module(oop java_class, oop module);
 374   static oop module(oop java_class);
 375 
 376   static oop name(Handle java_class, TRAPS);
 377 
 378   static oop source_file(oop java_class);
 379   static void set_source_file(oop java_class, oop source_file);
 380 
 381   static int oop_size(oop java_class);
 382   static void set_oop_size(HeapWord* java_class, int size);
 383   static int static_oop_field_count(oop java_class);
 384   static void set_static_oop_field_count(oop java_class, int size);
 385 
 386   static GrowableArray<Klass*>* fixup_mirror_list() {
 387     return _fixup_mirror_list;
 388   }
 389   static void set_fixup_mirror_list(GrowableArray<Klass*>* v) {
 390     _fixup_mirror_list = v;
 391   }

1162   static void       set_flags(oop mname, int flags);
1163 
1164   // Link through ResolvedMethodName field to get Method*
1165   static Method*        vmtarget(oop mname);
1166   static void       set_method(oop mname, oop method);
1167 
1168   static intptr_t       vmindex(oop mname);
1169   static void       set_vmindex(oop mname, intptr_t index);
1170 
1171   // Testers
1172   static bool is_subclass(Klass* klass) {
1173     return klass->is_subclass_of(vmClasses::MemberName_klass());
1174   }
1175   static bool is_instance(oop obj);
1176 
1177   static bool is_method(oop obj);
1178 
1179   // Relevant integer codes (keep these in synch. with MethodHandleNatives.Constants):
1180   enum {
1181     MN_IS_METHOD             = 0x00010000, // method (not constructor)
1182     MN_IS_OBJECT_CONSTRUCTOR = 0x00020000, // constructor
1183     MN_IS_FIELD              = 0x00040000, // field
1184     MN_IS_TYPE               = 0x00080000, // nested type
1185     MN_CALLER_SENSITIVE      = 0x00100000, // @CallerSensitive annotation detected
1186     MN_TRUSTED_FINAL         = 0x00200000, // trusted final field
1187     MN_REFERENCE_KIND_SHIFT  = 24, // refKind
1188     MN_REFERENCE_KIND_MASK   = 0x0F000000 >> MN_REFERENCE_KIND_SHIFT,
1189     // The SEARCH_* bits are not for MN.flags but for the matchFlags argument of MHN.getMembers:
1190     MN_SEARCH_SUPERCLASSES   = 0x00100000, // walk super classes
1191     MN_SEARCH_INTERFACES     = 0x00200000, // walk implemented interfaces
1192     MN_NESTMATE_CLASS        = 0x00000001,
1193     MN_HIDDEN_CLASS          = 0x00000002,
1194     MN_STRONG_LOADER_LINK    = 0x00000004,
1195     MN_ACCESS_VM_ANNOTATIONS = 0x00000008,
1196     // Lookup modes
1197     MN_MODULE_MODE           = 0x00000010,
1198     MN_UNCONDITIONAL_MODE    = 0x00000020,
1199     MN_TRUSTED_MODE          = -1
1200   };
1201 
1202   // Accessors for code generation:

1703 class java_lang_Short_ShortCache : AllStatic {
1704  private:
1705   static int _static_cache_offset;
1706  public:
1707   static Symbol* symbol();
1708   static void compute_offsets(InstanceKlass* k);
1709   static objArrayOop  cache(InstanceKlass *k);
1710   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1711 };
1712 
1713 class java_lang_Byte_ByteCache : AllStatic {
1714  private:
1715   static int _static_cache_offset;
1716  public:
1717   static Symbol* symbol();
1718   static void compute_offsets(InstanceKlass* k);
1719   static objArrayOop  cache(InstanceKlass *k);
1720   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1721 };
1722 

1723 // Interface to java.lang.InternalError objects
1724 
1725 #define INTERNALERROR_INJECTED_FIELDS(macro)                      \
1726   macro(java_lang_InternalError, during_unsafe_access, bool_signature, false)
1727 
1728 class java_lang_InternalError : AllStatic {
1729  private:
1730   static int _during_unsafe_access_offset;
1731  public:
1732   static jboolean during_unsafe_access(oop internal_error);
1733   static void set_during_unsafe_access(oop internal_error);
1734   static void compute_offsets();
1735   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1736 };
1737 
1738 // Use to declare fields that need to be injected into Java classes
1739 // for the JVM to use.  The name_index and signature_index are
1740 // declared in vmSymbols.  The may_be_java flag is used to declare
1741 // fields that might already exist in Java but should be injected if
1742 // they don't.  Otherwise the field is unconditionally injected and
< prev index next >