< prev index next >

src/hotspot/share/classfile/javaClasses.hpp

Print this page




 234   friend class VMStructs;
 235   friend class JVMCIVMStructs;
 236 
 237  private:
 238   // The fake offsets are added by the class loader when java.lang.Class is loaded
 239 
 240   static int _klass_offset;
 241   static int _array_klass_offset;
 242 
 243   static int _oop_size_offset;
 244   static int _static_oop_field_count_offset;
 245 
 246   static int _protection_domain_offset;
 247   static int _init_lock_offset;
 248   static int _signers_offset;
 249   static int _class_loader_offset;
 250   static int _module_offset;
 251   static int _component_mirror_offset;
 252   static int _name_offset;
 253   static int _source_file_offset;


 254 
 255   static bool offsets_computed;
 256   static int classRedefinedCount_offset;
 257 
 258   static GrowableArray<Klass*>* _fixup_mirror_list;
 259   static GrowableArray<Klass*>* _fixup_module_field_list;
 260 
 261   static void set_init_lock(oop java_class, oop init_lock);
 262   static void set_protection_domain(oop java_class, oop protection_domain);
 263   static void set_class_loader(oop java_class, oop class_loader);
 264   static void set_component_mirror(oop java_class, oop comp_mirror);
 265   static void initialize_mirror_fields(Klass* k, Handle mirror, Handle protection_domain, TRAPS);
 266   static void set_mirror_module_field(Klass* K, Handle mirror, Handle module, TRAPS);
 267  public:
 268   static void allocate_fixup_lists();
 269   static void compute_offsets();
 270 
 271   // Instance creation
 272   static void create_mirror(Klass* k, Handle class_loader, Handle module,
 273                             Handle protection_domain, TRAPS);
 274   static void fixup_mirror(Klass* k, TRAPS);
 275   static oop  create_basic_type_mirror(const char* basic_type_name, BasicType type, TRAPS);

 276 
 277   // Archiving
 278   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
 279   static void archive_basic_type_mirrors(TRAPS) NOT_CDS_JAVA_HEAP_RETURN;
 280   static oop  archive_mirror(Klass* k, TRAPS) NOT_CDS_JAVA_HEAP_RETURN_(NULL);
 281   static oop  process_archived_mirror(Klass* k, oop mirror, oop archived_mirror, Thread *THREAD)
 282                                       NOT_CDS_JAVA_HEAP_RETURN_(NULL);
 283   static bool restore_archived_mirror(Klass *k, Handle class_loader, Handle module,
 284                                       Handle protection_domain,
 285                                       TRAPS) NOT_CDS_JAVA_HEAP_RETURN_(false);
 286 
 287   static void fixup_module_field(Klass* k, Handle module);
 288 
 289   // Conversion
 290   static Klass* as_Klass(oop java_class);
 291   static Klass* as_Klass_raw(oop java_class);
 292   static void set_klass(oop java_class, Klass* klass);
 293   static BasicType as_BasicType(oop java_class, Klass** reference_klass = NULL);
 294   static Symbol* as_signature(oop java_class, bool intern_if_not_found);
 295   static void print_signature(oop java_class, outputStream *st);
 296   static const char* as_external_name(oop java_class);
 297   // Testing
 298   static bool is_instance(oop obj);
 299 
 300   static bool is_primitive(oop java_class);
 301   static BasicType primitive_type(oop java_class);
 302   static oop primitive_mirror(BasicType t);
 303   // JVM_NewArray support
 304   static Klass* array_klass_acquire(oop java_class);
 305   static void release_set_array_klass(oop java_class, Klass* klass);
 306   // compiler support for class operations
 307   static int klass_offset_in_bytes()                { return _klass_offset; }
 308   static int array_klass_offset_in_bytes()          { return _array_klass_offset; }


 309   // Support for classRedefinedCount field
 310   static int classRedefinedCount(oop the_class_mirror);
 311   static void set_classRedefinedCount(oop the_class_mirror, int value);
 312 
 313   // Support for embedded per-class oops
 314   static oop  protection_domain(oop java_class);
 315   static oop  init_lock(oop java_class);
 316   static oop  component_mirror(oop java_class);
 317   static objArrayOop  signers(oop java_class);
 318   static void set_signers(oop java_class, objArrayOop signers);
 319 
 320   static oop class_loader(oop java_class);
 321   static void set_module(oop java_class, oop module);
 322   static oop module(oop java_class);
 323 









 324   static oop name(Handle java_class, TRAPS);
 325 
 326   static oop source_file(oop java_class);
 327   static void set_source_file(oop java_class, oop source_file);
 328 
 329   static int oop_size(oop java_class);
 330   static int oop_size_raw(oop java_class);
 331   static void set_oop_size(HeapWord* java_class, int size);
 332   static int static_oop_field_count(oop java_class);
 333   static int static_oop_field_count_raw(oop java_class);
 334   static void set_static_oop_field_count(oop java_class, int size);
 335 
 336   static GrowableArray<Klass*>* fixup_mirror_list() {
 337     return _fixup_mirror_list;
 338   }
 339   static void set_fixup_mirror_list(GrowableArray<Klass*>* v) {
 340     _fixup_mirror_list = v;
 341   }
 342 
 343   static GrowableArray<Klass*>* fixup_module_field_list() {


1104   static int            flags(oop mname);
1105   static void       set_flags(oop mname, int flags);
1106 
1107   // Link through ResolvedMethodName field to get Method*
1108   static Method*        vmtarget(oop mname);
1109   static void       set_method(oop mname, oop method);
1110 
1111   static intptr_t       vmindex(oop mname);
1112   static void       set_vmindex(oop mname, intptr_t index);
1113 
1114   // Testers
1115   static bool is_subclass(Klass* klass) {
1116     return klass->is_subclass_of(SystemDictionary::MemberName_klass());
1117   }
1118   static bool is_instance(oop obj);
1119 
1120   static bool is_method(oop obj);
1121 
1122   // Relevant integer codes (keep these in synch. with MethodHandleNatives.Constants):
1123   enum {
1124     MN_IS_METHOD            = 0x00010000, // method (not constructor)
1125     MN_IS_CONSTRUCTOR       = 0x00020000, // constructor
1126     MN_IS_FIELD             = 0x00040000, // field
1127     MN_IS_TYPE              = 0x00080000, // nested type
1128     MN_CALLER_SENSITIVE     = 0x00100000, // @CallerSensitive annotation detected
1129     MN_REFERENCE_KIND_SHIFT = 24, // refKind
1130     MN_REFERENCE_KIND_MASK  = 0x0F000000 >> MN_REFERENCE_KIND_SHIFT,
1131     // The SEARCH_* bits are not for MN.flags but for the matchFlags argument of MHN.getMembers:
1132     MN_SEARCH_SUPERCLASSES  = 0x00100000, // walk super classes
1133     MN_SEARCH_INTERFACES    = 0x00200000  // walk implemented interfaces
1134   };
1135 
1136   // Accessors for code generation:
1137   static int clazz_offset_in_bytes()            { return _clazz_offset; }
1138   static int type_offset_in_bytes()             { return _type_offset; }
1139   static int name_offset_in_bytes()             { return _name_offset; }
1140   static int flags_offset_in_bytes()            { return _flags_offset; }
1141   static int method_offset_in_bytes()           { return _method_offset; }
1142   static int vmindex_offset_in_bytes()          { return _vmindex_offset; }
1143 };
1144 
1145 
1146 // Interface to java.lang.invoke.MethodType objects
1147 
1148 class java_lang_invoke_MethodType: AllStatic {
1149   friend class JavaClasses;
1150 
1151  private:
1152   static int _rtype_offset;
1153   static int _ptypes_offset;




 234   friend class VMStructs;
 235   friend class JVMCIVMStructs;
 236 
 237  private:
 238   // The fake offsets are added by the class loader when java.lang.Class is loaded
 239 
 240   static int _klass_offset;
 241   static int _array_klass_offset;
 242 
 243   static int _oop_size_offset;
 244   static int _static_oop_field_count_offset;
 245 
 246   static int _protection_domain_offset;
 247   static int _init_lock_offset;
 248   static int _signers_offset;
 249   static int _class_loader_offset;
 250   static int _module_offset;
 251   static int _component_mirror_offset;
 252   static int _name_offset;
 253   static int _source_file_offset;
 254   static int _inline_mirror_offset;
 255   static int _indirect_mirror_offset;
 256 
 257   static bool offsets_computed;
 258   static int classRedefinedCount_offset;
 259 
 260   static GrowableArray<Klass*>* _fixup_mirror_list;
 261   static GrowableArray<Klass*>* _fixup_module_field_list;
 262 
 263   static void set_init_lock(oop java_class, oop init_lock);
 264   static void set_protection_domain(oop java_class, oop protection_domain);
 265   static void set_class_loader(oop java_class, oop class_loader);
 266   static void set_component_mirror(oop java_class, oop comp_mirror);
 267   static void initialize_mirror_fields(Klass* k, Handle mirror, Handle protection_domain, TRAPS);
 268   static void set_mirror_module_field(Klass* K, Handle mirror, Handle module, TRAPS);
 269  public:
 270   static void allocate_fixup_lists();
 271   static void compute_offsets();
 272 
 273   // Instance creation
 274   static void create_mirror(Klass* k, Handle class_loader, Handle module,
 275                             Handle protection_domain, TRAPS);
 276   static void fixup_mirror(Klass* k, TRAPS);
 277   static oop  create_basic_type_mirror(const char* basic_type_name, BasicType type, TRAPS);
 278   static oop  create_indirect_type_mirror(Klass* k, Handle mirror, TRAPS);
 279 
 280   // Archiving
 281   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
 282   static void archive_basic_type_mirrors(TRAPS) NOT_CDS_JAVA_HEAP_RETURN;
 283   static oop  archive_mirror(Klass* k, TRAPS) NOT_CDS_JAVA_HEAP_RETURN_(NULL);
 284   static oop  process_archived_mirror(Klass* k, oop mirror, oop archived_mirror, Thread *THREAD)
 285                                       NOT_CDS_JAVA_HEAP_RETURN_(NULL);
 286   static bool restore_archived_mirror(Klass *k, Handle class_loader, Handle module,
 287                                       Handle protection_domain,
 288                                       TRAPS) NOT_CDS_JAVA_HEAP_RETURN_(false);
 289 
 290   static void fixup_module_field(Klass* k, Handle module);
 291 
 292   // Conversion
 293   static Klass* as_Klass(oop java_class);
 294   static Klass* as_Klass_raw(oop java_class);
 295   static void set_klass(oop java_class, Klass* klass);
 296   static BasicType as_BasicType(oop java_class, Klass** reference_klass = NULL);
 297   static Symbol* as_signature(oop java_class, bool intern_if_not_found);
 298   static void print_signature(oop java_class, outputStream *st);
 299   static const char* as_external_name(oop java_class);
 300   // Testing
 301   static bool is_instance(oop obj);
 302 
 303   static bool is_primitive(oop java_class);
 304   static BasicType primitive_type(oop java_class);
 305   static oop primitive_mirror(BasicType t);
 306   // JVM_NewArray support
 307   static Klass* array_klass_acquire(oop java_class);
 308   static void release_set_array_klass(oop java_class, Klass* klass);
 309   // compiler support for class operations
 310   static int klass_offset_in_bytes()                { return _klass_offset; }
 311   static int array_klass_offset_in_bytes()          { return _array_klass_offset; }
 312   static int inline_mirror_offset_in_bytes()        { return _inline_mirror_offset; }
 313   static int component_mirror_offset_in_bytes()     { return _component_mirror_offset; }
 314   // Support for classRedefinedCount field
 315   static int classRedefinedCount(oop the_class_mirror);
 316   static void set_classRedefinedCount(oop the_class_mirror, int value);
 317 
 318   // Support for embedded per-class oops
 319   static oop  protection_domain(oop java_class);
 320   static oop  init_lock(oop java_class);
 321   static oop  component_mirror(oop java_class);
 322   static objArrayOop  signers(oop java_class);
 323   static void set_signers(oop java_class, objArrayOop signers);
 324 
 325   static oop class_loader(oop java_class);
 326   static void set_module(oop java_class, oop module);
 327   static oop module(oop java_class);
 328 
 329   static void set_indirect_type_mirror(oop java_class, oop mirror);
 330   static oop indirect_type_mirror(oop java_class);
 331   static bool is_indirect_type(oop java_class) { // Must match "Class.isIndirectType()"
 332     return indirect_type_mirror(java_class) == NULL || oopDesc::equals(indirect_type_mirror(java_class), java_class);
 333   }
 334 
 335   static void set_inline_type_mirror(oop java_class, oop mirror);
 336   static oop inline_type_mirror(oop java_class);
 337 
 338   static oop name(Handle java_class, TRAPS);
 339 
 340   static oop source_file(oop java_class);
 341   static void set_source_file(oop java_class, oop source_file);
 342 
 343   static int oop_size(oop java_class);
 344   static int oop_size_raw(oop java_class);
 345   static void set_oop_size(HeapWord* java_class, int size);
 346   static int static_oop_field_count(oop java_class);
 347   static int static_oop_field_count_raw(oop java_class);
 348   static void set_static_oop_field_count(oop java_class, int size);
 349 
 350   static GrowableArray<Klass*>* fixup_mirror_list() {
 351     return _fixup_mirror_list;
 352   }
 353   static void set_fixup_mirror_list(GrowableArray<Klass*>* v) {
 354     _fixup_mirror_list = v;
 355   }
 356 
 357   static GrowableArray<Klass*>* fixup_module_field_list() {


1118   static int            flags(oop mname);
1119   static void       set_flags(oop mname, int flags);
1120 
1121   // Link through ResolvedMethodName field to get Method*
1122   static Method*        vmtarget(oop mname);
1123   static void       set_method(oop mname, oop method);
1124 
1125   static intptr_t       vmindex(oop mname);
1126   static void       set_vmindex(oop mname, intptr_t index);
1127 
1128   // Testers
1129   static bool is_subclass(Klass* klass) {
1130     return klass->is_subclass_of(SystemDictionary::MemberName_klass());
1131   }
1132   static bool is_instance(oop obj);
1133 
1134   static bool is_method(oop obj);
1135 
1136   // Relevant integer codes (keep these in synch. with MethodHandleNatives.Constants):
1137   enum {
1138     MN_IS_METHOD             = 0x00010000, // method (not object constructor)
1139     MN_IS_OBJECT_CONSTRUCTOR = 0x00020000, // object constructor
1140     MN_IS_FIELD              = 0x00040000, // field
1141     MN_IS_TYPE               = 0x00080000, // nested type
1142     MN_CALLER_SENSITIVE      = 0x00100000, // @CallerSensitive annotation detected
1143     MN_REFERENCE_KIND_SHIFT  = 24, // refKind
1144     MN_REFERENCE_KIND_MASK   = 0x0F000000 >> MN_REFERENCE_KIND_SHIFT,
1145     // The SEARCH_* bits are not for MN.flags but for the matchFlags argument of MHN.getMembers:
1146     MN_SEARCH_SUPERCLASSES   = 0x00100000, // walk super classes
1147     MN_SEARCH_INTERFACES     = 0x00200000  // walk implemented interfaces
1148   };
1149 
1150   // Accessors for code generation:
1151   static int clazz_offset_in_bytes()            { return _clazz_offset; }
1152   static int type_offset_in_bytes()             { return _type_offset; }
1153   static int name_offset_in_bytes()             { return _name_offset; }
1154   static int flags_offset_in_bytes()            { return _flags_offset; }
1155   static int method_offset_in_bytes()           { return _method_offset; }
1156   static int vmindex_offset_in_bytes()          { return _vmindex_offset; }
1157 };
1158 
1159 
1160 // Interface to java.lang.invoke.MethodType objects
1161 
1162 class java_lang_invoke_MethodType: AllStatic {
1163   friend class JavaClasses;
1164 
1165  private:
1166   static int _rtype_offset;
1167   static int _ptypes_offset;


< prev index next >