Skip to content

Commit 939b77f

Browse files
committed
[GR-57984] Deprecate the GraalWasm AsyncParsing options.
PullRequest: graal/19751
2 parents bad5414 + df3fdf8 commit 939b77f

File tree

3 files changed

+8
-46
lines changed

3 files changed

+8
-46
lines changed

wasm/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ This changelog summarizes major changes to the WebAssembly engine implemented in
55
## Version 24.2.0
66

77
* Updated developer metadata of Maven artifacts.
8+
* Deprecated the `--wasm.AsyncParsingBinarySize` and `--wasm.AsyncParsingStackSize` options. These options no longer have any effect and will be removed in a future release.
89

910
## Version 24.1.0
1011

wasm/src/org.graalvm.wasm/src/org/graalvm/wasm/WasmInstantiator.java

Lines changed: 2 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* The Universal Permissive License (UPL), Version 1.0
@@ -50,8 +50,6 @@
5050
import org.graalvm.collections.MapCursor;
5151
import org.graalvm.wasm.constants.BytecodeBitEncoding;
5252
import org.graalvm.wasm.constants.SegmentMode;
53-
import org.graalvm.wasm.exception.Failure;
54-
import org.graalvm.wasm.exception.WasmException;
5553
import org.graalvm.wasm.memory.WasmMemory;
5654
import org.graalvm.wasm.memory.WasmMemoryFactory;
5755
import org.graalvm.wasm.nodes.WasmCallStubNode;
@@ -74,22 +72,6 @@
7472
* Creates wasm instances by converting parser nodes into Truffle nodes.
7573
*/
7674
public class WasmInstantiator {
77-
private static final int MIN_DEFAULT_STACK_SIZE = 1_000_000;
78-
private static final int MAX_DEFAULT_ASYNC_STACK_SIZE = 10_000_000;
79-
80-
private static final class ParsingExceptionHandler implements Thread.UncaughtExceptionHandler {
81-
private Throwable parsingException = null;
82-
83-
@Override
84-
public void uncaughtException(Thread t, Throwable e) {
85-
this.parsingException = e;
86-
}
87-
88-
public Throwable parsingException() {
89-
return parsingException;
90-
}
91-
}
92-
9375
private final WasmLanguage language;
9476

9577
@TruffleBoundary
@@ -101,30 +83,7 @@ public WasmInstantiator(WasmLanguage language) {
10183
public WasmInstance createInstance(WasmContext context, WasmModule module, TruffleContext truffleContext) {
10284
WasmInstance instance = new WasmInstance(context, module, truffleContext);
10385
instance.createLinkActions();
104-
int binarySize = instance.module().bytecodeLength();
105-
final int asyncParsingBinarySize = WasmOptions.AsyncParsingBinarySize.getValue(context.environment().getOptions());
106-
if (binarySize < asyncParsingBinarySize || !context.environment().isCreateThreadAllowed()) {
107-
instantiateCodeEntries(context, instance);
108-
} else {
109-
final Runnable parsing = () -> instantiateCodeEntries(context, instance);
110-
final String name = "wasm-parsing-thread(" + instance.name() + ")";
111-
final int requestedSize = WasmOptions.AsyncParsingStackSize.getValue(context.environment().getOptions()) * 1000;
112-
final int defaultSize = Math.max(MIN_DEFAULT_STACK_SIZE, Math.min(2 * binarySize, MAX_DEFAULT_ASYNC_STACK_SIZE));
113-
final int stackSize = requestedSize != 0 ? requestedSize : defaultSize;
114-
final Thread parsingThread = context.environment().newTruffleThreadBuilder(parsing).stackSize(stackSize).build();
115-
parsingThread.setName(name);
116-
final ParsingExceptionHandler handler = new ParsingExceptionHandler();
117-
parsingThread.setUncaughtExceptionHandler(handler);
118-
parsingThread.start();
119-
try {
120-
parsingThread.join();
121-
if (handler.parsingException() != null) {
122-
throw WasmException.create(Failure.UNSPECIFIED_INVALID, "Asynchronous parsing failed.");
123-
}
124-
} catch (InterruptedException e) {
125-
throw WasmException.create(Failure.UNSPECIFIED_INVALID, "Asynchronous parsing interrupted.");
126-
}
127-
}
86+
instantiateCodeEntries(context, instance);
12887
return instance;
12988
}
13089

wasm/src/org.graalvm.wasm/src/org/graalvm/wasm/WasmOptions.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* The Universal Permissive License (UPL), Version 1.0
@@ -51,10 +51,12 @@ public class WasmOptions {
5151
@Option(help = "A comma-separated list of builtin modules to use.", category = OptionCategory.USER, stability = OptionStability.STABLE, usageSyntax = "[<linkingName>:]<builtinModuleName>,[<linkingName>:]<builtinModuleName>,...")//
5252
public static final OptionKey<String> Builtins = new OptionKey<>("");
5353

54-
@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)")//
54+
@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)", //
55+
deprecated = true, deprecationMessage = "Option no longer has any effect and can be safely omitted.")//
5556
public static final OptionKey<Integer> AsyncParsingBinarySize = new OptionKey<>(100_000);
5657

57-
@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)")//
58+
@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)", //
59+
deprecated = true, deprecationMessage = "Option no longer has any effect and can be safely omitted.")//
5860
public static final OptionKey<Integer> AsyncParsingStackSize = new OptionKey<>(0);
5961

6062
@Option(help = "A comma-separated list of pre-opened Wasi directories.", category = OptionCategory.USER, stability = OptionStability.STABLE, usageSyntax = "[<virtualDir>::]<hostDir>,[<virtualDir>::]<hostDir>,...")//

0 commit comments

Comments
 (0)