mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-18 18:14:38 +02:00
8262134: compiler/uncommontrap/TestDeoptOOM.java failed with "guarantee(false) failed: wrong number of expression stack elements during deopt"
Reviewed-by: kvn, iveresov
This commit is contained in:
parent
c93b24d852
commit
32139c1a8a
5 changed files with 22 additions and 7 deletions
|
@ -191,7 +191,8 @@ CodeEmitInfo::CodeEmitInfo(ValueStack* stack, XHandlers* exception_handlers, boo
|
||||||
, _oop_map(NULL)
|
, _oop_map(NULL)
|
||||||
, _stack(stack)
|
, _stack(stack)
|
||||||
, _is_method_handle_invoke(false)
|
, _is_method_handle_invoke(false)
|
||||||
, _deoptimize_on_exception(deoptimize_on_exception) {
|
, _deoptimize_on_exception(deoptimize_on_exception)
|
||||||
|
, _force_reexecute(false) {
|
||||||
assert(_stack != NULL, "must be non null");
|
assert(_stack != NULL, "must be non null");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,7 +204,8 @@ CodeEmitInfo::CodeEmitInfo(CodeEmitInfo* info, ValueStack* stack)
|
||||||
, _oop_map(NULL)
|
, _oop_map(NULL)
|
||||||
, _stack(stack == NULL ? info->_stack : stack)
|
, _stack(stack == NULL ? info->_stack : stack)
|
||||||
, _is_method_handle_invoke(info->_is_method_handle_invoke)
|
, _is_method_handle_invoke(info->_is_method_handle_invoke)
|
||||||
, _deoptimize_on_exception(info->_deoptimize_on_exception) {
|
, _deoptimize_on_exception(info->_deoptimize_on_exception)
|
||||||
|
, _force_reexecute(info->_force_reexecute) {
|
||||||
|
|
||||||
// deep copy of exception handlers
|
// deep copy of exception handlers
|
||||||
if (info->_exception_handlers != NULL) {
|
if (info->_exception_handlers != NULL) {
|
||||||
|
@ -215,7 +217,8 @@ CodeEmitInfo::CodeEmitInfo(CodeEmitInfo* info, ValueStack* stack)
|
||||||
void CodeEmitInfo::record_debug_info(DebugInformationRecorder* recorder, int pc_offset) {
|
void CodeEmitInfo::record_debug_info(DebugInformationRecorder* recorder, int pc_offset) {
|
||||||
// record the safepoint before recording the debug info for enclosing scopes
|
// record the safepoint before recording the debug info for enclosing scopes
|
||||||
recorder->add_safepoint(pc_offset, _oop_map->deep_copy());
|
recorder->add_safepoint(pc_offset, _oop_map->deep_copy());
|
||||||
_scope_debug_info->record_debug_info(recorder, pc_offset, true/*topmost*/, _is_method_handle_invoke);
|
bool reexecute = _force_reexecute || _scope_debug_info->should_reexecute();
|
||||||
|
_scope_debug_info->record_debug_info(recorder, pc_offset, reexecute, _is_method_handle_invoke);
|
||||||
recorder->end_safepoint(pc_offset);
|
recorder->end_safepoint(pc_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -232,16 +232,15 @@ class IRScopeDebugInfo: public CompilationResourceObj {
|
||||||
//Whether we should reexecute this bytecode for deopt
|
//Whether we should reexecute this bytecode for deopt
|
||||||
bool should_reexecute();
|
bool should_reexecute();
|
||||||
|
|
||||||
void record_debug_info(DebugInformationRecorder* recorder, int pc_offset, bool topmost, bool is_method_handle_invoke = false) {
|
void record_debug_info(DebugInformationRecorder* recorder, int pc_offset, bool reexecute, bool is_method_handle_invoke = false) {
|
||||||
if (caller() != NULL) {
|
if (caller() != NULL) {
|
||||||
// Order is significant: Must record caller first.
|
// Order is significant: Must record caller first.
|
||||||
caller()->record_debug_info(recorder, pc_offset, false/*topmost*/);
|
caller()->record_debug_info(recorder, pc_offset, false/*reexecute*/);
|
||||||
}
|
}
|
||||||
DebugToken* locvals = recorder->create_scope_values(locals());
|
DebugToken* locvals = recorder->create_scope_values(locals());
|
||||||
DebugToken* expvals = recorder->create_scope_values(expressions());
|
DebugToken* expvals = recorder->create_scope_values(expressions());
|
||||||
DebugToken* monvals = recorder->create_monitor_values(monitors());
|
DebugToken* monvals = recorder->create_monitor_values(monitors());
|
||||||
// reexecute allowed only for the topmost frame
|
// reexecute allowed only for the topmost frame
|
||||||
bool reexecute = topmost ? should_reexecute() : false;
|
|
||||||
bool return_oop = false; // This flag will be ignored since it used only for C2 with escape analysis.
|
bool return_oop = false; // This flag will be ignored since it used only for C2 with escape analysis.
|
||||||
bool rethrow_exception = false;
|
bool rethrow_exception = false;
|
||||||
bool is_opt_native = false;
|
bool is_opt_native = false;
|
||||||
|
@ -264,6 +263,7 @@ class CodeEmitInfo: public CompilationResourceObj {
|
||||||
ValueStack* _stack; // used by deoptimization (contains also monitors
|
ValueStack* _stack; // used by deoptimization (contains also monitors
|
||||||
bool _is_method_handle_invoke; // true if the associated call site is a MethodHandle call site.
|
bool _is_method_handle_invoke; // true if the associated call site is a MethodHandle call site.
|
||||||
bool _deoptimize_on_exception;
|
bool _deoptimize_on_exception;
|
||||||
|
bool _force_reexecute; // force the reexecute flag on, used for patching stub
|
||||||
|
|
||||||
FrameMap* frame_map() const { return scope()->compilation()->frame_map(); }
|
FrameMap* frame_map() const { return scope()->compilation()->frame_map(); }
|
||||||
Compilation* compilation() const { return scope()->compilation(); }
|
Compilation* compilation() const { return scope()->compilation(); }
|
||||||
|
@ -290,7 +290,11 @@ class CodeEmitInfo: public CompilationResourceObj {
|
||||||
bool is_method_handle_invoke() const { return _is_method_handle_invoke; }
|
bool is_method_handle_invoke() const { return _is_method_handle_invoke; }
|
||||||
void set_is_method_handle_invoke(bool x) { _is_method_handle_invoke = x; }
|
void set_is_method_handle_invoke(bool x) { _is_method_handle_invoke = x; }
|
||||||
|
|
||||||
|
bool force_reexecute() const { return _force_reexecute; }
|
||||||
|
void set_force_reexecute() { _force_reexecute = true; }
|
||||||
|
|
||||||
int interpreter_frame_size() const;
|
int interpreter_frame_size() const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@ void LIR_Assembler::patching_epilog(PatchingStub* patch, LIR_PatchCode patch_cod
|
||||||
while ((intx) _masm->pc() - (intx) patch->pc_start() < NativeGeneralJump::instruction_size) {
|
while ((intx) _masm->pc() - (intx) patch->pc_start() < NativeGeneralJump::instruction_size) {
|
||||||
_masm->nop();
|
_masm->nop();
|
||||||
}
|
}
|
||||||
|
info->set_force_reexecute();
|
||||||
patch->install(_masm, patch_code, obj, info);
|
patch->install(_masm, patch_code, obj, info);
|
||||||
append_code_stub(patch);
|
append_code_stub(patch);
|
||||||
|
|
||||||
|
|
|
@ -798,6 +798,7 @@ JRT_LEAF(BasicType, Deoptimization::unpack_frames(JavaThread* thread, int exec_m
|
||||||
// at an uncommon trap for an invoke (where the compiler
|
// at an uncommon trap for an invoke (where the compiler
|
||||||
// generates debug info before the invoke has executed)
|
// generates debug info before the invoke has executed)
|
||||||
Bytecodes::Code cur_code = str.next();
|
Bytecodes::Code cur_code = str.next();
|
||||||
|
Bytecodes::Code next_code = Bytecodes::_shouldnotreachhere;
|
||||||
if (Bytecodes::is_invoke(cur_code)) {
|
if (Bytecodes::is_invoke(cur_code)) {
|
||||||
Bytecode_invoke invoke(mh, iframe->interpreter_frame_bci());
|
Bytecode_invoke invoke(mh, iframe->interpreter_frame_bci());
|
||||||
cur_invoke_parameter_size = invoke.size_of_parameters();
|
cur_invoke_parameter_size = invoke.size_of_parameters();
|
||||||
|
@ -806,7 +807,7 @@ JRT_LEAF(BasicType, Deoptimization::unpack_frames(JavaThread* thread, int exec_m
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (str.bci() < max_bci) {
|
if (str.bci() < max_bci) {
|
||||||
Bytecodes::Code next_code = str.next();
|
next_code = str.next();
|
||||||
if (next_code >= 0) {
|
if (next_code >= 0) {
|
||||||
// The interpreter oop map generator reports results before
|
// The interpreter oop map generator reports results before
|
||||||
// the current bytecode has executed except in the case of
|
// the current bytecode has executed except in the case of
|
||||||
|
@ -854,6 +855,10 @@ JRT_LEAF(BasicType, Deoptimization::unpack_frames(JavaThread* thread, int exec_m
|
||||||
// Print out some information that will help us debug the problem
|
// Print out some information that will help us debug the problem
|
||||||
tty->print_cr("Wrong number of expression stack elements during deoptimization");
|
tty->print_cr("Wrong number of expression stack elements during deoptimization");
|
||||||
tty->print_cr(" Error occurred while verifying frame %d (0..%d, 0 is topmost)", i, cur_array->frames() - 1);
|
tty->print_cr(" Error occurred while verifying frame %d (0..%d, 0 is topmost)", i, cur_array->frames() - 1);
|
||||||
|
tty->print_cr(" Current code %s", Bytecodes::name(cur_code));
|
||||||
|
if (try_next_mask) {
|
||||||
|
tty->print_cr(" Next code %s", Bytecodes::name(next_code));
|
||||||
|
}
|
||||||
tty->print_cr(" Fabricated interpreter frame had %d expression stack elements",
|
tty->print_cr(" Fabricated interpreter frame had %d expression stack elements",
|
||||||
iframe->interpreter_frame_expression_stack_size());
|
iframe->interpreter_frame_expression_stack_size());
|
||||||
tty->print_cr(" Interpreter oop map had %d expression stack elements", mask.expression_stack_size());
|
tty->print_cr(" Interpreter oop map had %d expression stack elements", mask.expression_stack_size());
|
||||||
|
|
|
@ -24,10 +24,12 @@
|
||||||
/*
|
/*
|
||||||
* @test
|
* @test
|
||||||
* @bug 8174954
|
* @bug 8174954
|
||||||
|
* @bug 8262134
|
||||||
* @library /test/lib
|
* @library /test/lib
|
||||||
* @modules java.base/jdk.internal.org.objectweb.asm
|
* @modules java.base/jdk.internal.org.objectweb.asm
|
||||||
* @compile -XDignore.symbol.file BSMCalledTwice.java
|
* @compile -XDignore.symbol.file BSMCalledTwice.java
|
||||||
* @run main BSMCalledTwice
|
* @run main BSMCalledTwice
|
||||||
|
* @run main/othervm -Xcomp -XX:CompileCommand=compileonly,TestC::* -XX:+DeoptimizeALot -XX:+VerifyStack BSMCalledTwice
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue