fix wrong block return type calculation with synchronized

This commit is contained in:
Volker Berlin 2022-07-27 21:21:03 +02:00
parent f5e8e48356
commit 5013f2f819
No known key found for this signature in database
GPG Key ID: 988423EF815BE4CB
2 changed files with 15 additions and 0 deletions

View File

@ -133,6 +133,8 @@ class WasmBlockInstruction extends WasmInstruction {
case DROP:
case THROW:
case RETHROW:
case MONITOR_ENTER:
case MONITOR_EXIT:
return 1;
case BLOCK:
return data instanceof BlockType ? ((BlockType)data).getParams().size() : 0;

View File

@ -53,6 +53,7 @@ public class Exceptions extends AbstractBaseTest {
addParam( list, script, "complex" );
addParam( list, script, "sync" );
addParam( list, script, "syncWithInnerTryCatch" );
addParam( list, script, "syncInsideCondition" );
addParam( list, script, "emptyCatch" );
addParam( list, script, "multiCatch" );
addParam( list, script, "multiCatch2" );
@ -193,6 +194,18 @@ public class Exceptions extends AbstractBaseTest {
return result;
}
@Export
static int syncInsideCondition() {
int value = 0;
Object obj = new Object();
if( value == 0 ) {
synchronized( obj ) {
value = 42;
}
}
return value;
}
@Export
static int emptyCatch() {
int h = 127; // variable slot 0