wasm: fix bugs in coroutine support

This commit is contained in:
Alexey Andreev 2023-09-27 20:28:09 +02:00
parent 219de85e24
commit ab507bb22b
4 changed files with 3 additions and 7 deletions

View File

@ -126,6 +126,7 @@ public class CoroutineTransformation {
splitter.fixProgram();
processIrreducibleCfg();
RedundantJumpElimination.optimize(program);
new PhiUpdater().updatePhis(program, parameterCount + 1);
}
private void createSplitPrologue() {
@ -479,7 +480,6 @@ public class CoroutineTransformation {
weights[i] = program.basicBlockAt(i).instructionCount();
}
GraphUtils.splitIrreducibleGraph(graph, weights, splittingBackend);
new PhiUpdater().updatePhis(program, parameterCount + 1);
}
class SplittingBackend implements GraphSplittingBackend {

View File

@ -1114,7 +1114,7 @@ public class WasmTarget implements TeaVMTarget, TeaVMWasmHost {
@Override
public boolean isAsyncSupported() {
return false;
return true;
}
@Override

View File

@ -17,7 +17,6 @@ package org.teavm.backend.wasm.intrinsics;
import org.teavm.ast.InvocationExpr;
import org.teavm.backend.wasm.model.expression.WasmExpression;
import org.teavm.backend.wasm.model.expression.WasmInt32Constant;
import org.teavm.model.MethodDescriptor;
import org.teavm.model.MethodReference;
@ -34,7 +33,6 @@ public class PlatformIntrinsic implements WasmIntrinsic {
switch (methodDescriptor.getName()) {
case "getPlatformObject":
case "asJavaClass":
case "createQueue":
return true;
default:
return false;
@ -47,8 +45,6 @@ public class PlatformIntrinsic implements WasmIntrinsic {
case "getPlatformObject":
case "asJavaClass":
return manager.generate(invocation.getArguments().get(0));
case "createQueue":
return new WasmInt32Constant(0);
default:
throw new IllegalArgumentException(invocation.getMethod().toString());
}

View File

@ -88,7 +88,7 @@ TeaVM.wasm = function() {
}
}
if (result >= 0) {
controller.timer = setTimeout(() => process(controller), result)
controller.timer = setTimeout(() => process(controller), Number(result))
}
}