< prev index next >

src/hotspot/share/classfile/javaClasses.hpp

Print this page




 212   static bool is_instance(oop obj);
 213   static inline bool is_instance_inlined(oop obj);
 214 
 215   // Debugging
 216   static void print(oop java_string, outputStream* st);
 217   friend class JavaClasses;
 218   friend class StringTable;
 219 };
 220 
 221 
 222 // Interface to java.lang.Class objects
 223 
 224 #define CLASS_INJECTED_FIELDS(macro)                                       \
 225   macro(java_lang_Class, klass,                  intptr_signature,  false) \
 226   macro(java_lang_Class, array_klass,            intptr_signature,  false) \
 227   macro(java_lang_Class, oop_size,               int_signature,     false) \
 228   macro(java_lang_Class, static_oop_field_count, int_signature,     false) \
 229   macro(java_lang_Class, protection_domain,      object_signature,  false) \
 230   macro(java_lang_Class, signers,                object_signature,  false) \
 231   macro(java_lang_Class, source_file,            object_signature,  false) \

 232 
 233 class java_lang_Class : AllStatic {
 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);


 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   }


1109   static int            flags(oop mname);
1110   static void       set_flags(oop mname, int flags);
1111 
1112   // Link through ResolvedMethodName field to get Method*
1113   static Method*        vmtarget(oop mname);
1114   static void       set_method(oop mname, oop method);
1115 
1116   static intptr_t       vmindex(oop mname);
1117   static void       set_vmindex(oop mname, intptr_t index);
1118 
1119   // Testers
1120   static bool is_subclass(Klass* klass) {
1121     return klass->is_subclass_of(SystemDictionary::MemberName_klass());
1122   }
1123   static bool is_instance(oop obj);
1124 
1125   static bool is_method(oop obj);
1126 
1127   // Relevant integer codes (keep these in synch. with MethodHandleNatives.Constants):
1128   enum {
1129     MN_IS_METHOD            = 0x00010000, // method (not constructor)
1130     MN_IS_CONSTRUCTOR       = 0x00020000, // constructor
1131     MN_IS_FIELD             = 0x00040000, // field
1132     MN_IS_TYPE              = 0x00080000, // nested type
1133     MN_CALLER_SENSITIVE     = 0x00100000, // @CallerSensitive annotation detected
1134     MN_REFERENCE_KIND_SHIFT = 24, // refKind
1135     MN_REFERENCE_KIND_MASK  = 0x0F000000 >> MN_REFERENCE_KIND_SHIFT,
1136     // The SEARCH_* bits are not for MN.flags but for the matchFlags argument of MHN.getMembers:
1137     MN_SEARCH_SUPERCLASSES  = 0x00100000, // walk super classes
1138     MN_SEARCH_INTERFACES    = 0x00200000  // walk implemented interfaces




1139   };
1140 
1141   // Accessors for code generation:
1142   static int clazz_offset_in_bytes()            { return _clazz_offset; }
1143   static int type_offset_in_bytes()             { return _type_offset; }
1144   static int name_offset_in_bytes()             { return _name_offset; }
1145   static int flags_offset_in_bytes()            { return _flags_offset; }
1146   static int method_offset_in_bytes()           { return _method_offset; }
1147   static int vmindex_offset_in_bytes()          { return _vmindex_offset; }
1148 };
1149 
1150 
1151 // Interface to java.lang.invoke.MethodType objects
1152 
1153 class java_lang_invoke_MethodType: AllStatic {
1154   friend class JavaClasses;
1155 
1156  private:
1157   static int _rtype_offset;
1158   static int _ptypes_offset;




 212   static bool is_instance(oop obj);
 213   static inline bool is_instance_inlined(oop obj);
 214 
 215   // Debugging
 216   static void print(oop java_string, outputStream* st);
 217   friend class JavaClasses;
 218   friend class StringTable;
 219 };
 220 
 221 
 222 // Interface to java.lang.Class objects
 223 
 224 #define CLASS_INJECTED_FIELDS(macro)                                       \
 225   macro(java_lang_Class, klass,                  intptr_signature,  false) \
 226   macro(java_lang_Class, array_klass,            intptr_signature,  false) \
 227   macro(java_lang_Class, oop_size,               int_signature,     false) \
 228   macro(java_lang_Class, static_oop_field_count, int_signature,     false) \
 229   macro(java_lang_Class, protection_domain,      object_signature,  false) \
 230   macro(java_lang_Class, signers,                object_signature,  false) \
 231   macro(java_lang_Class, source_file,            object_signature,  false) \
 232   macro(java_lang_Class, classData,              object_signature,  false)
 233 
 234 class java_lang_Class : AllStatic {
 235   friend class VMStructs;
 236   friend class JVMCIVMStructs;
 237 
 238  private:
 239   // The fake offsets are added by the class loader when java.lang.Class is loaded
 240 
 241   static int _klass_offset;
 242   static int _array_klass_offset;
 243 
 244   static int _oop_size_offset;
 245   static int _static_oop_field_count_offset;
 246 
 247   static int _protection_domain_offset;
 248   static int _init_lock_offset;
 249   static int _signers_offset;
 250   static int _class_loader_offset;
 251   static int _module_offset;
 252   static int _component_mirror_offset;
 253   static int _name_offset;
 254   static int _source_file_offset;
 255   static int _classData_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,
 268                                        Handle classData, TRAPS);
 269   static void set_mirror_module_field(Klass* K, Handle mirror, Handle module, TRAPS);
 270  public:
 271   static void allocate_fixup_lists();
 272   static void compute_offsets();
 273 
 274   // Instance creation
 275   static void create_mirror(Klass* k, Handle class_loader, Handle module,
 276                             Handle protection_domain, Handle classData, TRAPS);
 277   static void fixup_mirror(Klass* k, TRAPS);
 278   static oop  create_basic_type_mirror(const char* basic_type_name, BasicType type, 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);


 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   // Support for classRedefinedCount field
 313   static int classRedefinedCount(oop the_class_mirror);
 314   static void set_classRedefinedCount(oop the_class_mirror, int value);
 315 
 316   // Support for embedded per-class oops
 317   static oop  protection_domain(oop java_class);
 318   static oop  init_lock(oop java_class);
 319   static oop  component_mirror(oop java_class);
 320   static objArrayOop  signers(oop java_class);
 321   static void set_signers(oop java_class, objArrayOop signers);
 322   static oop  class_data(oop java_class);
 323   static void set_class_data(oop java_class, oop classData);
 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 oop name(Handle java_class, TRAPS);
 330 
 331   static oop source_file(oop java_class);
 332   static void set_source_file(oop java_class, oop source_file);
 333 
 334   static int oop_size(oop java_class);
 335   static int oop_size_raw(oop java_class);
 336   static void set_oop_size(HeapWord* java_class, int size);
 337   static int static_oop_field_count(oop java_class);
 338   static int static_oop_field_count_raw(oop java_class);
 339   static void set_static_oop_field_count(oop java_class, int size);
 340 
 341   static GrowableArray<Klass*>* fixup_mirror_list() {
 342     return _fixup_mirror_list;
 343   }


