improve error handling in the BranchManager

This commit is contained in:
Volker Berlin 2020-04-10 13:40:55 +02:00
parent ea2a179161
commit 432168f002

View File

@ -1197,10 +1197,10 @@ class BranchManger {
}
if( startBlock != null && startBlock.getOperation() == WasmBlockOperator.IF ) {
try {
ArrayDeque<AnyType> stack = new ArrayDeque<>();
stack.push( ValueType.empty );
INSTRUCTIONS:
for( int i = startIdx; i < instructions.size(); i++ ) {
INSTRUCTIONS: for( int i = startIdx; i < instructions.size(); i++ ) {
WasmInstruction instr = instructions.get( i );
int codePos = instr.getCodePosition();
if( codePos >= endPos ) {
@ -1233,6 +1233,9 @@ class BranchManger {
}
}
startBlock.setData( stack.pop() );
} catch( Throwable th ) {
throw WasmException.create( th, startBlock.getLineNumber() );
}
}
}