mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-25 15:37:52 +01:00
improve error handling in the BranchManager
This commit is contained in:
parent
ea2a179161
commit
432168f002
@ -1197,10 +1197,10 @@ class BranchManger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( startBlock != null && startBlock.getOperation() == WasmBlockOperator.IF ) {
|
if( startBlock != null && startBlock.getOperation() == WasmBlockOperator.IF ) {
|
||||||
|
try {
|
||||||
ArrayDeque<AnyType> stack = new ArrayDeque<>();
|
ArrayDeque<AnyType> stack = new ArrayDeque<>();
|
||||||
stack.push( ValueType.empty );
|
stack.push( ValueType.empty );
|
||||||
INSTRUCTIONS:
|
INSTRUCTIONS: for( int i = startIdx; i < instructions.size(); i++ ) {
|
||||||
for( int i = startIdx; i < instructions.size(); i++ ) {
|
|
||||||
WasmInstruction instr = instructions.get( i );
|
WasmInstruction instr = instructions.get( i );
|
||||||
int codePos = instr.getCodePosition();
|
int codePos = instr.getCodePosition();
|
||||||
if( codePos >= endPos ) {
|
if( codePos >= endPos ) {
|
||||||
@ -1233,6 +1233,9 @@ class BranchManger {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
startBlock.setData( stack.pop() );
|
startBlock.setData( stack.pop() );
|
||||||
|
} catch( Throwable th ) {
|
||||||
|
throw WasmException.create( th, startBlock.getLineNumber() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user