Move method name creation into WasmCallInstruction

This commit is contained in:
Volker 2018-08-06 12:46:18 +02:00
parent d16b2b63c2
commit d3e80bf709
2 changed files with 9 additions and 7 deletions

View File

@ -242,7 +242,7 @@ public class ModuleGenerator {
* the index in the signature
* @return the value type or null if void
*/
private ValueType getValueType( String signature, int idx ) {
static ValueType getValueType( String signature, int idx ) {
String javaType;
switch( signature.charAt( idx ) ) {
case '[': // array
@ -267,7 +267,7 @@ public class ModuleGenerator {
default:
javaType = signature.substring( idx, idx + 1 );
}
throw new WasmException( "Not supported Java data type in method signature: " + javaType, sourceFile, -1 );
throw new WasmException( "Not supported Java data type in method signature: " + javaType, null, -1 );
}
/**
@ -692,7 +692,7 @@ public class ModuleGenerator {
if( type != null ) {
stackManager.add( type, codePos );
}
instr = new WasmCallInstruction( method.getConstantClass().getName() + '.' + method.getName() + method.getType(), codePos );
instr = new WasmCallInstruction( method, codePos );
break;
//TODO case 185: // invokeinterface
//TODO case 187: // new

View File

@ -20,6 +20,8 @@ import java.io.IOException;
import javax.annotation.Nonnull;
import de.inetsoftware.classparser.ConstantRef;
/**
* WasmInstruction for a function call.
*
@ -33,14 +35,14 @@ class WasmCallInstruction extends WasmInstruction {
/**
* Create an instance of a function call instruction
*
* @param name
* the Java function name
* @param method
* the reference to the Java method
* @param javaCodePos
* the code position/offset in the Java method
*/
WasmCallInstruction( String name, int javaCodePos ) {
WasmCallInstruction( ConstantRef method, int javaCodePos ) {
super( javaCodePos );
this.name = name;
this.name = new FunctionName( method ).signatureName;
}
/**