Handle --jvm flag in process with JNI instantiated JVM#12843
Handle --jvm flag in process with JNI instantiated JVM#12843mergify[bot] merged 65 commits intodevelopfrom
--jvm flag in process with JNI instantiated JVM#12843Conversation
--jvm flag in process with JNI instantiated JVM
aa4dae1 to
1efcc8f
Compare
|
Now the problem is in executing Generic_JDBC_Tests - e.g. the switch to JVM mode isn't yet working correctly: Unsatisfied link problem on Linux (update on May 7, 2025: got it working after removing java.desktop module from native image). We have linkage problem on Windows: Update on May 2, 2025: the Windows version works on GraalVM for JDK21, but not on any newer version! |
LinuxTrying to isolate the
looks like the set of enabled modules is the cause of the problem! With: diff --git build.sbt build.sbt
diff --git build.sbt build.sbt
index bbdeef42ce..00f114fa64 100644
$ git diff
diff --git build.sbt build.sbt
diff --git build.sbt build.sbt
index bbdeef42ce..764f9bf079 100644
--- build.sbt
+++ build.sbt
@@ -3912,7 +3912,7 @@ lazy val `engine-runner` = project
val NI_MODULES =
"org.graalvm.nativeimage,org.graalvm.nativeimage.builder,org.graalvm.nativeimage.base,org.graalvm.nativeimage.driver,org.graalvm.nativeimage.librarysupport,org.graalvm.nativeimage.objectfile,org.graalvm.nativeimage.pointsto,com.oracle.graal.graal_enterprise,com.oracle.svm.svm_enterprise"
val JDK_MODULES =
- "java.desktop,java.naming,java.net.http,jdk.charsets,jdk.crypto.ec,jdk.localedata,jdk.httpserver,java.rmi"
+ "java.naming,java.net.http,jdk.charsets,jdk.crypto.ec,jdk.localedata,jdk.httpserver,java.rmi"
val DEBUG_MODULES = "jdk.jdwp.agent"
val PYTHON_MODULES = "jdk.security.auth,java.naming"it is possible to execute enso$ ./built-distribution/enso-engine-*/enso-*/bin/enso --jvm --run test/Base_Testsafter building native image executable with |
|
|
||
| @Override | ||
| public List<String> getLibraries() { | ||
| return List.of("jvm"); |
There was a problem hiding this comment.
- This may be the core cause of [Native Image] Dynamic loading of
jvm.dlldoesn't link - regression since GraalVM21? oracle/graal#11152 - the
jvm.liborjvm.objthen appears multiple times in the linkage
There was a problem hiding this comment.
- Let's see if it works in da05d8d!?
- Use the generated executable JaroslavTulach/LaunchJdkViaJni#3 indicates it could work
| ), | ||
| assemblyMergeStrategy := { case _ => | ||
| MergeStrategy.preferProject | ||
| } |
There was a problem hiding this comment.
- the commit 967e2ce starts with following idea
- define
poi-wrapperfat JAR - use that
poi-wrapperinstd-tableinstead of direct dependecy on poi - make sure the
poi-wrappercontains the necessary patches to avoid dependency onjava.desktop - I was hoping to find inspiration at Updating snakeyaml and removing no longer needed patches #11207 - but it doesn't define reusable fat JAR either!
There was a problem hiding this comment.
- done by @Akirathan at 179aff3
- thank you - it's a complicated change - I could never do it myself
- but the CI is green!
- finally we can move pass this JNI struggle...
| private static Map<Integer, HSSFColor> indexHash; | ||
| private static Map<HSSFColorPredefined, HSSFColor> enumList; | ||
|
|
||
| private final int index; |
There was a problem hiding this comment.
- Patches to avoid dependency on
java.desktopby Apache POI - proposal sent to upstream project
- once it is integrated
- let's switch to new POI version and remove this copy of
HSSFColor!
…ar, not other poi jars.
Akirathan
left a comment
There was a problem hiding this comment.
So if I understand it correctly, all the Standard Library Tests (jvm) use the new launch-in-the-same-process technique?
lib/java/os-environment/src/main/java/org/enso/os/environment/jni/JVM.java
Outdated
Show resolved
Hide resolved
lib/java/os-environment/src/main/java/org/enso/os/environment/jni/JVM.java
Outdated
Show resolved
Hide resolved
lib/java/os-environment/src/main/java/org/enso/os/environment/jni/JVM.java
Outdated
Show resolved
Hide resolved
lib/java/os-environment/src/main/java/org/enso/os/environment/jni/PosixJVM.java
Outdated
Show resolved
Hide resolved
lib/java/os-environment/src/main/java/org/enso/os/environment/jni/WindowsJVM.java
Outdated
Show resolved
Hide resolved
|
This change is already present in this Nightly Release:
These values should be smaller, because we removed |
Decreasing the maximum expected NI size of Linux by 30 MB. The new sizes (as reported in #12843 (comment)): - [Linux](https://github.com/enso-org/enso/actions/runs/14951454883/job/42001442578#step:10:3067) **404MB** - [MacOSX Arm](https://github.com/enso-org/enso/actions/runs/14951454883/job/42001442393#step:10:3076) **392MB** - [MacOSX Intel](https://github.com/enso-org/enso/actions/runs/14951454883/job/42001442260#step:10:2883) **377MB** - [Windows](https://github.com/enso-org/enso/actions/runs/14951454883/job/42001442715#step:10:3129) **390MB**
Fixes #12842 by designing a _JNI OS environment_, providing its implementations for supported platforms and using it to handle `--jvm` flag. All the _Standard Library Tests (jvm)_ use this new launch-in-the-same-process technique.
Decreasing the maximum expected NI size of Linux by 30 MB. The new sizes (as reported in #12843 (comment)): - [Linux](https://github.com/enso-org/enso/actions/runs/14951454883/job/42001442578#step:10:3067) **404MB** - [MacOSX Arm](https://github.com/enso-org/enso/actions/runs/14951454883/job/42001442393#step:10:3076) **392MB** - [MacOSX Intel](https://github.com/enso-org/enso/actions/runs/14951454883/job/42001442260#step:10:2883) **377MB** - [Windows](https://github.com/enso-org/enso/actions/runs/14951454883/job/42001442715#step:10:3129) **390MB**
Pull Request Description
Fixes #12842 by designing a JNI OS environment, providing its implementations for supported platforms and using it to handle
--jvmflag. All the Standard Library Tests (jvm) use this new launch-in-the-same-process technique.Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Scala,
Java,