1114   static int            flags(oop mname);
1115   static void       set_flags(oop mname, int flags);
1116 
1117   // Link through ResolvedMethodName field to get Method*
1118   static Method*        vmtarget(oop mname);
1119   static void       set_method(oop mname, oop method);
1120 
1121   static intptr_t       vmindex(oop mname);
1122   static void       set_vmindex(oop mname, intptr_t index);
1123 
1124   // Testers
1125   static bool is_subclass(Klass* klass) {
1126     return klass->is_subclass_of(SystemDictionary::MemberName_klass());
1127   }
1128   static bool is_instance(oop obj);
1129 
1130   static bool is_method(oop obj);
1131 
1132   // Relevant integer codes (keep these in synch. with MethodHandleNatives.Constants):
1133   enum {
1134     MN_IS_METHOD             = 0x00010000, // method (not constructor)
1135     MN_IS_CONSTRUCTOR        = 0x00020000, // constructor
1136     MN_IS_FIELD              = 0x00040000, // field
1137     MN_IS_TYPE               = 0x00080000, // nested type
1138     MN_CALLER_SENSITIVE      = 0x00100000, // @CallerSensitive annotation detected
1139     MN_REFERENCE_KIND_SHIFT  = 24, // refKind
1140     MN_REFERENCE_KIND_MASK   = 0x0F000000 >> MN_REFERENCE_KIND_SHIFT,
1141     // The SEARCH_* bits are not for MN.flags but for the matchFlags argument of MHN.getMembers:
1142     MN_SEARCH_SUPERCLASSES   = 0x00100000, // walk super classes
1143     MN_SEARCH_INTERFACES     = 0x00200000, // walk implemented interfaces
1144     MN_NESTMATE_CLASS        = 0x00000001,
1145     MN_NONFINDABLE_CLASS     = 0x00000002,
1146     MN_WEAK_CLASS            = 0x00000004,
1147     MN_ACCESS_VM_ANNOTATIONS = 0x00100000
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 >