mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-15 02:44:47 +01:00
Update the exception handling support to the current proposal
This commit is contained in:
parent
cf7e66901d
commit
d3261149e6
@ -1342,6 +1342,7 @@ public class BinaryModuleWriter extends ModuleWriter implements InstructionOpcod
|
||||
case CATCH:
|
||||
if( options.useEH() ) {
|
||||
codeStream.writeOpCode( CATCH );
|
||||
codeStream.writeVaruint32( (Integer)data );
|
||||
} else {
|
||||
codeStream.writeOpCode( BR );
|
||||
codeStream.writeVaruint32( 0 );
|
||||
|
@ -978,7 +978,7 @@ class BranchManger {
|
||||
parent.add( tryNode );
|
||||
calculate( tryNode, parsedOperations.subList( 0, idx ) );
|
||||
|
||||
BranchNode catchNode = new BranchNode( catchPos, endPos, WasmBlockOperator.CATCH, WasmBlockOperator.END );
|
||||
BranchNode catchNode = new BranchNode( catchPos, endPos, WasmBlockOperator.CATCH, WasmBlockOperator.END, 0 );
|
||||
parent.add( catchNode );
|
||||
|
||||
// Create a block/end structure for every CATCH without the first CATCH
|
||||
@ -1097,14 +1097,14 @@ class BranchManger {
|
||||
catchNode.add( 0, unBoxing );
|
||||
return;
|
||||
}
|
||||
AnyType excepType = getCatchType( tryCatch );
|
||||
BlockType blockType = options.types.blockType( Arrays.asList( ValueType.exnref ), Arrays.asList( excepType ) );
|
||||
BranchNode unBoxing = new BranchNode( catchPos, catchPos, WasmBlockOperator.BLOCK, WasmBlockOperator.END, blockType );
|
||||
catchNode.add( 0, unBoxing );
|
||||
|
||||
//TODO localVariables.getTempVariable( ValueType.exnref, catchPos, endPos ); https://github.com/WebAssembly/wabt/issues/1388
|
||||
unBoxing.add( new BranchNode( catchPos, catchPos, WasmBlockOperator.BR_ON_EXN, null, 0 ) );
|
||||
unBoxing.add( new BranchNode( catchPos, catchPos, WasmBlockOperator.RETHROW, null ) );
|
||||
// AnyType excepType = getCatchType( tryCatch );
|
||||
// BlockType blockType = options.types.blockType( Arrays.asList( ValueType.exnref ), Arrays.asList( excepType ) );
|
||||
// BranchNode unBoxing = new BranchNode( catchPos, catchPos, WasmBlockOperator.BLOCK, WasmBlockOperator.END, blockType );
|
||||
// catchNode.add( 0, unBoxing );
|
||||
//
|
||||
// //TODO localVariables.getTempVariable( ValueType.exnref, catchPos, endPos ); https://github.com/WebAssembly/wabt/issues/1388
|
||||
// unBoxing.add( new BranchNode( catchPos, catchPos, WasmBlockOperator.BR_ON_EXN, null, 0 ) );
|
||||
// unBoxing.add( new BranchNode( catchPos, catchPos, WasmBlockOperator.RETHROW, null ) );
|
||||
}
|
||||
|
||||
private AnyType getCatchType( TryCatchFinally tryCatch ) {
|
||||
|
@ -831,7 +831,7 @@ public class TextModuleWriter extends ModuleWriter {
|
||||
break;
|
||||
case CATCH:
|
||||
inset--;
|
||||
name = options.useEH() ? "catch" : "br 0";
|
||||
name = options.useEH() ? "catch " + data : "br 0";
|
||||
insetAfter++;
|
||||
break;
|
||||
case THROW:
|
||||
|
Loading…
x
Reference in New Issue
Block a user