Skip to content

Using Channel to load Java classes #13238

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 64 commits into from
Jun 18, 2025
Merged

Conversation

JaroslavTulach
Copy link
Member

@JaroslavTulach JaroslavTulach commented Jun 6, 2025

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
  • 53b2490 creates new jvm-channel module with less dependencies than os-environment has
  • f0cff3d 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:

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

@JaroslavTulach JaroslavTulach self-assigned this Jun 6, 2025
@JaroslavTulach JaroslavTulach requested a review from 4e6 as a code owner June 6, 2025 17:21
@JaroslavTulach JaroslavTulach added the CI: No changelog needed Do not require a changelog entry for this PR. label Jun 6, 2025
@JaroslavTulach JaroslavTulach marked this pull request as draft June 6, 2025 17:21
Copy link

github-actions bot commented Jun 6, 2025

✨ 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.

@enso-bot enso-bot bot mentioned this pull request Jun 7, 2025
3 tasks
@JaroslavTulach JaroslavTulach linked an issue Jun 9, 2025 that may be closed by this pull request
3 tasks
@JaroslavTulach JaroslavTulach force-pushed the wip/jtulach/ChannelInJvm13172 branch from f1ec084 to 44edc03 Compare June 9, 2025 18:20
@JaroslavTulach
Copy link
Member Author

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
Copy link
Member Author

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

Copy link
Member

@Akirathan Akirathan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, let's get this in.

@JaroslavTulach JaroslavTulach added CI: Clean build required CI runners will be cleaned before and after this PR is built. labels Jun 17, 2025
Copy link
Member

@jdunkerley jdunkerley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approving my little bit!

@JaroslavTulach JaroslavTulach merged commit bd1dfc5 into develop Jun 18, 2025
74 of 76 checks passed
@JaroslavTulach JaroslavTulach deleted the wip/jtulach/ChannelInJvm13172 branch June 18, 2025 04:19
mergify bot pushed a commit that referenced this pull request Jun 25, 2025
…slf4j (#13356)

- One of the remaining problems in #13238
- was _"logging in the HotSpot JVM isn't configured"_
- which resulted in a lot of printed log messages
- by making `persistance` use the default `System.Logger` no messages shall appear
- as the default logger is configured to not log `DEBUG` messages by default
- moreover the use of `System.Logger` makes `persistance` _3rd party libraries free_
- while the logging behavior of `persistance` in the Enso runtime remains unchanged
- because of the bridge that delegates to _slf4j_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: Clean build required CI runners will be cleaned before and after this PR is built. CI: No changelog needed Do not require a changelog entry for this PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dual NI + JVM Mode for Loading Libraries
5 participants