implements Unsafe.getObjectVolatile

This commit is contained in:
Volker Berlin 2023-02-27 18:49:57 +01:00
parent ef2720537d
commit bb20f0dbc2
No known key found for this signature in database
GPG Key ID: 988423EF815BE4CB
2 changed files with 10 additions and 0 deletions

View File

@ -549,6 +549,11 @@ class UnsafeManager {
return "local.get 1" // THIS
+ " local.get 3" // x
+ " struct.set " + state.typeName + ' ' + state.fieldName;
case "getObjectVolatile":
return "local.get 1" // array
+ " local.get 2" // the array index
+ " array.get " + state.typeName;
}
throw new RuntimeException( name.signatureName );

View File

@ -337,6 +337,11 @@ public class WatParser extends WasmCodeBuilder {
typeName = get( tokens, ++i );
addStructInstruction( StructOperator.NEW_WITH_RTT, typeName, null, javaCodePos, lineNumber );
break;
case "array.get":
typeName = get( tokens, ++i );
type = ((ArrayType)getTypeManager().valueOf( typeName )).getArrayType();
addArrayInstruction( ArrayOperator.GET, type, javaCodePos, lineNumber );
break;
default:
throw new WasmException( "Unknown WASM token: " + tok, lineNumber );
}