< prev index next >

test/hotspot/gtest/code/test_dependencyContext.cpp

Print this page

        

@@ -48,11 +48,11 @@
     dependencies().add_dependent_nmethod(_nmethods[1]);
     dependencies().add_dependent_nmethod(_nmethods[0]);
   }
 
   ~TestDependencyContext() {
-    dependencies().wipe();
+    wipe();
     CodeCache_lock->unlock();
   }
 
   static bool has_stale_entries(DependencyContext ctx) {
     return ctx.has_stale_entries();

@@ -61,10 +61,22 @@
 #ifndef PRODUCT
   static bool find_stale_entries(DependencyContext ctx) {
     return ctx.find_stale_entries();
   }
 #endif
+
+  void wipe() {
+    DependencyContext ctx(&_dependency_context);
+    nmethodBucket* b = ctx.dependencies();
+    ctx.set_dependencies(NULL);
+    ctx.set_has_stale_entries(false);
+    while (b != NULL) {
+      nmethodBucket* next = b->next();
+      delete b;
+      b = next;
+    }
+  }
 };
 
 static void test_remove_dependent_nmethod(int id, bool delete_immediately) {
   TestDependencyContext c;
   DependencyContext depContext = c.dependencies();
< prev index next >