< prev index next >

src/hotspot/share/runtime/handles.inline.hpp

Print this page




  38   if (obj == NULL) {
  39     _handle = NULL;
  40   } else {
  41     _handle = thread->handle_area()->allocate_handle(obj);
  42   }
  43 }
  44 
  45 // Inline constructors for Specific Handles for different oop types
  46 #define DEF_HANDLE_CONSTR(type, is_a)                   \
  47 inline type##Handle::type##Handle (Thread* thread, type##Oop obj) : Handle(thread, (oop)obj) { \
  48   assert(is_null() || ((oop)obj)->is_a(), "illegal type");                \
  49 }
  50 
  51 DEF_HANDLE_CONSTR(instance , is_instance_noinline )
  52 DEF_HANDLE_CONSTR(array    , is_array_noinline    )
  53 DEF_HANDLE_CONSTR(objArray , is_objArray_noinline )
  54 DEF_HANDLE_CONSTR(typeArray, is_typeArray_noinline)
  55 
  56 // Constructor for metadata handles
  57 #define DEF_METADATA_HANDLE_FN(name, type) \
  58 inline name##Handle::name##Handle(type* obj) : _value(obj), _thread(NULL) {       \
  59   if (obj != NULL) {                                                   \
  60     assert(((Metadata*)obj)->is_valid(), "obj is valid");              \
  61     _thread = Thread::current();                                       \
  62     assert (_thread->is_in_stack((address)this), "not on stack?");     \
  63     _thread->metadata_handles()->push((Metadata*)obj);                 \
  64   }                                                                    \
  65 }                                                                      \
  66 inline name##Handle::name##Handle(Thread* thread, type* obj) : _value(obj), _thread(thread) { \
  67   if (obj != NULL) {                                                   \
  68     assert(((Metadata*)obj)->is_valid(), "obj is valid");              \
  69     assert(_thread == Thread::current(), "thread must be current");    \
  70     assert (_thread->is_in_stack((address)this), "not on stack?");     \
  71     _thread->metadata_handles()->push((Metadata*)obj);                 \
  72   }                                                                    \
  73 }                                                                      \
  74 
  75 DEF_METADATA_HANDLE_FN(method, Method)
  76 DEF_METADATA_HANDLE_FN(constantPool, ConstantPool)
  77 
  78 inline HandleMark::HandleMark() {
  79   initialize(Thread::current());
  80 }
  81 
  82 inline void HandleMark::push() {
  83   // This is intentionally a NOP. pop_and_restore will reset
  84   // values to the HandleMark further down the stack, typically
  85   // in JavaCalls::call_helper.




  38   if (obj == NULL) {
  39     _handle = NULL;
  40   } else {
  41     _handle = thread->handle_area()->allocate_handle(obj);
  42   }
  43 }
  44 
  45 // Inline constructors for Specific Handles for different oop types
  46 #define DEF_HANDLE_CONSTR(type, is_a)                   \
  47 inline type##Handle::type##Handle (Thread* thread, type##Oop obj) : Handle(thread, (oop)obj) { \
  48   assert(is_null() || ((oop)obj)->is_a(), "illegal type");                \
  49 }
  50 
  51 DEF_HANDLE_CONSTR(instance , is_instance_noinline )
  52 DEF_HANDLE_CONSTR(array    , is_array_noinline    )
  53 DEF_HANDLE_CONSTR(objArray , is_objArray_noinline )
  54 DEF_HANDLE_CONSTR(typeArray, is_typeArray_noinline)
  55 
  56 // Constructor for metadata handles
  57 #define DEF_METADATA_HANDLE_FN(name, type) \








  58 inline name##Handle::name##Handle(Thread* thread, type* obj) : _value(obj), _thread(thread) { \
  59   if (obj != NULL) {                                                   \
  60     assert(((Metadata*)obj)->is_valid(), "obj is valid");              \
  61     assert(_thread == Thread::current(), "thread must be current");    \
  62     assert (_thread->is_in_stack((address)this), "not on stack?");     \
  63     _thread->metadata_handles()->push((Metadata*)obj);                 \
  64   }                                                                    \
  65 }                                                                      \
  66 
  67 DEF_METADATA_HANDLE_FN(method, Method)
  68 DEF_METADATA_HANDLE_FN(constantPool, ConstantPool)
  69 
  70 inline HandleMark::HandleMark() {
  71   initialize(Thread::current());
  72 }
  73 
  74 inline void HandleMark::push() {
  75   // This is intentionally a NOP. pop_and_restore will reset
  76   // values to the HandleMark further down the stack, typically
  77   // in JavaCalls::call_helper.


< prev index next >