Review request (M): 8003720: NPG: Method in interpreter stack frame can be deallocated (original) (raw)
Stefan Karlsson stefan.karlsson at oracle.com
Tue Nov 27 01:10:23 PST 2012
- Previous message: Review request (M): 8003720: NPG: Method in interpreter stack frame can be deallocated
- Next message: Review request (M): 8003720: NPG: Method in interpreter stack frame can be deallocated
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 11/27/2012 01:10 AM, John Coomes wrote:
Stefan Karlsson (stefan.karlsson at oracle.com) wrote:
David,
Thanks for taking a look at this. I've added a comment regarding the cldf: // GC support // Apply "f->dooop" to all root oops in "this". + // Apply "cldf->docld" to CLDs that are otherwise not kept alive. + // Used by JavaThread::oopsdo. // Apply "cf->docodeblob" (if !NULL) to all code blobs active in frames ! virtual void oopsdo(OopClosure f,CLDToOopClosure* cldf,CodeBlobClosure* cf);* http://cr.openjdk.java.net/~stefank/8003720/webrev.01 iterator.hpp: ------------ I don't see any uses of this constructor: 150 CLDToOopClosure(OopClosure* oopclosure, KlassClosure* klassclosure, bool mustclaimcld = true) : 151 oopclosure(oopclosure), 152 defaultklassclosure(NULL), // Ignored 153 klassclosure(klassclosure), 154 mustclaimcld(mustclaimcld) {} If it's unused, then you can eliminate the defaultklassclosure / klassclosure distinction.
Good catch. I'll remove the distinction.
frame.cpp: -------- A typo in the comment: 916 // closure that knows have to keep klasses alive given a ClassLoaderData. ^^^^
Fixed.
Otherwise, looks good.
Thanks for the review.
StefanK
-John
On 11/23/2012 01:01 AM, David Holmes wrote: Hi Stefan,
Not my area so a minor comment not a review :) thread.hpp 481 // GC support 482 // Apply "f->dooop" to all root oops in "this". 483 // Apply "cf->docodeblob" (if !NULL) to all code blobs active in frames 484 virtual void oopsdo(OopClosure* f, CLDToOopClosure* cldf, CodeBlobClosure* cf); can you add a comment that cldf is not used/needed by Thread::oopsdo Thanks, David On 23/11/2012 12:14 AM, Stefan Karlsson wrote: http://cr.openjdk.java.net/~stefank/8003720/webrev/
Description from CR: In virtual calls the Method pointer in the interpreter stack frame is not kept alive by anything other than the "this" pointers to that method. If bytecodes overwrite the "this" pointer, then call a full GC, the class loader containing the Method* can be unloaded and the Method* deallocated. This is also a problem with JSR292 MethodHandle static code because the MethodHandle containing the mirror for the interpreted method Method* is not on the stack if a GC occurs. Fix proposal: The "obvious" solution to this problem would be to apply the root scanning OopClosure to the Klass::javamirror field of the method in the interpreted frame. However, doing this might cause us to scan the same metadata oop location more than once, which is not allowed by some of the HotSpot GCs. We currently solve similar situations by always "claiming" and start scanning from the ClassLoaderData and then proceed down into the Klasses of that class loader. For this bug we do the same. All old collections, where class unloading can occur, pass down a closure that is applied to the ClassLoaderData of the Klass of the Method in the interpreted frame. This closure does the claiming and proceeds to scan the class metadata. Note that during young collections, where we don't do class unloading, all classes are already used as strong roots and we don't have to apply this new closure in the interpreted frame. Testing: The added test was initially written by John Rose. I only ported it to JTreg and made some artistic cleanups to it. thanks, StefanK
- Previous message: Review request (M): 8003720: NPG: Method in interpreter stack frame can be deallocated
- Next message: Review request (M): 8003720: NPG: Method in interpreter stack frame can be deallocated
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]