diff --git a/docs/reference-manual/native-image/BuildOptions.md b/docs/reference-manual/native-image/BuildOptions.md index 638b3cbc62af..fd704fd4405b 100644 --- a/docs/reference-manual/native-image/BuildOptions.md +++ b/docs/reference-manual/native-image/BuildOptions.md @@ -26,6 +26,7 @@ The following options are supported across both GraalVM Community and Enterprise * `--enable-all-security-services`: add all security service classes to a native executable * `--enable-http`: enable HTTP support in a native executable * `--enable-https`: enable HTTPS support in a native executable +* `--enable-preview`: allow classes to depend on preview features of this release * `--enable-url-protocols`: list comma-separated URL protocols to enable * `--features`: a comma-separated list of fully qualified [Feature implementation classes](https://www.graalvm.org/sdk/javadoc/index.html?org/graalvm/nativeimage/hosted/Feature.html) * `--force-fallback`: force building of a fallback native executable diff --git a/substratevm/CHANGELOG.md b/substratevm/CHANGELOG.md index 2c885923aa66..f009c25a25e8 100644 --- a/substratevm/CHANGELOG.md +++ b/substratevm/CHANGELOG.md @@ -8,7 +8,7 @@ This changelog summarizes major changes to GraalVM Native Image. * (GR-39497) Add `-H:BuildOutputJSONFile=` option for [JSON build output](https://github.com/oracle/graal/edit/master/docs/reference-manual/native-image/BuildOutput.md#machine-readable-build-output). Please feel free to provide feedback so that we can stabilize the schema/API. * (GR-40170) Add `--silent` option to silence the build output. * (GR-39475) Add initial support for jvmstat. -* (GR-39563) Add support for JDK 19 and Project Loom Virtual Threads (JEP 425) for high-throughput lightweight concurrency. Enable on JDK 19 with `native-image -J--enable-preview`. +* (GR-39563) Add support for JDK 19 and Project Loom Virtual Threads (JEP 425) for high-throughput lightweight concurrency. Enable on JDK 19 with `native-image --enable-preview`. ## Version 22.2.0 * (GR-20653) Re-enable the usage of all CPU features for JIT compilation on AMD64. diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/thread/ContinuationsFeature.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/thread/ContinuationsFeature.java index f4fda4d6bf22..b0f2fc6ae0a9 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/thread/ContinuationsFeature.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/thread/ContinuationsFeature.java @@ -61,7 +61,7 @@ public void afterRegistration(AfterRegistrationAccess access) { * field, and unparking a virtual thread in additionalMonitorsLock.unlock causes a * deadlock between carrier thread and virtual thread. 17 uses a ReentrantLock. */ - throw UserError.abort("Continuations are currently supported only on JDK 17 with option %s, or on JDK 19 with preview features enabled (-J--enable-preview).", + throw UserError.abort("Continuations are currently supported only on JDK 17 with option %s, or on JDK 19 with preview features enabled (--enable-preview).", SubstrateOptionsParser.commandArgument(SubstrateOptions.SupportContinuations, "+")); } } diff --git a/substratevm/src/com.oracle.svm.driver/resources/Help.txt b/substratevm/src/com.oracle.svm.driver/resources/Help.txt index ecd266e15392..649685544f33 100644 --- a/substratevm/src/com.oracle.svm.driver/resources/Help.txt +++ b/substratevm/src/com.oracle.svm.driver/resources/Help.txt @@ -31,6 +31,7 @@ where options include: -J pass directly to the JVM running the image generator -O 0 - no optimizations, 1 - basic optimizations (default). --diagnostics-mode enable diagnostics output: class initialization, substitutions, etc. + --enable-preview allow classes to depend on preview features of this release --verbose enable verbose output --version print product version and exit --help print this help message diff --git a/substratevm/src/com.oracle.svm.driver/src/com/oracle/svm/driver/DefaultOptionHandler.java b/substratevm/src/com.oracle.svm.driver/src/com/oracle/svm/driver/DefaultOptionHandler.java index dad91b5861bb..e43c0b9ba8b7 100644 --- a/substratevm/src/com.oracle.svm.driver/src/com/oracle/svm/driver/DefaultOptionHandler.java +++ b/substratevm/src/com.oracle.svm.driver/src/com/oracle/svm/driver/DefaultOptionHandler.java @@ -124,6 +124,10 @@ public boolean consume(ArgumentQueue args) { args.poll(); NativeImage.showWarning("Ignoring server-mode native-image argument " + headArg + "."); return true; + case "--enable-preview": + args.poll(); + nativeImage.addCustomJavaArgs("--enable-preview"); + return true; } String singleArgClasspathPrefix = newStyleClasspathOptionName + "=";