8003720: NPG: Method in interpreter stack frame can be deallocated

Pass down a closure during root scanning to keep the class of the method alive.

Reviewed-by: coleenp, jcoomes
This commit is contained in:
Stefan Karlsson 2012-11-27 10:13:20 +01:00
parent 2e2b69e96b
commit 3c2f3a321a
18 changed files with 327 additions and 42 deletions

View file

@ -480,8 +480,10 @@ class Thread: public ThreadShadow {
// GC support
// Apply "f->do_oop" to all root oops in "this".
// Apply "cld_f->do_cld" to CLDs that are otherwise not kept alive.
// Used by JavaThread::oops_do.
// Apply "cf->do_code_blob" (if !NULL) to all code blobs active in frames
virtual void oops_do(OopClosure* f, CodeBlobClosure* cf);
virtual void oops_do(OopClosure* f, CLDToOopClosure* cld_f, CodeBlobClosure* cf);
// Handles the parallel case for the method below.
private:
@ -1405,7 +1407,7 @@ class JavaThread: public Thread {
void frames_do(void f(frame*, const RegisterMap*));
// Memory operations
void oops_do(OopClosure* f, CodeBlobClosure* cf);
void oops_do(OopClosure* f, CLDToOopClosure* cld_f, CodeBlobClosure* cf);
// Sweeper operations
void nmethods_do(CodeBlobClosure* cf);
@ -1825,7 +1827,7 @@ class CompilerThread : public JavaThread {
// GC support
// Apply "f->do_oop" to all root oops in "this".
// Apply "cf->do_code_blob" (if !NULL) to all code blobs active in frames
void oops_do(OopClosure* f, CodeBlobClosure* cf);
void oops_do(OopClosure* f, CLDToOopClosure* cld_f, CodeBlobClosure* cf);
#ifndef PRODUCT
private:
@ -1892,9 +1894,9 @@ class Threads: AllStatic {
// Apply "f->do_oop" to all root oops in all threads.
// This version may only be called by sequential code.
static void oops_do(OopClosure* f, CodeBlobClosure* cf);
static void oops_do(OopClosure* f, CLDToOopClosure* cld_f, CodeBlobClosure* cf);
// This version may be called by sequential or parallel code.
static void possibly_parallel_oops_do(OopClosure* f, CodeBlobClosure* cf);
static void possibly_parallel_oops_do(OopClosure* f, CLDToOopClosure* cld_f, CodeBlobClosure* cf);
// This creates a list of GCTasks, one per thread.
static void create_thread_roots_tasks(GCTaskQueue* q);
// This creates a list of GCTasks, one per thread, for marking objects.