Skip to content

Conversation

graalvmbot
Copy link
Collaborator

@graalvmbot graalvmbot commented Dec 23, 2024

This PR adds the org.graalvm.nativeimage.libgraal module. This provides a stable API for use by libgraal that is an extension to the standard Native Image API (i.e., the org.graalvm.nativeimage** packages here). Using this extended API, LibGraalFeature.java has been moved into compiler/, out of substratevm/. It no longer depends on Native Image internals, allowing any GraalVM binary that supports org.graalvm.nativeimage.libgraal to be used as a tool for building libgraal. This is a step towards Project Galahad.

Over time, some or all of jdk.graal.nativeimage may be moved into org.graalvm.nativeimage. This is a discussion to be had in follow-up PRs.

The API changes can most easily been seen in:

  • sdk/src/org.graalvm.nativeimage/snapshot.sigtest
  • sdk/src/org.graalvm.nativeimage.libgraal/snapshot.sigtest

A large part of the code changes comes from the fact that LibGraalFeature itself is now loaded by the LibGraalClassLoader which is separate from the Native Image class loader. This means the use of method handles to communicate between the "hosted" parts of libgraal (those loaded by the Native Image class loader) and the "guest" parts of libgraal has been removed. This is a large code reduction and makes the logic much easier to follow. It also means no more need for @NativeImageReinitialize as the Graal classes loaded for compiling into libgraal are different from those loaded to do the compilation and thus no longer need re-initializing.

Other changes of note:

  • The output of -Djdk.graal.ShowConfiguration=info has changed (and improved) slightly to also show the SVM GC algorithm used in libgraal.
    Before: Using "Graal Enterprise compiler with Truffle extensions" loaded from a PGO optimized Native Image shared library
    After: Using "Graal Enterprise compiler with Truffle extensions" loaded from a Native Image shared library (PGO optimized, gc=Serial GC)

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Dec 23, 2024
@graalvmbot graalvmbot force-pushed the ds/GR-60088 branch 13 times, most recently from a229752 to aeed0d5 Compare December 29, 2024 15:12
@graalvmbot graalvmbot force-pushed the ds/GR-60088 branch 8 times, most recently from ffd8bc9 to 7542c2f Compare January 9, 2025 11:25
@graalvmbot graalvmbot force-pushed the ds/GR-60088 branch 2 times, most recently from 0f47855 to 46bf4bb Compare January 13, 2025 15:45
@olpaw olpaw self-requested a review February 3, 2025 16:24
@olpaw
Copy link
Member

olpaw commented Feb 3, 2025

@dougxc thanks for keeping a separate commit for
8e72d71 - moved and deleted some libgraal sources
It makes reviewing the PR much more approachable.

olpaw
olpaw previously approved these changes Feb 10, 2025
@graalvmbot graalvmbot force-pushed the ds/GR-60088 branch 5 times, most recently from 01d7784 to 3eacb5c Compare February 11, 2025 22:01
@dougxc dougxc changed the title [GR-60088] Add jdk.graal.nativeimage module. [GR-60088] Add org.graalvm.nativeimage.libgraal module. Feb 12, 2025
@graalvmbot graalvmbot force-pushed the ds/GR-60088 branch 4 times, most recently from 4915c9c to 2db340b Compare February 13, 2025 12:32
* renamed LibGraalLoader.getModuleMap to getClassModuleMap
* replaced LibGraalLoader.getJavaHome with a protocol shared between HostedLibGraalClassLoader and LibGraalFeature
* removed LibGraalLoader.getRuntimeClassLoader
* remove LibGraalLoader.getServiceModules
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants