Write also for BR_ON_EXN an UNREACHABLE instruction

This commit is contained in:
Volker Berlin 2020-04-10 16:33:32 +02:00
parent c19a9ca9b6
commit bab77094c2
2 changed files with 8 additions and 4 deletions

View File

@ -1320,9 +1320,13 @@ public class BinaryModuleWriter extends ModuleWriter implements InstructionOpcod
codeStream.writeOpCode( RETHROW );
break;
case BR_ON_EXN:
codeStream.writeOpCode( BR_ON_EXN );
codeStream.writeVaruint32( (Integer)data ); // break depth
codeStream.writeVaruint32( 0 ); // event/exception ever 0 because currently there is only one with signature anyref
if( options.useEH() ) {
codeStream.writeOpCode( BR_ON_EXN );
codeStream.writeVaruint32( (Integer)data ); // break depth
codeStream.writeVaruint32( 0 ); // event/exception ever 0 because currently there is only one with signature anyref
} else {
codeStream.writeOpCode( UNREACHABLE );
}
break;
case MONITOR_ENTER:
case MONITOR_EXIT:

View File

@ -783,7 +783,7 @@ public class TextModuleWriter extends ModuleWriter {
name = "rethrow";
break;
case BR_ON_EXN:
name = "br_on_exn " + data + " 0"; // br_on_exn, break depth, event; // currently there is only one event/exception with anyref
name = options.useEH() ? "br_on_exn " + data + " 0" : "unreachable"; // br_on_exn, break depth, event; // currently there is only one event/exception with anyref
break;
case MONITOR_ENTER:
case MONITOR_EXIT: