Fix failing tests

This commit is contained in:
Alexey Andreev 2024-09-28 19:58:55 +02:00
parent 5ad4496c34
commit e966690284
2 changed files with 10 additions and 2 deletions

View File

@ -186,6 +186,10 @@ public class TObject {
if (monitor == null) { if (monitor == null) {
return true; return true;
} }
if (PlatformDetector.isWebAssemblyGC()) {
// TODO: fix Monitor implementation and remove this block
return monitor.owner == null;
}
if (monitor.owner == null if (monitor.owner == null
&& (monitor.enteringThreads == null || monitor.enteringThreads.isEmpty()) && (monitor.enteringThreads == null || monitor.enteringThreads.isEmpty())
&& (monitor.notifyListeners == null || monitor.notifyListeners.isEmpty())) { && (monitor.notifyListeners == null || monitor.notifyListeners.isEmpty())) {

View File

@ -31,6 +31,12 @@ import org.teavm.vm.spi.TeaVMPlugin;
public class JSOPlugin implements TeaVMPlugin { public class JSOPlugin implements TeaVMPlugin {
@Override @Override
public void install(TeaVMHost host) { public void install(TeaVMHost host) {
var jsHost = host.getExtension(TeaVMJavaScriptHost.class);
var wasmGCHost = host.getExtension(TeaVMWasmGCHost.class);
if (jsHost == null && wasmGCHost == null) {
return;
}
JSBodyRepository repository = new JSBodyRepository(); JSBodyRepository repository = new JSBodyRepository();
host.registerService(JSBodyRepository.class, repository); host.registerService(JSBodyRepository.class, repository);
host.add(new JSObjectClassTransformer(repository)); host.add(new JSObjectClassTransformer(repository));
@ -48,12 +54,10 @@ public class JSOPlugin implements TeaVMPlugin {
TeaVMPluginUtil.handleNatives(host, JS.class); TeaVMPluginUtil.handleNatives(host, JS.class);
var jsHost = host.getExtension(TeaVMJavaScriptHost.class);
if (jsHost != null) { if (jsHost != null) {
installForJS(jsHost); installForJS(jsHost);
} }
var wasmGCHost = host.getExtension(TeaVMWasmGCHost.class);
if (wasmGCHost != null) { if (wasmGCHost != null) {
WasmGCJso.install(host, wasmGCHost, repository); WasmGCJso.install(host, wasmGCHost, repository);
} }