mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-25 23:47:51 +01:00
use "java/lang/Object" as fallback type for NULL values
This commit is contained in:
parent
23199840c8
commit
52dd9a1665
@ -967,6 +967,7 @@ class JavaMethodWasmCodeBuilder extends WasmCodeBuilder {
|
|||||||
int size = instructions.size();
|
int size = instructions.size();
|
||||||
for( int i = 0; i < size; i++ ) {
|
for( int i = 0; i < size; i++ ) {
|
||||||
WasmInstruction instr = instructions.get( i );
|
WasmInstruction instr = instructions.get( i );
|
||||||
|
try {
|
||||||
if( instr.getType() == Type.Struct ) {
|
if( instr.getType() == Type.Struct ) {
|
||||||
WasmStructInstruction structInst = (WasmStructInstruction)instr;
|
WasmStructInstruction structInst = (WasmStructInstruction)instr;
|
||||||
if( structInst.getOperator() == StructOperator.NULL ) {
|
if( structInst.getOperator() == StructOperator.NULL ) {
|
||||||
@ -976,7 +977,10 @@ class JavaMethodWasmCodeBuilder extends WasmCodeBuilder {
|
|||||||
count -= nextInstr.getPopCount();
|
count -= nextInstr.getPopCount();
|
||||||
if( count < 0 ) {
|
if( count < 0 ) {
|
||||||
AnyType[] popValueTypes = nextInstr.getPopValueTypes();
|
AnyType[] popValueTypes = nextInstr.getPopValueTypes();
|
||||||
structInst.setStructType( (StructType)popValueTypes[-1 - count] );
|
AnyType type = popValueTypes[-1 - count];
|
||||||
|
// is the fallback to java/lang/Object right? There can also be a NULL value for external.
|
||||||
|
StructType structType = type instanceof StructType ? (StructType)type : getTypeManager().valueOf( "java/lang/Object" );
|
||||||
|
structInst.setStructType( structType );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if( nextInstr.getPushValueType() != null ) {
|
if( nextInstr.getPushValueType() != null ) {
|
||||||
@ -985,6 +989,9 @@ class JavaMethodWasmCodeBuilder extends WasmCodeBuilder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch( Exception ex ) {
|
||||||
|
throw WasmException.create( ex, instr.getLineNumber() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user