mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-23 00:24:11 -08:00
WASM: bugfixes
This commit is contained in:
parent
e23293a8af
commit
ae896f3d90
|
@ -256,9 +256,11 @@ public final class WasmRuntime {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Address allocStack(int size) {
|
public static Address allocStack(int size) {
|
||||||
Address result = WasmHeap.stack.add(4);
|
Address stack = WasmHeap.stack;
|
||||||
WasmHeap.stack = result.add((size << 2) + 4);
|
Address result = stack.add(4);
|
||||||
WasmHeap.stack.putInt(size);
|
stack = result.add((size << 2) + 4);
|
||||||
|
stack.putInt(size);
|
||||||
|
WasmHeap.stack = stack;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -152,6 +152,11 @@ import org.teavm.vm.spi.TeaVMHostExtension;
|
||||||
public class WasmTarget implements TeaVMTarget, TeaVMWasmHost {
|
public class WasmTarget implements TeaVMTarget, TeaVMWasmHost {
|
||||||
private static final MethodReference INIT_HEAP_REF = new MethodReference(WasmHeap.class, "initHeap",
|
private static final MethodReference INIT_HEAP_REF = new MethodReference(WasmHeap.class, "initHeap",
|
||||||
Address.class, int.class, int.class, int.class, void.class);
|
Address.class, int.class, int.class, int.class, void.class);
|
||||||
|
private static final MethodReference RESIZE_HEAP_REF = new MethodReference(WasmHeap.class, "resizeHeap",
|
||||||
|
int.class, void.class);
|
||||||
|
private static final Set<MethodReference> VIRTUAL_METHODS = new HashSet<>(Arrays.asList(
|
||||||
|
new MethodReference(Object.class, "clone", Object.class)));
|
||||||
|
|
||||||
private TeaVMTargetController controller;
|
private TeaVMTargetController controller;
|
||||||
private boolean debugging;
|
private boolean debugging;
|
||||||
private boolean wastEmitted;
|
private boolean wastEmitted;
|
||||||
|
@ -173,6 +178,8 @@ public class WasmTarget implements TeaVMTarget, TeaVMWasmHost {
|
||||||
classInitializerEliminator = new ClassInitializerEliminator(controller.getUnprocessedClassSource());
|
classInitializerEliminator = new ClassInitializerEliminator(controller.getUnprocessedClassSource());
|
||||||
classInitializerTransformer = new ClassInitializerTransformer();
|
classInitializerTransformer = new ClassInitializerTransformer();
|
||||||
shadowStackTransformer = new ShadowStackTransformer(managedMethodRepository, true);
|
shadowStackTransformer = new ShadowStackTransformer(managedMethodRepository, true);
|
||||||
|
|
||||||
|
controller.addVirtualMethods(VIRTUAL_METHODS::contains);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -291,6 +298,7 @@ public class WasmTarget implements TeaVMTarget, TeaVMWasmHost {
|
||||||
void.class)).use();
|
void.class)).use();
|
||||||
|
|
||||||
dependencyAnalyzer.linkMethod(INIT_HEAP_REF).use();
|
dependencyAnalyzer.linkMethod(INIT_HEAP_REF).use();
|
||||||
|
dependencyAnalyzer.linkMethod(RESIZE_HEAP_REF).use();
|
||||||
|
|
||||||
dependencyAnalyzer.linkMethod(new MethodReference(Allocator.class, "allocate",
|
dependencyAnalyzer.linkMethod(new MethodReference(Allocator.class, "allocate",
|
||||||
RuntimeClass.class, Address.class)).use();
|
RuntimeClass.class, Address.class)).use();
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class GCIntrinsic implements WasmIntrinsic {
|
||||||
private static final MethodReference PRINT_OUT_OF_MEMORY = new MethodReference(
|
private static final MethodReference PRINT_OUT_OF_MEMORY = new MethodReference(
|
||||||
WasmRuntime.class, "printOutOfMemory", void.class);
|
WasmRuntime.class, "printOutOfMemory", void.class);
|
||||||
private static final MethodReference RESIZE_HEAP = new MethodReference(
|
private static final MethodReference RESIZE_HEAP = new MethodReference(
|
||||||
WasmHeap.class, "printOutOfMemory", void.class);
|
WasmHeap.class, "resizeHeap", int.class, void.class);
|
||||||
private List<WasmInt32Constant> regionSizeExpressions = new ArrayList<>();
|
private List<WasmInt32Constant> regionSizeExpressions = new ArrayList<>();
|
||||||
|
|
||||||
public void setRegionSize(int regionSize) {
|
public void setRegionSize(int regionSize) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user