23 */ |
23 */ |
24 |
24 |
25 #ifndef SHARE_VM_RUNTIME_HANDLES_HPP |
25 #ifndef SHARE_VM_RUNTIME_HANDLES_HPP |
26 #define SHARE_VM_RUNTIME_HANDLES_HPP |
26 #define SHARE_VM_RUNTIME_HANDLES_HPP |
27 |
27 |
28 #include "oops/klass.hpp" |
28 #include "oops/oop.hpp" |
|
29 #include "oops/oopsHierarchy.hpp" |
|
30 |
|
31 class InstanceKlass; |
|
32 class Klass; |
29 |
33 |
30 //------------------------------------------------------------------------------------------------------------------------ |
34 //------------------------------------------------------------------------------------------------------------------------ |
31 // In order to preserve oops during garbage collection, they should be |
35 // In order to preserve oops during garbage collection, they should be |
32 // allocated and passed around via Handles within the VM. A handle is |
36 // allocated and passed around via Handles within the VM. A handle is |
33 // simply an extra indirection allocated in a thread local handle area. |
37 // simply an extra indirection allocated in a thread local handle area. |
199 class instanceKlassHandle : public KlassHandle { |
203 class instanceKlassHandle : public KlassHandle { |
200 public: |
204 public: |
201 /* Constructors */ |
205 /* Constructors */ |
202 instanceKlassHandle () : KlassHandle() {} |
206 instanceKlassHandle () : KlassHandle() {} |
203 instanceKlassHandle (const Klass* k) : KlassHandle(k) { |
207 instanceKlassHandle (const Klass* k) : KlassHandle(k) { |
204 assert(k == NULL || k->oop_is_instance(), |
208 assert(k == NULL || is_instanceKlass(k), "illegal type"); |
205 "illegal type"); |
|
206 } |
209 } |
207 instanceKlassHandle (Thread* thread, const Klass* k) : KlassHandle(thread, k) { |
210 instanceKlassHandle (Thread* thread, const Klass* k) : KlassHandle(thread, k) { |
208 assert(k == NULL || k->oop_is_instance(), |
211 assert(k == NULL || is_instanceKlass(k), "illegal type"); |
209 "illegal type"); |
|
210 } |
212 } |
211 /* Access to klass part */ |
213 /* Access to klass part */ |
212 InstanceKlass* operator () () const { return (InstanceKlass*)obj(); } |
214 InstanceKlass* operator () () const { return (InstanceKlass*)obj(); } |
213 InstanceKlass* operator -> () const { return (InstanceKlass*)obj(); } |
215 InstanceKlass* operator -> () const { return (InstanceKlass*)obj(); } |
|
216 |
|
217 debug_only(bool is_instanceKlass(const Klass* k)); |
214 }; |
218 }; |
215 |
219 |
216 |
220 |
217 //------------------------------------------------------------------------------------------------------------------------ |
221 //------------------------------------------------------------------------------------------------------------------------ |
218 // Thread local handle area |
222 // Thread local handle area |