6986270: guarantee(*bcp != Bytecodes::_monitorenter || exec_mode != Deoptimization::Unpack_exception) fails
Summary: Propagate the compiler type of the deopting method to vframeArrayElement::unpack_on_stack()
Reviewed-by: jrose, never
--- a/hotspot/src/share/vm/runtime/deoptimization.cpp Wed Sep 15 20:25:37 2010 -0700
+++ b/hotspot/src/share/vm/runtime/deoptimization.cpp Tue Sep 21 13:38:35 2010 -0700
@@ -124,6 +124,9 @@
RegisterMap dummy_map(thread, false);
// Now get the deoptee with a valid map
frame deoptee = stub_frame.sender(&map);
+ // Set the deoptee nmethod
+ assert(thread->deopt_nmethod() == NULL, "Pending deopt!");
+ thread->set_deopt_nmethod(deoptee.cb()->as_nmethod_or_null());
// Create a growable array of VFrames where each VFrame represents an inlined
// Java frame. This storage is allocated with the usual system arena.
@@ -445,6 +448,7 @@
delete thread->deopt_mark();
thread->set_deopt_mark(NULL);
+ thread->set_deopt_nmethod(NULL);
if (JvmtiExport::can_pop_frame()) {
--- a/hotspot/src/share/vm/runtime/thread.cpp Wed Sep 15 20:25:37 2010 -0700
+++ b/hotspot/src/share/vm/runtime/thread.cpp Tue Sep 21 13:38:35 2010 -0700
@@ -1183,6 +1183,7 @@
set_vframe_array_last(NULL);
set_deferred_locals(NULL);
set_deopt_mark(NULL);
+ set_deopt_nmethod(NULL);
clear_must_deopt_id();
set_monitor_chunks(NULL);
set_next(NULL);
--- a/hotspot/src/share/vm/runtime/thread.hpp Wed Sep 15 20:25:37 2010 -0700
+++ b/hotspot/src/share/vm/runtime/thread.hpp Tue Sep 21 13:38:35 2010 -0700
@@ -680,7 +680,7 @@
intptr_t* _must_deopt_id; // id of frame that needs to be deopted once we
// transition out of native
-
+ nmethod* _deopt_nmethod; // nmethod that is currently being deoptimized
vframeArray* _vframe_array_head; // Holds the heap of the active vframeArrays
vframeArray* _vframe_array_last; // Holds last vFrameArray we popped
// Because deoptimization is lazy we must save jvmti requests to set locals
@@ -1098,6 +1098,9 @@
void set_must_deopt_id(intptr_t* id) { _must_deopt_id = id; }
void clear_must_deopt_id() { _must_deopt_id = NULL; }
+ void set_deopt_nmethod(nmethod* nm) { _deopt_nmethod = nm; }
+ nmethod* deopt_nmethod() { return _deopt_nmethod; }
+
methodOop callee_target() const { return _callee_target; }
void set_callee_target (methodOop x) { _callee_target = x; }
--- a/hotspot/src/share/vm/runtime/vframeArray.cpp Wed Sep 15 20:25:37 2010 -0700
+++ b/hotspot/src/share/vm/runtime/vframeArray.cpp Tue Sep 21 13:38:35 2010 -0700
@@ -179,9 +179,11 @@
// in which case bcp should point to the monitorenter since it is within the exception's range.
assert(*bcp != Bytecodes::_monitorenter || is_top_frame, "a _monitorenter must be a top frame");
- // TIERED Must know the compiler of the deoptee QQQ
- COMPILER2_PRESENT(guarantee(*bcp != Bytecodes::_monitorenter || exec_mode != Deoptimization::Unpack_exception,
- "shouldn't get exception during monitorenter");)
+ assert(thread->deopt_nmethod() != NULL, "nmethod should be known");
+ guarantee(!(thread->deopt_nmethod()->is_compiled_by_c2() &&
+ *bcp == Bytecodes::_monitorenter &&
+ exec_mode == Deoptimization::Unpack_exception),
+ "shouldn't get exception during monitorenter");
int popframe_preserved_args_size_in_bytes = 0;
int popframe_preserved_args_size_in_words = 0;