< prev index next >

src/hotspot/share/oops/weakHandle.cpp

Print this page

39 
40   if (_obj == NULL) {
41     vm_exit_out_of_memory(sizeof(oop*), OOM_MALLOC_ERROR,
42                           "Unable to create new weak oop handle in OopStorage %s",
43                           storage->name());
44   }
45 
46   NativeAccess<ON_PHANTOM_OOP_REF>::oop_store(_obj, obj);
47 }
48 
49 void WeakHandle::release(OopStorage* storage) const {
50   // Only release if the pointer to the object has been created.
51   if (_obj != NULL) {
52     // Clear the WeakHandle.  For race in creating ClassLoaderData, we can release this
53     // WeakHandle before it is cleared by GC.
54     NativeAccess<ON_PHANTOM_OOP_REF>::oop_store(_obj, (oop)NULL);
55     storage->release(_obj);
56   }
57 }
58 





59 void WeakHandle::print() const { print_on(tty); }
60 
61 void WeakHandle::print_on(outputStream* st) const {
62   st->print("WeakHandle: " PTR_FORMAT, p2i(peek()));
63 }

39 
40   if (_obj == NULL) {
41     vm_exit_out_of_memory(sizeof(oop*), OOM_MALLOC_ERROR,
42                           "Unable to create new weak oop handle in OopStorage %s",
43                           storage->name());
44   }
45 
46   NativeAccess<ON_PHANTOM_OOP_REF>::oop_store(_obj, obj);
47 }
48 
49 void WeakHandle::release(OopStorage* storage) const {
50   // Only release if the pointer to the object has been created.
51   if (_obj != NULL) {
52     // Clear the WeakHandle.  For race in creating ClassLoaderData, we can release this
53     // WeakHandle before it is cleared by GC.
54     NativeAccess<ON_PHANTOM_OOP_REF>::oop_store(_obj, (oop)NULL);
55     storage->release(_obj);
56   }
57 }
58 
59 WeakHandle WeakHandle::from_raw(oop* raw) {
60   assert(raw != NULL, "can't create from raw with NULL value");
61   return WeakHandle(raw);
62 }
63 
64 void WeakHandle::print() const { print_on(tty); }
65 
66 void WeakHandle::print_on(outputStream* st) const {
67   st->print("WeakHandle: " PTR_FORMAT, p2i(peek()));
68 }
< prev index next >