< prev index next >

src/hotspot/share/prims/jvmtiThreadState.cpp

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -201,10 +201,11 @@
 
 
 void JvmtiThreadState::enter_interp_only_mode() {
   assert(_thread->get_interp_only_mode() == 0, "entering interp only when mode not zero");
   _thread->increment_interp_only_mode();
+  invalidate_cur_stack_depth();
 }
 
 
 void JvmtiThreadState::leave_interp_only_mode() {
   assert(_thread->get_interp_only_mode() == 1, "leaving interp only when mode not one");

@@ -219,11 +220,11 @@
     "must be current thread or at safepoint");
 
   if (!get_thread()->has_last_Java_frame()) return 0;  // no Java frames
 
   ResourceMark rm;
-  RegisterMap reg_map(get_thread());
+  RegisterMap reg_map(get_thread(), true, true);
   javaVFrame *jvf = get_thread()->last_java_vframe(&reg_map);
   int n = 0;
   while (jvf != NULL) {
     Method* method = jvf->method();
     jvf = jvf->java_sender();

@@ -247,20 +248,32 @@
   if (!is_interp_only_mode()) {
     _cur_stack_depth = UNKNOWN_STACK_DEPTH;
   }
   if (_cur_stack_depth != UNKNOWN_STACK_DEPTH) {
     ++_cur_stack_depth;
+#ifdef ASSERT
+    // heavy weight assert
+    // fiber fixme: remove this before merging loom with main jdk repo
+    jint num_frames = count_frames();
+    assert(_cur_stack_depth == num_frames, "cur_stack_depth out of sync");
+#endif
   }
 }
 
 void JvmtiThreadState::decr_cur_stack_depth() {
   guarantee(JavaThread::current() == get_thread(), "must be current thread");
 
   if (!is_interp_only_mode()) {
     _cur_stack_depth = UNKNOWN_STACK_DEPTH;
   }
   if (_cur_stack_depth != UNKNOWN_STACK_DEPTH) {
+#ifdef ASSERT
+    // heavy weight assert
+    // fiber fixme: remove this before merging loom with main jdk repo
+    jint num_frames = count_frames();
+    assert(_cur_stack_depth == num_frames, "cur_stack_depth out of sync");
+#endif
     --_cur_stack_depth;
     assert(_cur_stack_depth >= 0, "incr/decr_cur_stack_depth mismatch");
   }
 }
 

@@ -270,13 +283,15 @@
     "must be current thread or at safepoint");
 
   if (!is_interp_only_mode() || _cur_stack_depth == UNKNOWN_STACK_DEPTH) {
     _cur_stack_depth = count_frames();
   } else {
+#ifdef ASSERT
     // heavy weight assert
-    assert(_cur_stack_depth == count_frames(),
-           "cur_stack_depth out of sync");
+    jint num_frames = count_frames();
+    assert(_cur_stack_depth == num_frames, "cur_stack_depth out of sync");
+#endif
   }
   return _cur_stack_depth;
 }
 
 bool JvmtiThreadState::may_be_walked() {
< prev index next >