Mercurial > hg > graal-compiler
diff src/share/vm/prims/jvmtiImpl.cpp @ 13086:096c224171c4
Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 20 Nov 2013 00:10:38 +0100 |
parents | cefad50507d8 910026b800b8 |
children | 6b2d8d20ecbd |
line wrap: on
line diff
--- a/src/share/vm/prims/jvmtiImpl.cpp Tue Nov 19 17:44:26 2013 +0100 +++ b/src/share/vm/prims/jvmtiImpl.cpp Wed Nov 20 00:10:38 2013 +0100 @@ -210,6 +210,14 @@ } } +void GrowableCache::metadata_do(void f(Metadata*)) { + int len = _elements->length(); + for (int i=0; i<len; i++) { + GrowableElement *e = _elements->at(i); + e->metadata_do(f); + } +} + void GrowableCache::gc_epilogue() { int len = _elements->length(); for (int i=0; i<len; i++) { @@ -224,19 +232,21 @@ JvmtiBreakpoint::JvmtiBreakpoint() { _method = NULL; _bci = 0; - _class_loader = NULL; -#ifdef CHECK_UNHANDLED_OOPS - // This one is always allocated with new, but check it just in case. - Thread *thread = Thread::current(); - if (thread->is_in_stack((address)&_method)) { - thread->allow_unhandled_oop((oop*)&_method); - } -#endif // CHECK_UNHANDLED_OOPS + _class_holder = NULL; } JvmtiBreakpoint::JvmtiBreakpoint(Method* m_method, jlocation location) { _method = m_method; - _class_loader = _method->method_holder()->class_loader_data()->class_loader(); + _class_holder = _method->method_holder()->klass_holder(); +#ifdef CHECK_UNHANDLED_OOPS + // _class_holder can't be wrapped in a Handle, because JvmtiBreakpoints are + // sometimes allocated on the heap. + // + // The code handling JvmtiBreakpoints allocated on the stack can't be + // interrupted by a GC until _class_holder is reachable by the GC via the + // oops_do method. + Thread::current()->allow_unhandled_oop(&_class_holder); +#endif // CHECK_UNHANDLED_OOPS assert(_method != NULL, "_method != NULL"); _bci = (int) location; assert(_bci >= 0, "_bci >= 0"); @@ -245,7 +255,7 @@ void JvmtiBreakpoint::copy(JvmtiBreakpoint& bp) { _method = bp._method; _bci = bp._bci; - _class_loader = bp._class_loader; + _class_holder = bp._class_holder; } bool JvmtiBreakpoint::lessThan(JvmtiBreakpoint& bp) { @@ -363,6 +373,13 @@ } } +void VM_ChangeBreakpoints::metadata_do(void f(Metadata*)) { + // Walk metadata in breakpoints to keep from being deallocated with RedefineClasses + if (_bp != NULL) { + _bp->metadata_do(f); + } +} + // // class JvmtiBreakpoints // @@ -379,6 +396,10 @@ _bps.oops_do(f); } +void JvmtiBreakpoints::metadata_do(void f(Metadata*)) { + _bps.metadata_do(f); +} + void JvmtiBreakpoints::gc_epilogue() { _bps.gc_epilogue(); } @@ -497,6 +518,12 @@ } } +void JvmtiCurrentBreakpoints::metadata_do(void f(Metadata*)) { + if (_jvmti_breakpoints != NULL) { + _jvmti_breakpoints->metadata_do(f); + } +} + void JvmtiCurrentBreakpoints::gc_epilogue() { if (_jvmti_breakpoints != NULL) { _jvmti_breakpoints->gc_epilogue();