diff --git a/wasm/CHANGELOG.md b/wasm/CHANGELOG.md index 895202c14cdc..f6edf2803583 100644 --- a/wasm/CHANGELOG.md +++ b/wasm/CHANGELOG.md @@ -5,6 +5,7 @@ This changelog summarizes major changes to the WebAssembly engine implemented in ## Version 24.2.0 * Updated developer metadata of Maven artifacts. +* Deprecated the `--wasm.AsyncParsingBinarySize` and `--wasm.AsyncParsingStackSize` options. These options no longer have any effect and will be removed in a future release. ## Version 24.1.0 diff --git a/wasm/src/org.graalvm.wasm/src/org/graalvm/wasm/WasmInstantiator.java b/wasm/src/org.graalvm.wasm/src/org/graalvm/wasm/WasmInstantiator.java index e00cfe146092..361155693484 100644 --- a/wasm/src/org.graalvm.wasm/src/org/graalvm/wasm/WasmInstantiator.java +++ b/wasm/src/org.graalvm.wasm/src/org/graalvm/wasm/WasmInstantiator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * The Universal Permissive License (UPL), Version 1.0 @@ -50,8 +50,6 @@ import org.graalvm.collections.MapCursor; import org.graalvm.wasm.constants.BytecodeBitEncoding; import org.graalvm.wasm.constants.SegmentMode; -import org.graalvm.wasm.exception.Failure; -import org.graalvm.wasm.exception.WasmException; import org.graalvm.wasm.memory.WasmMemory; import org.graalvm.wasm.memory.WasmMemoryFactory; import org.graalvm.wasm.nodes.WasmCallStubNode; @@ -74,22 +72,6 @@ * Creates wasm instances by converting parser nodes into Truffle nodes. */ public class WasmInstantiator { - private static final int MIN_DEFAULT_STACK_SIZE = 1_000_000; - private static final int MAX_DEFAULT_ASYNC_STACK_SIZE = 10_000_000; - - private static class ParsingExceptionHandler implements Thread.UncaughtExceptionHandler { - private Throwable parsingException = null; - - @Override - public void uncaughtException(Thread t, Throwable e) { - this.parsingException = e; - } - - public Throwable parsingException() { - return parsingException; - } - } - private final WasmLanguage language; @TruffleBoundary @@ -101,30 +83,7 @@ public WasmInstantiator(WasmLanguage language) { public WasmInstance createInstance(WasmContext context, WasmModule module, TruffleContext truffleContext) { WasmInstance instance = new WasmInstance(context, module, truffleContext); instance.createLinkActions(); - int binarySize = instance.module().bytecodeLength(); - final int asyncParsingBinarySize = WasmOptions.AsyncParsingBinarySize.getValue(context.environment().getOptions()); - if (binarySize < asyncParsingBinarySize || !context.environment().isCreateThreadAllowed()) { - instantiateCodeEntries(context, instance); - } else { - final Runnable parsing = () -> instantiateCodeEntries(context, instance); - final String name = "wasm-parsing-thread(" + instance.name() + ")"; - final int requestedSize = WasmOptions.AsyncParsingStackSize.getValue(context.environment().getOptions()) * 1000; - final int defaultSize = Math.max(MIN_DEFAULT_STACK_SIZE, Math.min(2 * binarySize, MAX_DEFAULT_ASYNC_STACK_SIZE)); - final int stackSize = requestedSize != 0 ? requestedSize : defaultSize; - final Thread parsingThread = context.environment().newTruffleThreadBuilder(parsing).stackSize(stackSize).build(); - parsingThread.setName(name); - final ParsingExceptionHandler handler = new ParsingExceptionHandler(); - parsingThread.setUncaughtExceptionHandler(handler); - parsingThread.start(); - try { - parsingThread.join(); - if (handler.parsingException() != null) { - throw WasmException.create(Failure.UNSPECIFIED_INVALID, "Asynchronous parsing failed."); - } - } catch (InterruptedException e) { - throw WasmException.create(Failure.UNSPECIFIED_INVALID, "Asynchronous parsing interrupted."); - } - } + instantiateCodeEntries(context, instance); return instance; } diff --git a/wasm/src/org.graalvm.wasm/src/org/graalvm/wasm/WasmOptions.java b/wasm/src/org.graalvm.wasm/src/org/graalvm/wasm/WasmOptions.java index 1545adfac8ad..3ac8b74aefcb 100644 --- a/wasm/src/org.graalvm.wasm/src/org/graalvm/wasm/WasmOptions.java +++ b/wasm/src/org.graalvm.wasm/src/org/graalvm/wasm/WasmOptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * The Universal Permissive License (UPL), Version 1.0 @@ -51,10 +51,12 @@ public class WasmOptions { @Option(help = "A comma-separated list of builtin modules to use.", category = OptionCategory.USER, stability = OptionStability.STABLE, usageSyntax = "[:],[:],...")// public static final OptionKey Builtins = new OptionKey<>(""); - @Option(help = "The minimal binary size for which to use async parsing. If threads are not supported, async parsing will not be used.", category = OptionCategory.USER, stability = OptionStability.STABLE, usageSyntax = "[0, inf)")// + @Option(help = "The minimal binary size for which to use async parsing. If threads are not supported, async parsing will not be used.", category = OptionCategory.USER, stability = OptionStability.STABLE, usageSyntax = "[0, inf)", // + deprecated = true, deprecationMessage = "Option no longer has any effect and can be safely omitted.")// public static final OptionKey AsyncParsingBinarySize = new OptionKey<>(100_000); - @Option(help = "The stack size in kilobytes to use during async parsing, or zero to use defaults.", category = OptionCategory.USER, stability = OptionStability.STABLE, usageSyntax = "[0, inf)")// + @Option(help = "The stack size in kilobytes to use during async parsing, or zero to use defaults.", category = OptionCategory.USER, stability = OptionStability.STABLE, usageSyntax = "[0, inf)", // + deprecated = true, deprecationMessage = "Option no longer has any effect and can be safely omitted.")// public static final OptionKey AsyncParsingStackSize = new OptionKey<>(0); @Option(help = "A comma-separated list of pre-opened Wasi directories.", category = OptionCategory.USER, stability = OptionStability.STABLE, usageSyntax = "[::],[::],...")//