diff --git a/classlib/src/main/java/org/teavm/classlib/java/lang/TObject.java b/classlib/src/main/java/org/teavm/classlib/java/lang/TObject.java index 7e1051975..27bcabd0c 100644 --- a/classlib/src/main/java/org/teavm/classlib/java/lang/TObject.java +++ b/classlib/src/main/java/org/teavm/classlib/java/lang/TObject.java @@ -186,6 +186,10 @@ public class TObject { if (monitor == null) { return true; } + if (PlatformDetector.isWebAssemblyGC()) { + // TODO: fix Monitor implementation and remove this block + return monitor.owner == null; + } if (monitor.owner == null && (monitor.enteringThreads == null || monitor.enteringThreads.isEmpty()) && (monitor.notifyListeners == null || monitor.notifyListeners.isEmpty())) { diff --git a/jso/impl/src/main/java/org/teavm/jso/impl/JSOPlugin.java b/jso/impl/src/main/java/org/teavm/jso/impl/JSOPlugin.java index 5ef5e7784..2d62ed117 100644 --- a/jso/impl/src/main/java/org/teavm/jso/impl/JSOPlugin.java +++ b/jso/impl/src/main/java/org/teavm/jso/impl/JSOPlugin.java @@ -31,6 +31,12 @@ import org.teavm.vm.spi.TeaVMPlugin; public class JSOPlugin implements TeaVMPlugin { @Override 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(); host.registerService(JSBodyRepository.class, repository); host.add(new JSObjectClassTransformer(repository)); @@ -48,12 +54,10 @@ public class JSOPlugin implements TeaVMPlugin { TeaVMPluginUtil.handleNatives(host, JS.class); - var jsHost = host.getExtension(TeaVMJavaScriptHost.class); if (jsHost != null) { installForJS(jsHost); } - var wasmGCHost = host.getExtension(TeaVMWasmGCHost.class); if (wasmGCHost != null) { WasmGCJso.install(host, wasmGCHost, repository); }