comparison src/share/vm/prims/jvmtiImpl.cpp @ 12983:2fab5b7e6140

8025834: NPE in Parallel Scavenge with -XX:+CheckUnhandledOops Reviewed-by: coleenp, mgerdin, sspitsyn
author ehelin
date Mon, 21 Oct 2013 14:20:47 +0200
parents 4f9a42c33738
children 910026b800b8
comparison
equal deleted inserted replaced
12982:3dd24766da44 12983:2fab5b7e6140
223 223
224 JvmtiBreakpoint::JvmtiBreakpoint() { 224 JvmtiBreakpoint::JvmtiBreakpoint() {
225 _method = NULL; 225 _method = NULL;
226 _bci = 0; 226 _bci = 0;
227 _class_loader = NULL; 227 _class_loader = NULL;
228 #ifdef CHECK_UNHANDLED_OOPS
229 // This one is always allocated with new, but check it just in case.
230 Thread *thread = Thread::current();
231 if (thread->is_in_stack((address)&_method)) {
232 thread->allow_unhandled_oop((oop*)&_method);
233 }
234 #endif // CHECK_UNHANDLED_OOPS
235 } 228 }
236 229
237 JvmtiBreakpoint::JvmtiBreakpoint(Method* m_method, jlocation location) { 230 JvmtiBreakpoint::JvmtiBreakpoint(Method* m_method, jlocation location) {
238 _method = m_method; 231 _method = m_method;
239 _class_loader = _method->method_holder()->class_loader_data()->class_loader(); 232 _class_loader = _method->method_holder()->class_loader_data()->class_loader();
233 #ifdef CHECK_UNHANDLED_OOPS
234 // _class_loader can't be wrapped in a Handle, because JvmtiBreakpoint:s are
235 // eventually allocated on the heap.
236 //
237 // The code handling JvmtiBreakpoint:s allocated on the stack can't be
238 // interrupted by a GC until _class_loader is reachable by the GC via the
239 // oops_do method.
240 Thread::current()->allow_unhandled_oop(&_class_loader);
241 #endif // CHECK_UNHANDLED_OOPS
240 assert(_method != NULL, "_method != NULL"); 242 assert(_method != NULL, "_method != NULL");
241 _bci = (int) location; 243 _bci = (int) location;
242 assert(_bci >= 0, "_bci >= 0"); 244 assert(_bci >= 0, "_bci >= 0");
243 } 245 }
244 246