コード例 #1
0
void VM_EnterInterpOnlyMode::doit() {
  // Set up the current stack depth for later tracking
  _state->invalidate_cur_stack_depth();

  _state->enter_interp_only_mode();

  JavaThread *thread = _state->get_thread();
  if (thread->has_last_Java_frame()) {
    // If running in fullspeed mode, single stepping is implemented
    // as follows: first, the interpreter does not dispatch to
    // compiled code for threads that have single stepping enabled;
    // second, we deoptimize all methods on the thread's stack when
    // interpreted-only mode is enabled the first time for a given
    // thread (nothing to do if no Java frames yet).
    int num_marked = 0;
    ResourceMark resMark;
    RegisterMap rm(thread, false);
    for (vframe* vf = thread->last_java_vframe(&rm); vf; vf = vf->sender()) {
      if (can_be_deoptimized(vf)) {
        ((compiledVFrame*) vf)->code()->mark_for_deoptimization();
        ++num_marked;
      }
    }
    if (num_marked > 0) {
      VM_Deoptimize op;
      VMThread::execute(&op);
    }
  }
}
コード例 #2
0
ファイル: interfaceSupport.cpp プロジェクト: gaoxiaojun/dync
void InterfaceSupport::walk_stack() {
  JavaThread* thread = JavaThread::current();
  walk_stack_counter++;
  if (!thread->has_last_Java_frame()) return;
  ResourceMark rm(thread);
  RegisterMap reg_map(thread);
  walk_stack_from(thread->last_java_vframe(&reg_map));
}
コード例 #3
0
 void doit() {
   ResourceMark rmark; // _thread != Thread::current()
   RegisterMap rm(_thread, false);
   javaVFrame* vf = _thread->last_java_vframe(&rm);
   assert(vf != NULL, "must have last java frame");
   methodOop method = vf->method();
   _method_id = method->jmethod_id();
   _bci = vf->bci();
 }
コード例 #4
0
ファイル: biasedLocking.cpp プロジェクト: gaoxiaojun/dync
void BiasedLocking::preserve_marks() {
  if (!UseBiasedLocking)
    return;

  assert(SafepointSynchronize::is_at_safepoint(), "must only be called while at safepoint");

  assert(_preserved_oop_stack  == NULL, "double initialization");
  assert(_preserved_mark_stack == NULL, "double initialization");

  // In order to reduce the number of mark words preserved during GC
  // due to the presence of biased locking, we reinitialize most mark
  // words to the class's prototype during GC -- even those which have
  // a currently valid bias owner. One important situation where we
  // must not clobber a bias is when a biased object is currently
  // locked. To handle this case we iterate over the currently-locked
  // monitors in a prepass and, if they are biased, preserve their
  // mark words here. This should be a relatively small set of objects
  // especially compared to the number of objects in the heap.
  _preserved_mark_stack = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<markOop>(10, true);
  _preserved_oop_stack = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<Handle>(10, true);

  ResourceMark rm;
  Thread* cur = Thread::current();
  for (JavaThread* thread = Threads::first(); thread != NULL; thread = thread->next()) {
    if (thread->has_last_Java_frame()) {
      RegisterMap rm(thread);
      for (javaVFrame* vf = thread->last_java_vframe(&rm); vf != NULL; vf = vf->java_sender()) {
        GrowableArray<MonitorInfo*> *monitors = vf->monitors();
        if (monitors != NULL) {
          int len = monitors->length();
          // Walk monitors youngest to oldest
          for (int i = len - 1; i >= 0; i--) {
            MonitorInfo* mon_info = monitors->at(i);
            if (mon_info->owner_is_scalar_replaced()) continue;
            oop owner = mon_info->owner();
            if (owner != NULL) {
              markOop mark = owner->mark();
              if (mark->has_bias_pattern()) {
                _preserved_oop_stack->push(Handle(cur, owner));
                _preserved_mark_stack->push(mark);
              }
            }
          }
        }
      }
    }
  }
}
コード例 #5
0
 void doit() {
   ResourceMark rmark; // _thread != Thread::current()
   RegisterMap rm(_thread, false);
   // There can be a race condition between a VM_Operation reaching a safepoint
   // and the target thread exiting from Java execution.
   // We must recheck the last Java frame still exists.
   if (!_thread->is_exiting() && _thread->has_last_Java_frame()) {
     javaVFrame* vf = _thread->last_java_vframe(&rm);
     assert(vf != NULL, "must have last java frame");
     Method* method = vf->method();
     _method_id = method->jmethod_id();
     _bci = vf->bci();
   } else {
     // Clear current location as the target thread has no Java frames anymore.
     _method_id = (jmethodID)NULL;
     _bci = 0;
   }
 }