enso icon indicating copy to clipboard operation
enso copied to clipboard

Using `Channel` to load Java classes

Open JaroslavTulach opened this issue 10 months ago • 3 comments

Pull Request Description

  • Provides an opt-in implementation to load classes via HotSpot JVM even when running in native image mode
  • Use --vm.D=polyglot.enso.classLoading option - more detail to turn the mode on
  • 53b24903e5cc69c9becd62a98c8a441e51619f95 creates new jvm-channel module with less dependencies than os-environment has
    • just a refactoring of code introduced by #13206
  • f0cff3dc9572d01534e0efd66a004340d9c16b1f creates a unit test using Channel in a single JVM
  • Use Channel in jvm-interop project to implement InteropLibrary messages: 9c129de
  • connect EnsoContext and jvm-interop in e41d046
  • use the jvm-interop to start HotSpot JVM and load a class if it is not in native image

Pros

Pending Future Features

  • logging in the HotSpot JVM isn't configured
  • there is no GC support - what's allocated stays allocated

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • [x] All code follows the Scala, Java,
  • [x] Unit tests have been written where possible.

JaroslavTulach avatar Jun 06 '25 17:06 JaroslavTulach

✨ GUI Checks Results

Summary

  • 🧹 Prettier: ✅ Passed
  • 🧰 GUI Checks: ❌ Failed
  • 📚 Storybook: ❌ Failed

⚠️ Action Required: Please review the failed checks and fix them before merging.

See individual check results for more details.

github-actions[bot] avatar Jun 06 '25 17:06 github-actions[bot]

With 4f373cd we can run some of the Generic_JDBC_Tests in the dual JVM mode:

$ ENSO_LAUNCHER=native,-ls,fast sbt
sbt:enso> runEngineDistribution --run test/Generic_JDBC_Tests
11 tests succeeded.
11 tests failed.
0 tests skipped.
0 groups skipped.

JaroslavTulach avatar Jun 17 '25 06:06 JaroslavTulach

I've turned the whole infrastructure into an opt-in feature. I'd like to integrate now. Please review the PR.

JaroslavTulach avatar Jun 17 '25 08:06 JaroslavTulach