< prev index next >

src/hotspot/share/oops/weakHandle.cpp

Print this page

        

@@ -28,10 +28,11 @@
 #include "gc/shared/oopStorage.hpp"
 #include "oops/access.inline.hpp"
 #include "oops/oop.hpp"
 #include "oops/weakHandle.inline.hpp"
 #include "prims/resolvedMethodTable.hpp"
+#include "runtime/continuation.hpp"
 #include "utilities/debug.hpp"
 #include "utilities/ostream.hpp"
 
 template <> OopStorage* WeakHandle<vm_class_loader_data>::get_storage() {
   return SystemDictionary::vm_weak_oop_storage();

@@ -43,10 +44,14 @@
 
 template <> OopStorage* WeakHandle<vm_resolved_method_table_data>::get_storage() {
   return ResolvedMethodTable::weak_storage();
 }
 
+template <> OopStorage* WeakHandle<vm_nmethod_keepalive_data>::get_storage() {
+  return Continuation::weak_storage();
+}
+
 template <WeakHandleType T>
 WeakHandle<T> WeakHandle<T>::create(Handle obj) {
   assert(obj() != NULL, "no need to create weak null oop");
   oop* oop_addr = get_storage()->allocate();
   if (oop_addr == NULL) {

@@ -56,10 +61,16 @@
   NativeAccess<ON_PHANTOM_OOP_REF>::oop_store(oop_addr, obj());
   return WeakHandle(oop_addr);
 }
 
 template <WeakHandleType T>
+WeakHandle<T> WeakHandle<T>::from_raw(oop* raw) {
+  assert(raw != NULL, "can't create from raw with NULL value");
+  return WeakHandle(raw);
+}
+
+template <WeakHandleType T>
 void WeakHandle<T>::release() const {
   // Only release if the pointer to the object has been created.
   if (_obj != NULL) {
     // Clear the WeakHandle.  For race in creating ClassLoaderData, we can release this
     // WeakHandle before it is cleared by GC.

@@ -78,5 +89,6 @@
 
 // Provide instantiation.
 template class WeakHandle<vm_class_loader_data>;
 template class WeakHandle<vm_string_table_data>;
 template class WeakHandle<vm_resolved_method_table_data>;
+template class WeakHandle<vm_nmethod_keepalive_data>;
< prev index next >