< prev index next >

src/share/vm/classfile/javaClasses.hpp

Print this page




 226 
 227 class java_lang_Class : AllStatic {
 228   friend class VMStructs;
 229 
 230  private:
 231   // The fake offsets are added by the class loader when java.lang.Class is loaded
 232 
 233   static int _klass_offset;
 234   static int _array_klass_offset;
 235 
 236   static int _oop_size_offset;
 237   static int _static_oop_field_count_offset;
 238 
 239   static int _protection_domain_offset;
 240   static int _init_lock_offset;
 241   static int _signers_offset;
 242   static int _class_loader_offset;
 243   static int _component_mirror_offset;
 244 
 245   static bool offsets_computed;

 246   static int classRedefinedCount_offset;
 247 
 248   static GrowableArray<Klass*>* _fixup_mirror_list;
 249 
 250   static void set_init_lock(oop java_class, oop init_lock);
 251   static void set_protection_domain(oop java_class, oop protection_domain);
 252   static void set_class_loader(oop java_class, oop class_loader);
 253   static void set_component_mirror(oop java_class, oop comp_mirror);
 254   static void initialize_mirror_fields(KlassHandle k, Handle mirror, Handle protection_domain, TRAPS);
 255  public:
 256   static void compute_offsets();
 257 
 258   // Instance creation
 259   static void create_mirror(KlassHandle k, Handle class_loader,
 260                             Handle protection_domain, TRAPS);
 261   static void fixup_mirror(KlassHandle k, TRAPS);
 262   static oop  create_basic_type_mirror(const char* basic_type_name, BasicType type, TRAPS);
 263   // Conversion
 264   static Klass* as_Klass(oop java_class);
 265   static void set_klass(oop java_class, Klass* klass);


 268     Klass* refk_oop = NULL;
 269     BasicType result = as_BasicType(java_class, &refk_oop);
 270     (*reference_klass) = KlassHandle(refk_oop);
 271     return result;
 272   }
 273   static Symbol* as_signature(oop java_class, bool intern_if_not_found, TRAPS);
 274   static void print_signature(oop java_class, outputStream *st);
 275   // Testing
 276   static bool is_instance(oop obj) {
 277     return obj != NULL && obj->klass() == SystemDictionary::Class_klass();
 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(oop java_class);
 284   static void set_array_klass(oop java_class, Klass* klass);
 285   // compiler support for class operations
 286   static int klass_offset_in_bytes()                { return _klass_offset; }
 287   static int array_klass_offset_in_bytes()          { return _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  init_lock(oop java_class);
 295   static oop  component_mirror(oop java_class);
 296   static objArrayOop  signers(oop java_class);
 297   static void set_signers(oop java_class, objArrayOop signers);
 298 
 299   static oop class_loader(oop java_class);
 300 
 301   static int oop_size(oop java_class);
 302   static void set_oop_size(oop java_class, int size);
 303   static int static_oop_field_count(oop java_class);
 304   static void set_static_oop_field_count(oop java_class, int size);
 305 
 306   static GrowableArray<Klass*>* fixup_mirror_list() {
 307     return _fixup_mirror_list;
 308   }
 309   static void set_fixup_mirror_list(GrowableArray<Klass*>* v) {
 310     _fixup_mirror_list = v;
 311   }
 312   // Debugging
 313   friend class JavaClasses;
 314   friend class InstanceKlass;   // verification code accesses offsets
 315   friend class ClassFileParser; // access to number_of_fake_fields















 316 };
 317 
 318 // Interface to java.lang.Thread objects
 319 
 320 class java_lang_Thread : AllStatic {
 321  private:
 322   // Note that for this class the layout changed between JDK1.2 and JDK1.3,
 323   // so we compute the offsets at startup rather than hard-wiring them.
 324   static int _name_offset;
 325   static int _group_offset;
 326   static int _contextClassLoader_offset;
 327   static int _inheritedAccessControlContext_offset;
 328   static int _priority_offset;
 329   static int _eetop_offset;
 330   static int _daemon_offset;
 331   static int _stillborn_offset;
 332   static int _stackSize_offset;
 333   static int _tid_offset;
 334   static int _thread_status_offset;
 335   static int _park_blocker_offset;


1060 #define MEMBERNAME_INJECTED_FIELDS(macro)                               \
1061   macro(java_lang_invoke_MemberName, vmloader, object_signature, false) \
1062   macro(java_lang_invoke_MemberName, vmindex,  intptr_signature, false) \
1063   macro(java_lang_invoke_MemberName, vmtarget, intptr_signature, false)
1064 
1065 class java_lang_invoke_MemberName: AllStatic {
1066   friend class JavaClasses;
1067 
1068  private:
1069   // From java.lang.invoke.MemberName:
1070   //    private Class<?>   clazz;       // class in which the method is defined
1071   //    private String     name;        // may be null if not yet materialized
1072   //    private Object     type;        // may be null if not yet materialized
1073   //    private int        flags;       // modifier bits; see reflect.Modifier
1074   //    private intptr     vmtarget;    // VM-specific target value
1075   //    private intptr_t   vmindex;     // member index within class or interface
1076   static int _clazz_offset;
1077   static int _name_offset;
1078   static int _type_offset;
1079   static int _flags_offset;

1080   static int _vmtarget_offset;
1081   static int _vmloader_offset;
1082   static int _vmindex_offset;
1083 
1084   static void compute_offsets();
1085 
1086  public:
1087   // Accessors
1088   static oop            clazz(oop mname);
1089   static void       set_clazz(oop mname, oop clazz);
1090 
1091   static oop            type(oop mname);
1092   static void       set_type(oop mname, oop type);
1093 
1094   static oop            name(oop mname);
1095   static void       set_name(oop mname, oop name);
1096 
1097   static int            flags(oop mname);
1098   static void       set_flags(oop mname, int flags);


1099 
1100   static Metadata*      vmtarget(oop mname);
1101   static void       set_vmtarget(oop mname, Metadata* target);
1102 #if INCLUDE_JVMTI
1103   static void       adjust_vmtarget(oop mname, Metadata* target);
1104 #endif // INCLUDE_JVMTI
1105 
1106   static intptr_t       vmindex(oop mname);
1107   static void       set_vmindex(oop mname, intptr_t index);
1108 
1109   // Testers
1110   static bool is_subclass(Klass* klass) {
1111     return klass->is_subclass_of(SystemDictionary::MemberName_klass());
1112   }
1113   static bool is_instance(oop obj) {
1114     return obj != NULL && is_subclass(obj->klass());
1115   }
1116 
1117   // Relevant integer codes (keep these in synch. with MethodHandleNatives.Constants):
1118   enum {




 226 
 227 class java_lang_Class : AllStatic {
 228   friend class VMStructs;
 229 
 230  private:
 231   // The fake offsets are added by the class loader when java.lang.Class is loaded
 232 
 233   static int _klass_offset;
 234   static int _array_klass_offset;
 235 
 236   static int _oop_size_offset;
 237   static int _static_oop_field_count_offset;
 238 
 239   static int _protection_domain_offset;
 240   static int _init_lock_offset;
 241   static int _signers_offset;
 242   static int _class_loader_offset;
 243   static int _component_mirror_offset;
 244 
 245   static bool offsets_computed;
 246   static int _classData_offset;
 247   static int classRedefinedCount_offset;
 248 
 249   static GrowableArray<Klass*>* _fixup_mirror_list;
 250 
 251   static void set_init_lock(oop java_class, oop init_lock);
 252   static void set_protection_domain(oop java_class, oop protection_domain);
 253   static void set_class_loader(oop java_class, oop class_loader);
 254   static void set_component_mirror(oop java_class, oop comp_mirror);
 255   static void initialize_mirror_fields(KlassHandle k, Handle mirror, Handle protection_domain, TRAPS);
 256  public:
 257   static void compute_offsets();
 258 
 259   // Instance creation
 260   static void create_mirror(KlassHandle k, Handle class_loader,
 261                             Handle protection_domain, TRAPS);
 262   static void fixup_mirror(KlassHandle k, TRAPS);
 263   static oop  create_basic_type_mirror(const char* basic_type_name, BasicType type, TRAPS);
 264   // Conversion
 265   static Klass* as_Klass(oop java_class);
 266   static void set_klass(oop java_class, Klass* klass);


 269     Klass* refk_oop = NULL;
 270     BasicType result = as_BasicType(java_class, &refk_oop);
 271     (*reference_klass) = KlassHandle(refk_oop);
 272     return result;
 273   }
 274   static Symbol* as_signature(oop java_class, bool intern_if_not_found, TRAPS);
 275   static void print_signature(oop java_class, outputStream *st);
 276   // Testing
 277   static bool is_instance(oop obj) {
 278     return obj != NULL && obj->klass() == SystemDictionary::Class_klass();
 279   }
 280   static bool is_primitive(oop java_class);
 281   static BasicType primitive_type(oop java_class);
 282   static oop primitive_mirror(BasicType t);
 283   // JVM_NewArray support
 284   static Klass* array_klass(oop java_class);
 285   static void set_array_klass(oop java_class, Klass* klass);
 286   // compiler support for class operations
 287   static int klass_offset_in_bytes()                { return _klass_offset; }
 288   static int array_klass_offset_in_bytes()          { return _array_klass_offset; }
 289 
 290   static oop classData(oop obj);
 291 
 292   // Support for classRedefinedCount field
 293   static int classRedefinedCount(oop the_class_mirror);
 294   static void set_classRedefinedCount(oop the_class_mirror, int value);
 295 
 296   // Support for embedded per-class oops
 297   static oop  protection_domain(oop java_class);
 298   static oop  init_lock(oop java_class);
 299   static oop  component_mirror(oop java_class);
 300   static objArrayOop  signers(oop java_class);
 301   static void set_signers(oop java_class, objArrayOop signers);
 302 
 303   static oop class_loader(oop java_class);
 304 
 305   static int oop_size(oop java_class);
 306   static void set_oop_size(oop java_class, int size);
 307   static int static_oop_field_count(oop java_class);
 308   static void set_static_oop_field_count(oop java_class, int size);
 309 
 310   static GrowableArray<Klass*>* fixup_mirror_list() {
 311     return _fixup_mirror_list;
 312   }
 313   static void set_fixup_mirror_list(GrowableArray<Klass*>* v) {
 314     _fixup_mirror_list = v;
 315   }
 316   // Debugging
 317   friend class JavaClasses;
 318   friend class InstanceKlass;   // verification code accesses offsets
 319   friend class ClassFileParser; // access to number_of_fake_fields_sequenceNumber_offset
 320 };
 321 
 322 /**
 323  * java.lang.Class$ClassData
 324  */
 325 class java_lang_invoke_MemberName_ClassData : AllStatic {
 326   friend class JavaClasses;
 327 
 328  private:
 329   static int _publishedToVM_offset;
 330   static void compute_offsets();
 331 
 332  public:
 333   static bool is_instance(oop obj);
 334   static oop publishedToVM(oop obj);
 335 };
 336 
 337 // Interface to java.lang.Thread objects
 338 
 339 class java_lang_Thread : AllStatic {
 340  private:
 341   // Note that for this class the layout changed between JDK1.2 and JDK1.3,
 342   // so we compute the offsets at startup rather than hard-wiring them.
 343   static int _name_offset;
 344   static int _group_offset;
 345   static int _contextClassLoader_offset;
 346   static int _inheritedAccessControlContext_offset;
 347   static int _priority_offset;
 348   static int _eetop_offset;
 349   static int _daemon_offset;
 350   static int _stillborn_offset;
 351   static int _stackSize_offset;
 352   static int _tid_offset;
 353   static int _thread_status_offset;
 354   static int _park_blocker_offset;


1079 #define MEMBERNAME_INJECTED_FIELDS(macro)                               \
1080   macro(java_lang_invoke_MemberName, vmloader, object_signature, false) \
1081   macro(java_lang_invoke_MemberName, vmindex,  intptr_signature, false) \
1082   macro(java_lang_invoke_MemberName, vmtarget, intptr_signature, false)
1083 
1084 class java_lang_invoke_MemberName: AllStatic {
1085   friend class JavaClasses;
1086 
1087  private:
1088   // From java.lang.invoke.MemberName:
1089   //    private Class<?>   clazz;       // class in which the method is defined
1090   //    private String     name;        // may be null if not yet materialized
1091   //    private Object     type;        // may be null if not yet materialized
1092   //    private int        flags;       // modifier bits; see reflect.Modifier
1093   //    private intptr     vmtarget;    // VM-specific target value
1094   //    private intptr_t   vmindex;     // member index within class or interface
1095   static int _clazz_offset;
1096   static int _name_offset;
1097   static int _type_offset;
1098   static int _flags_offset;
1099   static int _next_offset;
1100   static int _vmtarget_offset;
1101   static int _vmloader_offset;
1102   static int _vmindex_offset;
1103 
1104   static void compute_offsets();
1105 
1106  public:
1107   // Accessors
1108   static oop            clazz(oop mname);
1109   static void       set_clazz(oop mname, oop clazz);
1110 
1111   static oop            type(oop mname);
1112   static void       set_type(oop mname, oop type);
1113 
1114   static oop            name(oop mname);
1115   static void       set_name(oop mname, oop name);
1116 
1117   static int            flags(oop mname);
1118   static void       set_flags(oop mname, int flags);
1119 
1120   static oop            next(oop mname);
1121 
1122   static Metadata*      vmtarget(oop mname);
1123   static void       set_vmtarget(oop mname, Metadata* target);
1124 #if INCLUDE_JVMTI
1125   static void       adjust_vmtarget(oop mname, Metadata* target);
1126 #endif // INCLUDE_JVMTI
1127 
1128   static intptr_t       vmindex(oop mname);
1129   static void       set_vmindex(oop mname, intptr_t index);
1130 
1131   // Testers
1132   static bool is_subclass(Klass* klass) {
1133     return klass->is_subclass_of(SystemDictionary::MemberName_klass());
1134   }
1135   static bool is_instance(oop obj) {
1136     return obj != NULL && is_subclass(obj->klass());
1137   }
1138 
1139   // Relevant integer codes (keep these in synch. with MethodHandleNatives.Constants):
1140   enum {


< prev index next >