equal
deleted
inserted
replaced
37 |
37 |
38 // If compressed klass pointers then use narrowKlass. |
38 // If compressed klass pointers then use narrowKlass. |
39 typedef juint narrowKlass; |
39 typedef juint narrowKlass; |
40 |
40 |
41 typedef void* OopOrNarrowOopStar; |
41 typedef void* OopOrNarrowOopStar; |
42 typedef class markOopDesc* markOop; |
|
43 |
42 |
44 #ifndef CHECK_UNHANDLED_OOPS |
43 #ifndef CHECK_UNHANDLED_OOPS |
45 |
44 |
46 typedef class oopDesc* oop; |
45 typedef class oopDesc* oop; |
47 typedef class instanceOopDesc* instanceOop; |
46 typedef class instanceOopDesc* instanceOop; |
48 typedef class arrayOopDesc* arrayOop; |
47 typedef class arrayOopDesc* arrayOop; |
49 typedef class objArrayOopDesc* objArrayOop; |
48 typedef class objArrayOopDesc* objArrayOop; |
50 typedef class typeArrayOopDesc* typeArrayOop; |
49 typedef class typeArrayOopDesc* typeArrayOop; |
51 |
50 |
52 #else |
51 #else |
53 |
52 |
54 // When CHECK_UNHANDLED_OOPS is defined, an "oop" is a class with a |
53 // When CHECK_UNHANDLED_OOPS is defined, an "oop" is a class with a |
55 // carefully chosen set of constructors and conversion operators to go |
54 // carefully chosen set of constructors and conversion operators to go |
72 |
71 |
73 class Thread; |
72 class Thread; |
74 class PromotedObject; |
73 class PromotedObject; |
75 class oopDesc; |
74 class oopDesc; |
76 |
75 |
77 extern bool CheckUnhandledOops; |
76 extern "C" bool CheckUnhandledOops; |
78 |
77 |
79 class oop { |
78 class oop { |
80 oopDesc* _o; |
79 oopDesc* _o; |
81 |
80 |
82 void register_oop(); |
81 void register_oop(); |
83 void unregister_oop(); |
82 void unregister_oop(); |
84 |
83 |
85 // friend class markOop; |
|
86 public: |
84 public: |
87 void set_obj(const void* p) { |
85 void set_obj(const void* p) { |
88 raw_set_obj(p); |
86 raw_set_obj(p); |
89 if (CheckUnhandledOops) register_oop(); |
87 if (CheckUnhandledOops) register_oop(); |
90 } |
88 } |
100 |
98 |
101 oopDesc* obj() const volatile { return _o; } |
99 oopDesc* obj() const volatile { return _o; } |
102 |
100 |
103 // General access |
101 // General access |
104 oopDesc* operator->() const { return obj(); } |
102 oopDesc* operator->() const { return obj(); } |
105 bool operator==(const oop o) const; |
103 bool operator==(const oop o) const { return obj() == o.obj(); } |
106 bool operator==(void *p) const { return obj() == p; } |
104 bool operator==(void *p) const { return obj() == p; } |
107 bool operator!=(const volatile oop o) const; |
105 bool operator!=(const volatile oop o) const { return obj() != o.obj(); } |
108 bool operator!=(void *p) const { return obj() != p; } |
106 bool operator!=(void *p) const { return obj() != p; } |
109 |
107 |
110 // Assignment |
108 // Assignment |
111 oop& operator=(const oop& o) { _o = o.obj(); return *this; } |
109 oop& operator=(const oop& o) { _o = o.obj(); return *this; } |
112 volatile oop& operator=(const oop& o) volatile { _o = o.obj(); return *this; } |
110 volatile oop& operator=(const oop& o) volatile { _o = o.obj(); return *this; } |
119 #endif |
117 #endif |
120 operator HeapWord* () const { return (HeapWord*)obj(); } |
118 operator HeapWord* () const { return (HeapWord*)obj(); } |
121 operator oopDesc* () const volatile { return obj(); } |
119 operator oopDesc* () const volatile { return obj(); } |
122 operator intptr_t* () const { return (intptr_t*)obj(); } |
120 operator intptr_t* () const { return (intptr_t*)obj(); } |
123 operator PromotedObject* () const { return (PromotedObject*)obj(); } |
121 operator PromotedObject* () const { return (PromotedObject*)obj(); } |
124 operator markOop () const volatile { return markOop(obj()); } |
|
125 operator address () const { return (address)obj(); } |
122 operator address () const { return (address)obj(); } |
126 |
123 |
127 // from javaCalls.cpp |
124 // from javaCalls.cpp |
128 operator jobject () const { return (jobject)obj(); } |
125 operator jobject () const { return (jobject)obj(); } |
129 |
126 |
191 } |
188 } |
192 template <class T> inline T cast_from_oop(oop o) { |
189 template <class T> inline T cast_from_oop(oop o) { |
193 return (T)(CHECK_UNHANDLED_OOPS_ONLY((void*))o); |
190 return (T)(CHECK_UNHANDLED_OOPS_ONLY((void*))o); |
194 } |
191 } |
195 |
192 |
196 inline bool check_obj_alignment(oop obj) { |
|
197 return (cast_from_oop<intptr_t>(obj) & MinObjAlignmentInBytesMask) == 0; |
|
198 } |
|
199 |
|
200 // The metadata hierarchy is separate from the oop hierarchy |
193 // The metadata hierarchy is separate from the oop hierarchy |
201 |
194 |
202 // class MetaspaceObj |
195 // class MetaspaceObj |
203 class ConstMethod; |
196 class ConstMethod; |
204 class ConstantPoolCache; |
197 class ConstantPoolCache; |