mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -08:00
Fix WASM backend
This commit is contained in:
parent
3b4cc43e79
commit
4f9567561c
|
@ -145,6 +145,7 @@ import org.teavm.runtime.ExceptionHandling;
|
|||
import org.teavm.runtime.RuntimeArray;
|
||||
import org.teavm.runtime.RuntimeClass;
|
||||
import org.teavm.runtime.RuntimeObject;
|
||||
import org.teavm.runtime.ShadowStack;
|
||||
import org.teavm.vm.BuildTarget;
|
||||
import org.teavm.vm.TeaVMEntryPoint;
|
||||
import org.teavm.vm.TeaVMTarget;
|
||||
|
@ -605,7 +606,7 @@ public class WasmTarget implements TeaVMTarget, TeaVMWasmHost {
|
|||
if (methodGenerator != null) {
|
||||
WasmFunction function = context.getFunction(context.names.forMethod(method.getReference()));
|
||||
methodGenerator.apply(method.getReference(), function, methodGeneratorContext);
|
||||
} else {
|
||||
} else if (!isShadowStackMethod(method.getReference())) {
|
||||
if (context.getImportedMethod(method.getReference()) == null) {
|
||||
CallLocation location = new CallLocation(method.getReference());
|
||||
controller.getDiagnostics().error(location, "Method {{m0}} is native but "
|
||||
|
@ -629,6 +630,21 @@ public class WasmTarget implements TeaVMTarget, TeaVMWasmHost {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean isShadowStackMethod(MethodReference method) {
|
||||
if (!method.getClassName().equals(ShadowStack.class.getName())) {
|
||||
return false;
|
||||
}
|
||||
switch (method.getName()) {
|
||||
case "allocStack":
|
||||
case "registerGCRoot":
|
||||
case "removeGCRoot":
|
||||
case "releaseStack":
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void generateIsSupertypeFunctions(TagRegistry tagRegistry, WasmModule module,
|
||||
WasmClassGenerator classGenerator) {
|
||||
for (ValueType type : classGenerator.getRegisteredClasses()) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user