add struct.new_default for libraries

This commit is contained in:
Volker Berlin 2023-02-28 14:30:38 +01:00
parent bb20f0dbc2
commit 3de41deb3e
No known key found for this signature in database
GPG Key ID: 988423EF815BE4CB

View File

@ -246,7 +246,8 @@ public class WatParser extends WasmCodeBuilder {
} while ( !")".equals( str ) );
builder.append( get( tokens, ++i ) );
FunctionName name = new FunctionName( builder.substring( 1 ) );
addCallInstruction( name, false, javaCodePos, lineNumber );
boolean needThisParameter = "<init>".equals( name.methodName ); // TODO should be do lookup to the classLoader
addCallInstruction( name, needThisParameter, javaCodePos, lineNumber );
} catch( Exception ex ) {
throw WasmException.create( "The syntax for a function name is $package.ClassName.methodName(paramSignature)returnSignature", ex );
}
@ -337,6 +338,10 @@ public class WatParser extends WasmCodeBuilder {
typeName = get( tokens, ++i );
addStructInstruction( StructOperator.NEW_WITH_RTT, typeName, null, javaCodePos, lineNumber );
break;
case "struct.new_default": // Create instance without executing the constructor, works also with nonGC output
typeName = get( tokens, ++i );
addStructInstruction( StructOperator.NEW_DEFAULT, typeName, null, javaCodePos, lineNumber );
break;
case "array.get":
typeName = get( tokens, ++i );
type = ((ArrayType)getTypeManager().valueOf( typeName )).getArrayType();