< prev index next >

src/hotspot/share/services/threadService.cpp

Print this page
*** 21,10 ***
--- 21,11 ---
   * questions.
   *
   */
  
  #include "precompiled.hpp"
+ #include "classfile/javaClasses.inline.hpp"
  #include "classfile/systemDictionary.hpp"
  #include "classfile/vmClasses.hpp"
  #include "classfile/vmSymbols.hpp"
  #include "gc/shared/oopStorageSet.hpp"
  #include "memory/allocation.hpp"

*** 570,10 ***
--- 571,11 ---
  StackFrameInfo::StackFrameInfo(javaVFrame* jvf, bool with_lock_info) {
    _method = jvf->method();
    _bci = jvf->bci();
    _class_holder = OopHandle(_thread_service_storage, _method->method_holder()->klass_holder());
    _locked_monitors = NULL;
+   _cont_scope_name = OopHandle(_thread_service_storage, (jvf->continuation() != NULL) ? jdk_internal_vm_ContinuationScope::name(jdk_internal_vm_Continuation::scope(jvf->continuation())) : (oop)NULL);
    if (with_lock_info) {
      Thread* current_thread = Thread::current();
      ResourceMark rm(current_thread);
      HandleMark hm(current_thread);
      GrowableArray<MonitorInfo*>* list = jvf->locked_monitors();

*** 595,10 ***
--- 597,11 ---
        _locked_monitors->at(i).release(_thread_service_storage);
      }
      delete _locked_monitors;
    }
    _class_holder.release(_thread_service_storage);
+   _cont_scope_name.release(_thread_service_storage);
  }
  
  void StackFrameInfo::metadata_do(void f(Metadata*)) {
    f(_method);
  }

*** 657,16 ***
      }
      delete _jni_locked_monitors;
    }
  }
  
! void ThreadStackTrace::dump_stack_at_safepoint(int maxDepth) {
    assert(SafepointSynchronize::is_at_safepoint(), "all threads are stopped");
  
    if (_thread->has_last_Java_frame()) {
!     RegisterMap reg_map(_thread);
!     vframe* start_vf = _thread->last_java_vframe(&reg_map);
      int count = 0;
      for (vframe* f = start_vf; f; f = f->sender() ) {
        if (maxDepth >= 0 && count == maxDepth) {
          // Skip frames if more than maxDepth
          break;
--- 660,19 ---
      }
      delete _jni_locked_monitors;
    }
  }
  
! void ThreadStackTrace::dump_stack_at_safepoint(int maxDepth, bool full) {
    assert(SafepointSynchronize::is_at_safepoint(), "all threads are stopped");
  
    if (_thread->has_last_Java_frame()) {
!     RegisterMap reg_map(_thread, true, false);
! 
+     vframe* start_vf = !full && _thread->last_continuation(java_lang_VirtualThread::vthread_scope()) != NULL
+       ? _thread->vthread_carrier_last_java_vframe(&reg_map)
+       : _thread->last_java_vframe(&reg_map);
      int count = 0;
      for (vframe* f = start_vf; f; f = f->sender() ) {
        if (maxDepth >= 0 && count == maxDepth) {
          // Skip frames if more than maxDepth
          break;

*** 719,11 ***
    objArrayOop ste = oopFactory::new_objArray(ik, _depth, CHECK_NH);
    objArrayHandle backtrace(THREAD, ste);
    for (int j = 0; j < _depth; j++) {
      StackFrameInfo* frame = _frames->at(j);
      methodHandle mh(THREAD, frame->method());
!     oop element = java_lang_StackTraceElement::create(mh, frame->bci(), CHECK_NH);
      backtrace->obj_at_put(j, element);
    }
    return backtrace;
  }
  
--- 725,12 ---
    objArrayOop ste = oopFactory::new_objArray(ik, _depth, CHECK_NH);
    objArrayHandle backtrace(THREAD, ste);
    for (int j = 0; j < _depth; j++) {
      StackFrameInfo* frame = _frames->at(j);
      methodHandle mh(THREAD, frame->method());
!     Handle contScopeNameH(THREAD, frame->cont_scope_name().resolve());
+     oop element = java_lang_StackTraceElement::create(mh, frame->bci(), contScopeNameH, CHECK_NH);
      backtrace->obj_at_put(j, element);
    }
    return backtrace;
  }
  

*** 934,13 ***
  
    delete _stack_trace;
    delete _concurrent_locks;
  }
  
! void ThreadSnapshot::dump_stack_at_safepoint(int max_depth, bool with_locked_monitors) {
    _stack_trace = new ThreadStackTrace(_thread, with_locked_monitors);
!   _stack_trace->dump_stack_at_safepoint(max_depth);
  }
  
  
  void ThreadSnapshot::metadata_do(void f(Metadata*)) {
    if (_stack_trace != NULL) {
--- 941,13 ---
  
    delete _stack_trace;
    delete _concurrent_locks;
  }
  
! void ThreadSnapshot::dump_stack_at_safepoint(int max_depth, bool with_locked_monitors, bool full) {
    _stack_trace = new ThreadStackTrace(_thread, with_locked_monitors);
!   _stack_trace->dump_stack_at_safepoint(max_depth, full);
  }
  
  
  void ThreadSnapshot::metadata_do(void f(Metadata*)) {
    if (_stack_trace != NULL) {
< prev index next >