After some discussion with Jan, it appears that the reduced test case from comment 5 fails because we don't create a stackmap for the wasm `unreachable` opcode. And the original test case from decoder (which I have now un-obsoleted) also fails because there's no stackmap for the integer divide-by-zero trap. The following ultra-kludge makes both test cases run successfully. As a general fix it seems to me we'd need to create a stackmap for every trap insn we create in debug mode. Maybe we can make `BaseCompiler::trap`, since it can easily enough consult `compilerEnv_.debugEnabled()`. ``` diff --git a/js/src/wasm/WasmBaselineCompile.cpp b/js/src/wasm/WasmBaselineCompile.cpp index dc5950441a..efdfcc0c32 100644 --- a/js/src/wasm/WasmBaselineCompile.cpp +++ b/js/src/wasm/WasmBaselineCompile.cpp @@ -294,6 +294,8 @@ Label nonZero; masm.branchTest32(Assembler::NonZero, rhs, rhs, &nonZero); trap(Trap::IntegerDivideByZero); + (void/*FIXME*/)createStackMap("BC::checkDivideByZero(RegI32)", + HasDebugFrameWithLiveRefs::Maybe); masm.bind(&nonZero); } @@ -10573,6 +10588,10 @@ CHECK(iter_.readUnreachable()); if (!deadCode_) { trap(Trap::Unreachable); + if (!createStackMap("unreachable", + HasDebugFrameWithLiveRefs::Maybe)) { + return false; + } deadCode_ = true; } NEXT(); ```
Bug 2013619 Comment 7 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
After some discussion with Jan, it appears that the reduced test case from comment 5 fails because we don't create a stackmap for the wasm `unreachable` opcode. And the original test case from decoder (which I have now un-obsoleted) also fails because there's no stackmap for the integer divide-by-zero trap. The following ultra-kludge makes both test cases run successfully. As a general fix it seems to me we'd need to create a stackmap for every trap insn we create in debug mode. Maybe we can make `BaseCompiler::trap`, do that, since it can easily enough consult `compilerEnv_.debugEnabled()`. ``` diff --git a/js/src/wasm/WasmBaselineCompile.cpp b/js/src/wasm/WasmBaselineCompile.cpp index dc5950441a..efdfcc0c32 100644 --- a/js/src/wasm/WasmBaselineCompile.cpp +++ b/js/src/wasm/WasmBaselineCompile.cpp @@ -294,6 +294,8 @@ Label nonZero; masm.branchTest32(Assembler::NonZero, rhs, rhs, &nonZero); trap(Trap::IntegerDivideByZero); + (void/*FIXME*/)createStackMap("BC::checkDivideByZero(RegI32)", + HasDebugFrameWithLiveRefs::Maybe); masm.bind(&nonZero); } @@ -10573,6 +10588,10 @@ CHECK(iter_.readUnreachable()); if (!deadCode_) { trap(Trap::Unreachable); + if (!createStackMap("unreachable", + HasDebugFrameWithLiveRefs::Maybe)) { + return false; + } deadCode_ = true; } NEXT(); ```
After some discussion with Jan, it appears that the reduced test case from comment 5 fails because we don't create a stackmap for the wasm `unreachable` opcode. And the original test case from decoder (which I have now un-obsoleted) also fails because there's no stackmap for the integer divide-by-zero trap. The following ultra-kludge makes both test cases run successfully. As a general fix it seems to me we'd need to create a stackmap for every trap insn we create in debug mode. Maybe we can make `BaseCompiler::trap` do that, since it can easily enough consult `compilerEnv_.debugEnabled()`. ``` diff --git a/js/src/wasm/WasmBaselineCompile.cpp b/js/src/wasm/WasmBaselineCompile.cpp index dc5950441a..efdfcc0c32 100644 --- a/js/src/wasm/WasmBaselineCompile.cpp +++ b/js/src/wasm/WasmBaselineCompile.cpp @@ -294,6 +294,8 @@ Label nonZero; masm.branchTest32(Assembler::NonZero, rhs, rhs, &nonZero); trap(Trap::IntegerDivideByZero); + (void/*FIXME*/)createStackMap("BC::checkDivideByZero(RegI32)", + HasDebugFrameWithLiveRefs::Maybe); masm.bind(&nonZero); } @@ -10573,6 +10588,10 @@ CHECK(iter_.readUnreachable()); if (!deadCode_) { trap(Trap::Unreachable); + if (!createStackMap("unreachable", + HasDebugFrameWithLiveRefs::Maybe)) { + return false; + } deadCode_ = true; } NEXT(); ```