< prev index next >

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

Print this page




  35 
  36 inline Handle::Handle(Thread* thread, oop obj) {
  37   assert(thread == Thread::current(), "sanity check");
  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 




  35 
  36 inline Handle::Handle(Thread* thread, oop obj) {
  37   assert(thread == Thread::current(), "sanity check");
  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 DEF_HANDLE_CONSTR(valueArray, is_valueArray_noinline)
  56 
  57 // Constructor for metadata handles
  58 #define DEF_METADATA_HANDLE_FN(name, type) \
  59 inline name##Handle::name##Handle(type* obj) : _value(obj), _thread(NULL) {       \
  60   if (obj != NULL) {                                                   \
  61     assert(((Metadata*)obj)->is_valid(), "obj is valid");              \
  62     _thread = Thread::current();                                       \
  63     assert (_thread->is_in_stack((address)this), "not on stack?");     \
  64     _thread->metadata_handles()->push((Metadata*)obj);                 \
  65   }                                                                    \
  66 }                                                                      \
  67 inline name##Handle::name##Handle(Thread* thread, type* obj) : _value(obj), _thread(thread) { \
  68   if (obj != NULL) {                                                   \
  69     assert(((Metadata*)obj)->is_valid(), "obj is valid");              \
  70     assert(_thread == Thread::current(), "thread must be current");    \
  71     assert (_thread->is_in_stack((address)this), "not on stack?");     \
  72     _thread->metadata_handles()->push((Metadata*)obj);                 \
  73   }                                                                    \
  74 }                                                                      \
  75 


< prev index next >