Mon, 21 Oct 2013 14:20:47 +0200
8025834: NPE in Parallel Scavenge with -XX:+CheckUnhandledOops
Reviewed-by: coleenp, mgerdin, sspitsyn
src/share/vm/prims/jvmtiImpl.cpp | file | annotate | diff | comparison | revisions |
1.1 --- a/src/share/vm/prims/jvmtiImpl.cpp Mon Oct 21 01:04:01 2013 -0700 1.2 +++ b/src/share/vm/prims/jvmtiImpl.cpp Mon Oct 21 14:20:47 2013 +0200 1.3 @@ -225,18 +225,20 @@ 1.4 _method = NULL; 1.5 _bci = 0; 1.6 _class_loader = NULL; 1.7 -#ifdef CHECK_UNHANDLED_OOPS 1.8 - // This one is always allocated with new, but check it just in case. 1.9 - Thread *thread = Thread::current(); 1.10 - if (thread->is_in_stack((address)&_method)) { 1.11 - thread->allow_unhandled_oop((oop*)&_method); 1.12 - } 1.13 -#endif // CHECK_UNHANDLED_OOPS 1.14 } 1.15 1.16 JvmtiBreakpoint::JvmtiBreakpoint(Method* m_method, jlocation location) { 1.17 _method = m_method; 1.18 _class_loader = _method->method_holder()->class_loader_data()->class_loader(); 1.19 +#ifdef CHECK_UNHANDLED_OOPS 1.20 + // _class_loader can't be wrapped in a Handle, because JvmtiBreakpoint:s are 1.21 + // eventually allocated on the heap. 1.22 + // 1.23 + // The code handling JvmtiBreakpoint:s allocated on the stack can't be 1.24 + // interrupted by a GC until _class_loader is reachable by the GC via the 1.25 + // oops_do method. 1.26 + Thread::current()->allow_unhandled_oop(&_class_loader); 1.27 +#endif // CHECK_UNHANDLED_OOPS 1.28 assert(_method != NULL, "_method != NULL"); 1.29 _bci = (int) location; 1.30 assert(_bci >= 0, "_bci >= 0");