hotspot/src/share/vm/prims/jvmtiEnvThreadState.cpp
changeset 21914 b60984ed653b
parent 13728 882756847a04
child 22234 da823d78ad65
equal deleted inserted replaced
21912:8d2924674592 21914:b60984ed653b
   267    }
   267    }
   268   VMOp_Type type() const { return VMOp_GetCurrentLocation; }
   268   VMOp_Type type() const { return VMOp_GetCurrentLocation; }
   269   void doit() {
   269   void doit() {
   270     ResourceMark rmark; // _thread != Thread::current()
   270     ResourceMark rmark; // _thread != Thread::current()
   271     RegisterMap rm(_thread, false);
   271     RegisterMap rm(_thread, false);
   272     javaVFrame* vf = _thread->last_java_vframe(&rm);
   272     // There can be a race condition between a VM_Operation reaching a safepoint
   273     assert(vf != NULL, "must have last java frame");
   273     // and the target thread exiting from Java execution.
   274     Method* method = vf->method();
   274     // We must recheck the last Java frame still exists.
   275     _method_id = method->jmethod_id();
   275     if (_thread->has_last_Java_frame()) {
   276     _bci = vf->bci();
   276       javaVFrame* vf = _thread->last_java_vframe(&rm);
       
   277       assert(vf != NULL, "must have last java frame");
       
   278       Method* method = vf->method();
       
   279       _method_id = method->jmethod_id();
       
   280       _bci = vf->bci();
       
   281     } else {
       
   282       // Clear current location as the target thread has no Java frames anymore.
       
   283       _method_id = (jmethodID)NULL;
       
   284       _bci = 0;
       
   285     }
   277   }
   286   }
   278   void get_current_location(jmethodID *method_id, int *bci) {
   287   void get_current_location(jmethodID *method_id, int *bci) {
   279     *method_id = _method_id;
   288     *method_id = _method_id;
   280     *bci = _bci;
   289     *bci = _bci;
   281   }
   290   }