< prev index next >

src/hotspot/share/runtime/handles.cpp

Print this page

 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *
 23  */
 24 
 25 #include "precompiled.hpp"
 26 #include "memory/allocation.inline.hpp"
 27 #include "oops/constantPool.hpp"
 28 #include "oops/method.hpp"
 29 #include "oops/oop.inline.hpp"
 30 #include "runtime/handles.inline.hpp"
 31 #include "runtime/thread.inline.hpp"
 32 
 33 #ifdef ASSERT
 34 oop* HandleArea::allocate_handle(oop obj) {
 35   assert(_handle_mark_nesting > 1, "memory leak: allocating handle outside HandleMark");
 36   assert(_no_handle_mark_nesting == 0, "allocating handle inside NoHandleMark");
 37   assert(oopDesc::is_oop(obj), "not an oop: " INTPTR_FORMAT, p2i(obj));
 38   return real_allocate_handle(obj);
 39 }
 40 #endif
 41 
 42 // Copy constructors and destructors for metadata handles
 43 // These do too much to inline.
 44 #define DEF_METADATA_HANDLE_FN_NOINLINE(name, type) \
 45 name##Handle::name##Handle(const name##Handle &h) {                    \
 46   _value = h._value;                                                   \
 47   if (_value != NULL) {                                                \
 48     assert(_value->is_valid(), "obj is valid");                        \
 49     if (h._thread != NULL) {                                           \
 50       assert(h._thread == Thread::current(), "thread must be current");\
 51       _thread = h._thread;                                             \
 52     } else {                                                           \
 53       _thread = Thread::current();                                     \
 54     }                                                                  \
 55     assert(_thread->is_in_live_stack((address)this), "not on stack?"); \
 56     _thread->metadata_handles()->push((Metadata*)_value);              \
 57   } else {                                                             \

 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *
 23  */
 24 
 25 #include "precompiled.hpp"
 26 #include "memory/allocation.inline.hpp"
 27 #include "oops/constantPool.hpp"
 28 #include "oops/method.hpp"
 29 #include "oops/oop.inline.hpp"
 30 #include "runtime/handles.inline.hpp"
 31 #include "runtime/thread.inline.hpp"
 32 
 33 #ifdef ASSERT
 34 oop* HandleArea::allocate_handle(oop obj) {
 35   assert(_handle_mark_nesting > 1, "memory leak: allocating handle outside HandleMark");
 36   assert(_no_handle_mark_nesting == 0, "allocating handle inside NoHandleMark");
 37   assert(oopDesc::is_oop_or_null(obj), "not an oop: " INTPTR_FORMAT, p2i(obj));
 38   return real_allocate_handle(obj);
 39 }
 40 #endif
 41 
 42 // Copy constructors and destructors for metadata handles
 43 // These do too much to inline.
 44 #define DEF_METADATA_HANDLE_FN_NOINLINE(name, type) \
 45 name##Handle::name##Handle(const name##Handle &h) {                    \
 46   _value = h._value;                                                   \
 47   if (_value != NULL) {                                                \
 48     assert(_value->is_valid(), "obj is valid");                        \
 49     if (h._thread != NULL) {                                           \
 50       assert(h._thread == Thread::current(), "thread must be current");\
 51       _thread = h._thread;                                             \
 52     } else {                                                           \
 53       _thread = Thread::current();                                     \
 54     }                                                                  \
 55     assert(_thread->is_in_live_stack((address)this), "not on stack?"); \
 56     _thread->metadata_handles()->push((Metadata*)_value);              \
 57   } else {                                                             \
< prev index next >