mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-15 02:44:47 +01:00
convert try/catch to block/br 0 if exception handling is disabled
This commit is contained in:
parent
cbf27fdfa6
commit
02f41dd52a
@ -1302,11 +1302,16 @@ public class BinaryModuleWriter extends ModuleWriter implements InstructionOpcod
|
||||
codeStream.writeOpCode( UNREACHABLE );
|
||||
break;
|
||||
case TRY:
|
||||
codeStream.writeOpCode( TRY );
|
||||
codeStream.writeOpCode( options.useEH() ? TRY : BLOCK );
|
||||
codeStream.writeValueType( ValueType.empty ); // void; the return type of the try. currently we does not use it
|
||||
break;
|
||||
case CATCH:
|
||||
codeStream.writeOpCode( CATCH );
|
||||
if( options.useEH() ) {
|
||||
codeStream.writeOpCode( CATCH );
|
||||
} else {
|
||||
codeStream.writeOpCode( BR );
|
||||
codeStream.writeVaruint32( 0 );
|
||||
}
|
||||
break;
|
||||
case THROW:
|
||||
if( options.useEH() ) {
|
||||
|
@ -768,12 +768,12 @@ public class TextModuleWriter extends ModuleWriter {
|
||||
name = "unreachable";
|
||||
break;
|
||||
case TRY:
|
||||
name = "try";
|
||||
name = options.useEH() ? "try" : "block";
|
||||
insetAfter++;
|
||||
break;
|
||||
case CATCH:
|
||||
inset--;
|
||||
name = "catch";
|
||||
name = options.useEH() ? "catch" : "br 0";
|
||||
insetAfter++;
|
||||
break;
|
||||
case THROW:
|
||||
|
Loading…
x
Reference in New Issue
Block a user