mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
wasm gc: don't generate emulated casts in non-strict mode
This commit is contained in:
parent
29339f3fbc
commit
6613d379ec
|
@ -178,7 +178,8 @@ public class WasmGCTarget implements TeaVMTarget, TeaVMWasmGCHost {
|
||||||
customGenerators,
|
customGenerators,
|
||||||
intrinsics,
|
intrinsics,
|
||||||
customTypeMapperFactories,
|
customTypeMapperFactories,
|
||||||
controller::isVirtual
|
controller::isVirtual,
|
||||||
|
strict
|
||||||
);
|
);
|
||||||
declarationsGenerator.setFriendlyToDebugger(controller.isFriendlyToDebugger());
|
declarationsGenerator.setFriendlyToDebugger(controller.isFriendlyToDebugger());
|
||||||
var moduleGenerator = new WasmGCModuleGenerator(declarationsGenerator);
|
var moduleGenerator = new WasmGCModuleGenerator(declarationsGenerator);
|
||||||
|
|
|
@ -57,7 +57,8 @@ public class WasmGCDeclarationsGenerator {
|
||||||
WasmGCCustomGeneratorProvider customGenerators,
|
WasmGCCustomGeneratorProvider customGenerators,
|
||||||
WasmGCIntrinsicProvider intrinsics,
|
WasmGCIntrinsicProvider intrinsics,
|
||||||
List<WasmGCCustomTypeMapperFactory> customTypeMapperFactories,
|
List<WasmGCCustomTypeMapperFactory> customTypeMapperFactories,
|
||||||
Predicate<MethodReference> isVirtual
|
Predicate<MethodReference> isVirtual,
|
||||||
|
boolean strict
|
||||||
) {
|
) {
|
||||||
this.module = module;
|
this.module = module;
|
||||||
hierarchy = new ClassHierarchy(classes);
|
hierarchy = new ClassHierarchy(classes);
|
||||||
|
@ -75,7 +76,8 @@ public class WasmGCDeclarationsGenerator {
|
||||||
names,
|
names,
|
||||||
diagnostics,
|
diagnostics,
|
||||||
customGenerators,
|
customGenerators,
|
||||||
intrinsics
|
intrinsics,
|
||||||
|
strict
|
||||||
);
|
);
|
||||||
var tags = new TagRegistry(classes, hierarchy);
|
var tags = new TagRegistry(classes, hierarchy);
|
||||||
var metadataRequirements = new ClassMetadataRequirements(dependencyInfo);
|
var metadataRequirements = new ClassMetadataRequirements(dependencyInfo);
|
||||||
|
|
|
@ -32,7 +32,6 @@ import org.teavm.backend.wasm.generate.gc.classes.WasmGCSupertypeFunctionProvide
|
||||||
import org.teavm.backend.wasm.generate.gc.classes.WasmGCTypeMapper;
|
import org.teavm.backend.wasm.generate.gc.classes.WasmGCTypeMapper;
|
||||||
import org.teavm.backend.wasm.generate.gc.strings.WasmGCStringProvider;
|
import org.teavm.backend.wasm.generate.gc.strings.WasmGCStringProvider;
|
||||||
import org.teavm.backend.wasm.model.WasmFunction;
|
import org.teavm.backend.wasm.model.WasmFunction;
|
||||||
import org.teavm.backend.wasm.model.WasmGlobal;
|
|
||||||
import org.teavm.backend.wasm.model.WasmModule;
|
import org.teavm.backend.wasm.model.WasmModule;
|
||||||
import org.teavm.backend.wasm.model.WasmTag;
|
import org.teavm.backend.wasm.model.WasmTag;
|
||||||
import org.teavm.backend.wasm.runtime.WasmGCSupport;
|
import org.teavm.backend.wasm.runtime.WasmGCSupport;
|
||||||
|
@ -60,10 +59,10 @@ public class WasmGCGenerationContext implements BaseWasmGenerationContext {
|
||||||
private WasmFunction npeMethod;
|
private WasmFunction npeMethod;
|
||||||
private WasmFunction aaiobeMethod;
|
private WasmFunction aaiobeMethod;
|
||||||
private WasmFunction cceMethod;
|
private WasmFunction cceMethod;
|
||||||
private WasmGlobal exceptionGlobal;
|
|
||||||
private WasmTag exceptionTag;
|
private WasmTag exceptionTag;
|
||||||
private Map<String, Set<String>> interfaceImplementors;
|
private Map<String, Set<String>> interfaceImplementors;
|
||||||
private WasmGCNameProvider names;
|
private WasmGCNameProvider names;
|
||||||
|
private boolean strict;
|
||||||
|
|
||||||
public WasmGCGenerationContext(WasmModule module, WasmGCVirtualTableProvider virtualTables,
|
public WasmGCGenerationContext(WasmModule module, WasmGCVirtualTableProvider virtualTables,
|
||||||
WasmGCTypeMapper typeMapper, WasmFunctionTypes functionTypes, ListableClassReaderSource classes,
|
WasmGCTypeMapper typeMapper, WasmFunctionTypes functionTypes, ListableClassReaderSource classes,
|
||||||
|
@ -71,7 +70,7 @@ public class WasmGCGenerationContext implements BaseWasmGenerationContext {
|
||||||
WasmGCSupertypeFunctionProvider supertypeFunctions, WasmGCClassInfoProvider classInfoProvider,
|
WasmGCSupertypeFunctionProvider supertypeFunctions, WasmGCClassInfoProvider classInfoProvider,
|
||||||
WasmGCStandardClasses standardClasses, WasmGCStringProvider strings,
|
WasmGCStandardClasses standardClasses, WasmGCStringProvider strings,
|
||||||
WasmGCCustomGeneratorProvider customGenerators, WasmGCIntrinsicProvider intrinsics,
|
WasmGCCustomGeneratorProvider customGenerators, WasmGCIntrinsicProvider intrinsics,
|
||||||
WasmGCNameProvider names) {
|
WasmGCNameProvider names, boolean strict) {
|
||||||
this.module = module;
|
this.module = module;
|
||||||
this.virtualTables = virtualTables;
|
this.virtualTables = virtualTables;
|
||||||
this.typeMapper = typeMapper;
|
this.typeMapper = typeMapper;
|
||||||
|
@ -87,6 +86,7 @@ public class WasmGCGenerationContext implements BaseWasmGenerationContext {
|
||||||
this.customGenerators = customGenerators;
|
this.customGenerators = customGenerators;
|
||||||
this.intrinsics = intrinsics;
|
this.intrinsics = intrinsics;
|
||||||
this.names = names;
|
this.names = names;
|
||||||
|
this.strict = strict;
|
||||||
}
|
}
|
||||||
|
|
||||||
public WasmGCClassInfoProvider classInfoProvider() {
|
public WasmGCClassInfoProvider classInfoProvider() {
|
||||||
|
@ -143,6 +143,10 @@ public class WasmGCGenerationContext implements BaseWasmGenerationContext {
|
||||||
return classes;
|
return classes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isStrict() {
|
||||||
|
return strict;
|
||||||
|
}
|
||||||
|
|
||||||
public ClassLoader classLoader() {
|
public ClassLoader classLoader() {
|
||||||
return classLoader;
|
return classLoader;
|
||||||
}
|
}
|
||||||
|
|
|
@ -487,7 +487,7 @@ public class WasmGCGenerationVisitor extends BaseWasmGenerationVisitor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!expr.isWeak()) {
|
if (!expr.isWeak() && context.isStrict()) {
|
||||||
result.acceptVisitor(typeInference);
|
result.acceptVisitor(typeInference);
|
||||||
|
|
||||||
var block = new WasmBlock(false);
|
var block = new WasmBlock(false);
|
||||||
|
|
|
@ -83,6 +83,7 @@ public class WasmGCMethodGenerator implements BaseWasmFunctionRepository {
|
||||||
private WasmGCClassInfoProvider classInfoProvider;
|
private WasmGCClassInfoProvider classInfoProvider;
|
||||||
private WasmGCStandardClasses standardClasses;
|
private WasmGCStandardClasses standardClasses;
|
||||||
private WasmGCStringProvider strings;
|
private WasmGCStringProvider strings;
|
||||||
|
private boolean strict;
|
||||||
|
|
||||||
public WasmGCMethodGenerator(
|
public WasmGCMethodGenerator(
|
||||||
WasmModule module,
|
WasmModule module,
|
||||||
|
@ -95,7 +96,8 @@ public class WasmGCMethodGenerator implements BaseWasmFunctionRepository {
|
||||||
WasmGCNameProvider names,
|
WasmGCNameProvider names,
|
||||||
Diagnostics diagnostics,
|
Diagnostics diagnostics,
|
||||||
WasmGCCustomGeneratorProvider customGenerators,
|
WasmGCCustomGeneratorProvider customGenerators,
|
||||||
WasmGCIntrinsicProvider intrinsics
|
WasmGCIntrinsicProvider intrinsics,
|
||||||
|
boolean strict
|
||||||
) {
|
) {
|
||||||
this.module = module;
|
this.module = module;
|
||||||
this.hierarchy = hierarchy;
|
this.hierarchy = hierarchy;
|
||||||
|
@ -108,6 +110,7 @@ public class WasmGCMethodGenerator implements BaseWasmFunctionRepository {
|
||||||
this.diagnostics = diagnostics;
|
this.diagnostics = diagnostics;
|
||||||
this.customGenerators = customGenerators;
|
this.customGenerators = customGenerators;
|
||||||
this.intrinsics = intrinsics;
|
this.intrinsics = intrinsics;
|
||||||
|
this.strict = strict;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTypeMapper(WasmGCTypeMapper typeMapper) {
|
public void setTypeMapper(WasmGCTypeMapper typeMapper) {
|
||||||
|
@ -332,7 +335,8 @@ public class WasmGCMethodGenerator implements BaseWasmFunctionRepository {
|
||||||
strings,
|
strings,
|
||||||
customGenerators,
|
customGenerators,
|
||||||
intrinsics,
|
intrinsics,
|
||||||
names
|
names,
|
||||||
|
strict
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return context;
|
return context;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user