Skip to content

[GR-59780] [GR-53985] Add ForNameRespectsClassLoader and integrate Crema in the class loading path. #11235

New issue

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

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

Already on GitHub? # to your account

Closed
wants to merge 6 commits into from

Conversation

graalvmbot
Copy link
Collaborator

  • Introduce the experimental ForNameRespectsClassLoader option and use it in Crema:
    • Add class registries for class loaders, add classes at build time based on their defining class loader.
      • In crema mode add all classes.
      • Without crema, only classes that are configured for runtime reflection are added.
    • Those registries are used to serve Class.forName, ClassLoader.loadClass, and ClassLoader.findClass queries.
    • Use as much as possible of the standard class loading code from the JDK as possible. In particular let the class loader delegate to each other.
    • Even without crema, classes might be added to the registries as those represent the set of classes for which a class loader was an "initiating class loader".
    • Add class loading scopes experimental API to allow ignoring the reflection configuration in explicit scopes.
    • In the crema case, wire class definition (ClassLoader.defineClass) to the shared class file parser.
  • Move espresso shared code to a separate suite and apply CPE
  • Shade espresso shared code for usage in svm to avoid conflicts with espresso shared code used in application code (e.g., espresso native images)
  • Avoid usage of TruffleLogger in espresso.classfile
  • Add hellocrema command to exercise class loading
  • Rename SupportRuntimeClassLoading option to RuntimeClassLoading
  • Minor javadoc fix

Some things are left out in this PR and will need to be addressed / done separately:

  • Proper package mapping for module support (package -> module maps in class loaders as defined by Module.defineModule0) GR-62339
  • Layer support for the ClassRegistryFeature
  • Parallel class loading support GR-62338
  • JVMS Loading constraints GR-62320

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label May 21, 2025
If a hosted method is renamed for the sake of unique names generated in
`HostedMethod#create0`, ensure that reflection still uses the original
name.
* Add class registries for class loaders, add classes at build time
  based on their defining class loader.
* In crema mode add all classes. Without crema, only classes that are
  configured for runtime reflection are added.
* Use as much as possible of the standard class loading code from the
  JDK as possible.
* Add ClassLoading scopes experimental API to allow ignoring the
  reflection configuration in explicit scopes.
* In the crema case, wire class definition to the shared class file
  parser.
* Shade espresso shared code for usage in svm to avoid conflicts with
  espresso shared code used in application code (e.g., espresso native
  images)
* Add hellocrema command to exercise class loading
@graalvmbot graalvmbot closed this May 22, 2025
@graalvmbot graalvmbot deleted the gd/crema branch May 22, 2025 17:22
# for free to join this conversation on GitHub. Already have an account? # 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.

2 participants