mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-25 07:27:52 +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 );
|
codeStream.writeOpCode( UNREACHABLE );
|
||||||
break;
|
break;
|
||||||
case TRY:
|
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
|
codeStream.writeValueType( ValueType.empty ); // void; the return type of the try. currently we does not use it
|
||||||
break;
|
break;
|
||||||
case CATCH:
|
case CATCH:
|
||||||
codeStream.writeOpCode( CATCH );
|
if( options.useEH() ) {
|
||||||
|
codeStream.writeOpCode( CATCH );
|
||||||
|
} else {
|
||||||
|
codeStream.writeOpCode( BR );
|
||||||
|
codeStream.writeVaruint32( 0 );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case THROW:
|
case THROW:
|
||||||
if( options.useEH() ) {
|
if( options.useEH() ) {
|
||||||
|
@ -768,12 +768,12 @@ public class TextModuleWriter extends ModuleWriter {
|
|||||||
name = "unreachable";
|
name = "unreachable";
|
||||||
break;
|
break;
|
||||||
case TRY:
|
case TRY:
|
||||||
name = "try";
|
name = options.useEH() ? "try" : "block";
|
||||||
insetAfter++;
|
insetAfter++;
|
||||||
break;
|
break;
|
||||||
case CATCH:
|
case CATCH:
|
||||||
inset--;
|
inset--;
|
||||||
name = "catch";
|
name = options.useEH() ? "catch" : "br 0";
|
||||||
insetAfter++;
|
insetAfter++;
|
||||||
break;
|
break;
|
||||||
case THROW:
|
case THROW:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user