131 hc_resolved_constructor_offset = 2,
132 hc_number_of_fake_oop_fields = 3
133 };
134
135 static int klass_offset;
136 static int resolved_constructor_offset;
137 static int array_klass_offset;
138 static int number_of_fake_oop_fields;
139
140 static void compute_offsets();
141 static bool offsets_computed;
142 static int classRedefinedCount_offset;
143
144 public:
145 // Instance creation
146 static oop create_mirror(KlassHandle k, TRAPS);
147 static oop create_basic_type_mirror(const char* basic_type_name, BasicType type, TRAPS);
148 // Conversion
149 static klassOop as_klassOop(oop java_class);
150 // Testing
151 static bool is_primitive(oop java_class);
152 static BasicType primitive_type(oop java_class);
153 static oop primitive_mirror(BasicType t);
154 // JVM_NewInstance support
155 static methodOop resolved_constructor(oop java_class);
156 static void set_resolved_constructor(oop java_class, methodOop constructor);
157 // JVM_NewArray support
158 static klassOop array_klass(oop java_class);
159 static void set_array_klass(oop java_class, klassOop klass);
160 // compiler support for class operations
161 static int klass_offset_in_bytes() { return klass_offset; }
162 static int resolved_constructor_offset_in_bytes() { return resolved_constructor_offset; }
163 static int array_klass_offset_in_bytes() { return array_klass_offset; }
164 // Support for classRedefinedCount field
165 static int classRedefinedCount(oop the_class_mirror);
166 static void set_classRedefinedCount(oop the_class_mirror, int value);
167 // Debugging
168 friend class JavaClasses;
169 friend class instanceKlass; // verification code accesses offsets
170 friend class ClassFileParser; // access to number_of_fake_fields
633
634 // Interface to java.lang primitive type boxing objects:
635 // - java.lang.Boolean
636 // - java.lang.Character
637 // - java.lang.Float
638 // - java.lang.Double
639 // - java.lang.Byte
640 // - java.lang.Short
641 // - java.lang.Integer
642 // - java.lang.Long
643
644 // This could be separated out into 8 individual classes.
645
646 class java_lang_boxing_object: AllStatic {
647 private:
648 enum {
649 hc_value_offset = 0
650 };
651 static int value_offset;
652
653 static oop initialize_and_allocate(klassOop klass, TRAPS);
654 public:
655 // Allocation. Returns a boxed value, or NULL for invalid type.
656 static oop create(BasicType type, jvalue* value, TRAPS);
657 // Accessors. Returns the basic type being boxed, or T_ILLEGAL for invalid oop.
658 static BasicType get_value(oop box, jvalue* value);
659 static BasicType set_value(oop box, jvalue* value);
660
661 static int value_offset_in_bytes() { return value_offset; }
662
663 // Debugging
664 friend class JavaClasses;
665 };
666
667
668
669 // Interface to java.lang.ref.Reference objects
670
671 class java_lang_ref_Reference: AllStatic {
672 public:
673 enum {
674 hc_referent_offset = 0,
675 hc_queue_offset = 1,
676 hc_next_offset = 2,
677 hc_discovered_offset = 3 // Is not last, see SoftRefs.
678 };
679 enum {
|
131 hc_resolved_constructor_offset = 2,
132 hc_number_of_fake_oop_fields = 3
133 };
134
135 static int klass_offset;
136 static int resolved_constructor_offset;
137 static int array_klass_offset;
138 static int number_of_fake_oop_fields;
139
140 static void compute_offsets();
141 static bool offsets_computed;
142 static int classRedefinedCount_offset;
143
144 public:
145 // Instance creation
146 static oop create_mirror(KlassHandle k, TRAPS);
147 static oop create_basic_type_mirror(const char* basic_type_name, BasicType type, TRAPS);
148 // Conversion
149 static klassOop as_klassOop(oop java_class);
150 // Testing
151 static bool is_instance(oop obj) {
152 return obj != NULL && obj->klass() == SystemDictionary::class_klass();
153 }
154 static bool is_primitive(oop java_class);
155 static BasicType primitive_type(oop java_class);
156 static oop primitive_mirror(BasicType t);
157 // JVM_NewInstance support
158 static methodOop resolved_constructor(oop java_class);
159 static void set_resolved_constructor(oop java_class, methodOop constructor);
160 // JVM_NewArray support
161 static klassOop array_klass(oop java_class);
162 static void set_array_klass(oop java_class, klassOop klass);
163 // compiler support for class operations
164 static int klass_offset_in_bytes() { return klass_offset; }
165 static int resolved_constructor_offset_in_bytes() { return resolved_constructor_offset; }
166 static int array_klass_offset_in_bytes() { return array_klass_offset; }
167 // Support for classRedefinedCount field
168 static int classRedefinedCount(oop the_class_mirror);
169 static void set_classRedefinedCount(oop the_class_mirror, int value);
170 // Debugging
171 friend class JavaClasses;
172 friend class instanceKlass; // verification code accesses offsets
173 friend class ClassFileParser; // access to number_of_fake_fields
636
637 // Interface to java.lang primitive type boxing objects:
638 // - java.lang.Boolean
639 // - java.lang.Character
640 // - java.lang.Float
641 // - java.lang.Double
642 // - java.lang.Byte
643 // - java.lang.Short
644 // - java.lang.Integer
645 // - java.lang.Long
646
647 // This could be separated out into 8 individual classes.
648
649 class java_lang_boxing_object: AllStatic {
650 private:
651 enum {
652 hc_value_offset = 0
653 };
654 static int value_offset;
655
656 static oop initialize_and_allocate(BasicType type, TRAPS);
657 public:
658 // Allocation. Returns a boxed value, or NULL for invalid type.
659 static oop create(BasicType type, jvalue* value, TRAPS);
660 // Accessors. Returns the basic type being boxed, or T_ILLEGAL for invalid oop.
661 static BasicType get_value(oop box, jvalue* value);
662 static BasicType set_value(oop box, jvalue* value);
663 static BasicType basic_type(oop box);
664 static bool is_instance(oop box) { return basic_type(box) != T_ILLEGAL; }
665 static bool is_instance(oop box, BasicType type) { return basic_type(box) == type; }
666
667 static int value_offset_in_bytes() { return value_offset; }
668
669 // Debugging
670 friend class JavaClasses;
671 };
672
673
674
675 // Interface to java.lang.ref.Reference objects
676
677 class java_lang_ref_Reference: AllStatic {
678 public:
679 enum {
680 hc_referent_offset = 0,
681 hc_queue_offset = 1,
682 hc_next_offset = 2,
683 hc_discovered_offset = 3 // Is not last, see SoftRefs.
684 };
685 enum {
|