< prev index next >

src/hotspot/share/runtime/thread.cpp

Print this page

        

@@ -1684,10 +1684,11 @@
   set_vm_result(NULL);
   set_vm_result_2(NULL);
   set_vframe_array_head(NULL);
   set_vframe_array_last(NULL);
   set_deferred_locals(NULL);
+  set_keepalive_cleanup(new (ResourceObj::C_HEAP, mtInternal) GrowableArray<WeakHandle<vm_nmethod_keepalive_data> >(16, true));
   set_deopt_mark(NULL);
   set_deopt_compiled_method(NULL);
   clear_must_deopt_id();
   set_monitor_chunks(NULL);
   _on_thread_list = false;

@@ -1696,10 +1697,11 @@
   _array_for_gc = NULL;
   _suspend_equivalent = false;
   _in_deopt_handler = 0;
   _doing_unsafe_access = false;
   _stack_guard_state = stack_guard_unused;
+  DEBUG_ONLY(_continuation = NULL;)
 #if INCLUDE_JVMCI
   _pending_monitorenter = false;
   _pending_deoptimization = -1;
   _pending_failed_speculation = 0;
   _pending_transfer_to_interpreter = false;

@@ -1728,10 +1730,15 @@
   _pending_jni_exception_check_fn = NULL;
   _do_not_unlock_if_synchronized = false;
   _cached_monitor_info = NULL;
   _parker = Parker::Allocate(this);
 
+  _cont_yield = false;
+  _cont_preempt = false;
+  _cont_fastpath = 0;
+  memset(&_cont_frame, 0, sizeof(FrameInfo));
+
 #ifndef PRODUCT
   _jmp_ring_index = 0;
   for (int ji = 0; ji < jump_ring_buffer_size; ji++) {
     record_jump(NULL, NULL, NULL, 0);
   }

@@ -2360,10 +2367,18 @@
   // so check for other async requests.
   if (check_asyncs) {
     check_and_handle_async_exceptions();
   }
 
+  if (is_cont_force_yield()) {
+    log_develop_trace(jvmcont)("handle_special_runtime_exit_condition is_cont_force_yield: %d check_asyncs: %d", is_cont_force_yield(), check_asyncs);
+    if (check_asyncs) { // TODO: we should probably be even more selective than that
+      // we need this only for interpreted frames -- for compiled frames we install a return barrier on the safepoint stub in Continuation::try_force_yield
+      StubRoutines::cont_jump_from_sp_C()();
+    }
+  }
+
   JFR_ONLY(SUSPEND_THREAD_CONDITIONAL(this);)
 }
 
 void JavaThread::send_thread_stop(oop java_throwable)  {
   assert(Thread::current()->is_VM_thread(), "should be in the vm thread");

@@ -3049,10 +3064,13 @@
   st->print_cr("   JavaThread state: %s", _get_thread_state_name(_thread_state));
 };
 void JavaThread::print_thread_state() const {
   print_thread_state_on(tty);
 }
+const char* JavaThread::thread_state_name() const {
+  return _get_thread_state_name(_thread_state);
+}
 #endif // PRODUCT
 
 // Called by Threads::print() for VM_PrintThreads operation
 void JavaThread::print_on(outputStream *st, bool print_extended_info) const {
   st->print_raw("\"");

@@ -3373,14 +3391,15 @@
 void JavaThread::print_frame_layout(int depth, bool validate_only) {
   ResourceMark rm;
   PRESERVE_EXCEPTION_MARK;
   FrameValues values;
   int frame_no = 0;
-  for (StackFrameStream fst(this, false); !fst.is_done(); fst.next()) {
-    fst.current()->describe(values, ++frame_no);
+  for (StackFrameStream fst(this, false, true); !fst.is_done(); fst.next()) {
+    fst.current()->describe(values, ++frame_no, fst.register_map());
     if (depth == frame_no) break;
   }
+  Continuation::describe(values);
   if (validate_only) {
     values.validate();
   } else {
     tty->print_cr("[Describe stack layout]");
     values.print(this);

@@ -3407,11 +3426,11 @@
 
 void JavaThread::trace_stack() {
   if (!has_last_Java_frame()) return;
   ResourceMark rm;
   HandleMark   hm;
-  RegisterMap reg_map(this);
+  RegisterMap reg_map(this, true, true);
   trace_stack_from(last_java_vframe(&reg_map));
 }
 
 
 #endif // PRODUCT

@@ -3424,10 +3443,15 @@
     if (vf->is_java_frame()) return javaVFrame::cast(vf);
   }
   return NULL;
 }
 
+oop JavaThread::last_continuation() {
+  if (threadObj() == (oop)NULL) return (oop)NULL; // happens during initialization
+  
+  return java_lang_Thread::continuation(threadObj());
+}
 
 Klass* JavaThread::security_get_caller_class(int depth) {
   vframeStream vfst(this);
   vfst.security_get_caller_frame(depth);
   if (!vfst.at_end()) {
< prev index next >