mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
wasm: avoid generation of types as defined in GC spec
This fixes passing tests in environments that either don't support or prohibit usage of GC spec
This commit is contained in:
parent
8dd344412e
commit
8b52741e04
|
@ -407,6 +407,7 @@ public class WasmGCClassGenerator implements WasmGCClassInfoProvider, WasmGCInit
|
||||||
|| expectedFunctionType != function.getType()) {
|
|| expectedFunctionType != function.getType()) {
|
||||||
var functionType = typeMapper.getFunctionType(virtualTable.getClassName(), method, true);
|
var functionType = typeMapper.getFunctionType(virtualTable.getClassName(), method, true);
|
||||||
functionType.getSupertypes().add(expectedFunctionType);
|
functionType.getSupertypes().add(expectedFunctionType);
|
||||||
|
expectedFunctionType.setFinal(false);
|
||||||
var wrapperFunction = new WasmFunction(functionType);
|
var wrapperFunction = new WasmFunction(functionType);
|
||||||
module.functions.add(wrapperFunction);
|
module.functions.add(wrapperFunction);
|
||||||
var call = new WasmCall(function);
|
var call = new WasmCall(function);
|
||||||
|
|
|
@ -26,6 +26,7 @@ public class WasmFunctionType extends WasmCompositeType {
|
||||||
private Supplier<List<? extends WasmType>> parameterTypesSupplier;
|
private Supplier<List<? extends WasmType>> parameterTypesSupplier;
|
||||||
private Supplier<WasmType> returnTypeSupplier;
|
private Supplier<WasmType> returnTypeSupplier;
|
||||||
private Set<WasmFunctionType> supertypes = new LinkedHashSet<>();
|
private Set<WasmFunctionType> supertypes = new LinkedHashSet<>();
|
||||||
|
private boolean isFinal = true;
|
||||||
|
|
||||||
public WasmFunctionType(String name, WasmType returnType, List<? extends WasmType> parameterTypes) {
|
public WasmFunctionType(String name, WasmType returnType, List<? extends WasmType> parameterTypes) {
|
||||||
super(name);
|
super(name);
|
||||||
|
@ -60,6 +61,14 @@ public class WasmFunctionType extends WasmCompositeType {
|
||||||
return supertypes;
|
return supertypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isFinal() {
|
||||||
|
return isFinal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFinal(boolean aFinal) {
|
||||||
|
isFinal = aFinal;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void acceptVisitor(WasmCompositeTypeVisitor visitor) {
|
public void acceptVisitor(WasmCompositeTypeVisitor visitor) {
|
||||||
visitor.visit(this);
|
visitor.visit(this);
|
||||||
|
|
|
@ -57,11 +57,13 @@ public class WasmCompositeTypeBinaryRenderer implements WasmCompositeTypeVisitor
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void visit(WasmFunctionType type) {
|
public void visit(WasmFunctionType type) {
|
||||||
|
if (!type.isFinal() || !type.getSupertypes().isEmpty()) {
|
||||||
section.writeByte(0x50);
|
section.writeByte(0x50);
|
||||||
section.writeLEB(type.getSupertypes().size());
|
section.writeLEB(type.getSupertypes().size());
|
||||||
for (var supertype : type.getSupertypes()) {
|
for (var supertype : type.getSupertypes()) {
|
||||||
section.writeLEB(module.types.indexOf(supertype));
|
section.writeLEB(module.types.indexOf(supertype));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
section.writeByte(0x60);
|
section.writeByte(0x60);
|
||||||
section.writeLEB(type.getParameterTypes().size());
|
section.writeLEB(type.getParameterTypes().size());
|
||||||
for (var inputType : type.getParameterTypes()) {
|
for (var inputType : type.getParameterTypes()) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user