diff src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp @ 7179:d0aa87f04bd5

8003720: NPG: Method in interpreter stack frame can be deallocated Summary: Pass down a closure during root scanning to keep the class of the method alive. Reviewed-by: coleenp, jcoomes
author stefank
date Tue, 27 Nov 2012 10:13:20 +0100
parents d8ce2825b193
children 92ef81e2f571
line wrap: on
line diff
--- a/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp	Mon Nov 26 12:31:03 2012 -0500
+++ b/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp	Tue Nov 27 10:13:20 2012 +0100
@@ -52,14 +52,22 @@
     PrintGCDetails && TraceParallelOldGCTasks, true, gclog_or_tty));
   ParCompactionManager* cm =
     ParCompactionManager::gc_thread_compaction_manager(which);
+
   PSParallelCompact::MarkAndPushClosure mark_and_push_closure(cm);
+  CLDToOopClosure mark_and_push_from_clds(&mark_and_push_closure, true);
   CodeBlobToOopClosure mark_and_push_in_blobs(&mark_and_push_closure, /*do_marking=*/ true);
 
   if (_java_thread != NULL)
-    _java_thread->oops_do(&mark_and_push_closure, &mark_and_push_in_blobs);
+    _java_thread->oops_do(
+        &mark_and_push_closure,
+        &mark_and_push_from_clds,
+        &mark_and_push_in_blobs);
 
   if (_vm_thread != NULL)
-    _vm_thread->oops_do(&mark_and_push_closure, &mark_and_push_in_blobs);
+    _vm_thread->oops_do(
+        &mark_and_push_closure,
+        &mark_and_push_from_clds,
+        &mark_and_push_in_blobs);
 
   // Do the real work
   cm->follow_marking_stacks();
@@ -89,7 +97,8 @@
     {
       ResourceMark rm;
       CodeBlobToOopClosure each_active_code_blob(&mark_and_push_closure, /*do_marking=*/ true);
-      Threads::oops_do(&mark_and_push_closure, &each_active_code_blob);
+      CLDToOopClosure mark_and_push_from_cld(&mark_and_push_closure);
+      Threads::oops_do(&mark_and_push_closure, &mark_and_push_from_cld, &each_active_code_blob);
     }
     break;