< prev index next >

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

Print this page




  52 #endif // ASSERT
  53 
  54 // Constructors for metadata handles
  55 #define DEF_METADATA_HANDLE_FN(name, type) \
  56 inline name##Handle::name##Handle(type* obj) : _value(obj), _thread(NULL) {       \
  57   if (obj != NULL) {                                                   \
  58     assert(((Metadata*)obj)->is_valid(), "obj is valid");              \
  59     _thread = Thread::current();                                       \
  60     assert (_thread->is_in_stack((address)this), "not on stack?");     \
  61     _thread->metadata_handles()->push((Metadata*)obj);                 \
  62   }                                                                    \
  63 }                                                                      \
  64 inline name##Handle::name##Handle(Thread* thread, type* obj) : _value(obj), _thread(thread) { \
  65   if (obj != NULL) {                                                   \
  66     assert(((Metadata*)obj)->is_valid(), "obj is valid");              \
  67     assert(_thread == Thread::current(), "thread must be current");    \
  68     assert (_thread->is_in_stack((address)this), "not on stack?");     \
  69     _thread->metadata_handles()->push((Metadata*)obj);                 \
  70   }                                                                    \
  71 }                                                                      \
  72 inline name##Handle::name##Handle(const name##Handle &h) {             \
  73   _value = h._value;                                                   \
  74   if (_value != NULL) {                                                \
  75     assert(_value->is_valid(), "obj is valid");                        \
  76     if (h._thread != NULL) {                                           \
  77       assert(h._thread == Thread::current(), "thread must be current");\
  78       _thread = h._thread;                                             \
  79     } else {                                                           \
  80       _thread = Thread::current();                                     \
  81     }                                                                  \
  82     assert (_thread->is_in_stack((address)this), "not on stack?");     \
  83     _thread->metadata_handles()->push((Metadata*)_value);              \
  84   } else {                                                             \
  85     _thread = NULL;                                                    \
  86   }                                                                    \
  87 }                                                                      \
  88 inline name##Handle& name##Handle::operator=(const name##Handle &s) {  \
  89   remove();                                                            \
  90   _value = s._value;                                                   \
  91   if (_value != NULL) {                                                \
  92     assert(_value->is_valid(), "obj is valid");                        \
  93     if (s._thread != NULL) {                                           \
  94       assert(s._thread == Thread::current(), "thread must be current");\
  95       _thread = s._thread;                                             \
  96     } else {                                                           \
  97       _thread = Thread::current();                                     \
  98     }                                                                  \
  99     assert (_thread->is_in_stack((address)this), "not on stack?");     \
 100     _thread->metadata_handles()->push((Metadata*)_value);              \
 101   } else {                                                             \
 102     _thread = NULL;                                                    \




  52 #endif // ASSERT
  53 
  54 // Constructors for metadata handles
  55 #define DEF_METADATA_HANDLE_FN(name, type) \
  56 inline name##Handle::name##Handle(type* obj) : _value(obj), _thread(NULL) {       \
  57   if (obj != NULL) {                                                   \
  58     assert(((Metadata*)obj)->is_valid(), "obj is valid");              \
  59     _thread = Thread::current();                                       \
  60     assert (_thread->is_in_stack((address)this), "not on stack?");     \
  61     _thread->metadata_handles()->push((Metadata*)obj);                 \
  62   }                                                                    \
  63 }                                                                      \
  64 inline name##Handle::name##Handle(Thread* thread, type* obj) : _value(obj), _thread(thread) { \
  65   if (obj != NULL) {                                                   \
  66     assert(((Metadata*)obj)->is_valid(), "obj is valid");              \
  67     assert(_thread == Thread::current(), "thread must be current");    \
  68     assert (_thread->is_in_stack((address)this), "not on stack?");     \
  69     _thread->metadata_handles()->push((Metadata*)obj);                 \
  70   }                                                                    \
  71 }                                                                      \
  72 inline name##Handle::name##Handle(const name##Handle &h, bool check_in_stack) { \
  73   _value = h._value;                                                   \
  74   if (_value != NULL) {                                                \
  75     assert(_value->is_valid(), "obj is valid");                        \
  76     if (h._thread != NULL) {                                           \
  77       assert(h._thread == Thread::current(), "thread must be current");\
  78       _thread = h._thread;                                             \
  79     } else {                                                           \
  80       _thread = Thread::current();                                     \
  81     }                                                                  \
  82     assert (! check_in_stack || _thread->is_in_stack((address)this), "not on stack?"); \
  83     _thread->metadata_handles()->push((Metadata*)_value);              \
  84   } else {                                                             \
  85     _thread = NULL;                                                    \
  86   }                                                                    \
  87 }                                                                      \
  88 inline name##Handle& name##Handle::operator=(const name##Handle &s) {  \
  89   remove();                                                            \
  90   _value = s._value;                                                   \
  91   if (_value != NULL) {                                                \
  92     assert(_value->is_valid(), "obj is valid");                        \
  93     if (s._thread != NULL) {                                           \
  94       assert(s._thread == Thread::current(), "thread must be current");\
  95       _thread = s._thread;                                             \
  96     } else {                                                           \
  97       _thread = Thread::current();                                     \
  98     }                                                                  \
  99     assert (_thread->is_in_stack((address)this), "not on stack?");     \
 100     _thread->metadata_handles()->push((Metadata*)_value);              \
 101   } else {                                                             \
 102     _thread = NULL;                                                    \


< prev index next >