23 */
24
25 #ifndef SHARE_VM_RUNTIME_HANDLES_INLINE_HPP
26 #define SHARE_VM_RUNTIME_HANDLES_INLINE_HPP
27
28 #include "runtime/handles.hpp"
29 #include "runtime/thread.inline.hpp"
30
31 // these inline functions are in a separate file to break an include cycle
32 // between Thread and Handle
33
34 inline Handle::Handle(Thread* thread, oop obj) {
35 assert(thread == Thread::current(), "sanity check");
36 if (obj == NULL) {
37 _handle = NULL;
38 } else {
39 _handle = thread->handle_area()->allocate_handle(obj);
40 }
41 }
42
43 // Constructors for metadata handles
44 #define DEF_METADATA_HANDLE_FN(name, type) \
45 inline name##Handle::name##Handle(type* obj) : _value(obj), _thread(NULL) { \
46 if (obj != NULL) { \
47 assert(((Metadata*)obj)->is_valid(), "obj is valid"); \
48 _thread = Thread::current(); \
49 assert (_thread->is_in_stack((address)this), "not on stack?"); \
50 _thread->metadata_handles()->push((Metadata*)obj); \
51 } \
52 } \
53 inline name##Handle::name##Handle(Thread* thread, type* obj) : _value(obj), _thread(thread) { \
54 if (obj != NULL) { \
55 assert(((Metadata*)obj)->is_valid(), "obj is valid"); \
56 assert(_thread == Thread::current(), "thread must be current"); \
57 assert (_thread->is_in_stack((address)this), "not on stack?"); \
58 _thread->metadata_handles()->push((Metadata*)obj); \
59 } \
60 } \
61
62 DEF_METADATA_HANDLE_FN(method, Method)
63 DEF_METADATA_HANDLE_FN(constantPool, ConstantPool)
|
23 */
24
25 #ifndef SHARE_VM_RUNTIME_HANDLES_INLINE_HPP
26 #define SHARE_VM_RUNTIME_HANDLES_INLINE_HPP
27
28 #include "runtime/handles.hpp"
29 #include "runtime/thread.inline.hpp"
30
31 // these inline functions are in a separate file to break an include cycle
32 // between Thread and Handle
33
34 inline Handle::Handle(Thread* thread, oop obj) {
35 assert(thread == Thread::current(), "sanity check");
36 if (obj == NULL) {
37 _handle = NULL;
38 } else {
39 _handle = thread->handle_area()->allocate_handle(obj);
40 }
41 }
42
43 // Constructor for metadata handles
44 #define DEF_METADATA_HANDLE_FN(name, type) \
45 inline name##Handle::name##Handle(type* obj) : _value(obj), _thread(NULL) { \
46 if (obj != NULL) { \
47 assert(((Metadata*)obj)->is_valid(), "obj is valid"); \
48 _thread = Thread::current(); \
49 assert (_thread->is_in_stack((address)this), "not on stack?"); \
50 _thread->metadata_handles()->push((Metadata*)obj); \
51 } \
52 } \
53 inline name##Handle::name##Handle(Thread* thread, type* obj) : _value(obj), _thread(thread) { \
54 if (obj != NULL) { \
55 assert(((Metadata*)obj)->is_valid(), "obj is valid"); \
56 assert(_thread == Thread::current(), "thread must be current"); \
57 assert (_thread->is_in_stack((address)this), "not on stack?"); \
58 _thread->metadata_handles()->push((Metadata*)obj); \
59 } \
60 } \
61
62 DEF_METADATA_HANDLE_FN(method, Method)
63 DEF_METADATA_HANDLE_FN(constantPool, ConstantPool)
|