Skip to content

[GR-65035] Implement JSObject field accesses using JSStubMethods #11244

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

graalvmbot
Copy link
Collaborator

Slightly changes the interop API:

  • final fields are no longer allowed and will produce a UserError when an access is seen during graph building. It was already documented that way, but never enforced
  • Only public and protected fields are now allowed. Fields with private and default visibility now produce a UserError when an access is seen during graph building.

This only affects code that uses JSObject subclasses. There, for example compiling JSObjectSubclassTest reduces code size after closure by 15KB from 1536KB to 1521KB

patrick96 added 4 commits May 16, 2025 15:46
Every access generates a method call to a dynamically generated method
that is (implicitly) annotated with @js(...) to perform the access on
the JS side.

This replaces the more clunky ForeignCall-based implementation that
emitted all the necessary conversion/coercion code in-line at every
access.
It is not allowed by the API docs and now also forbidden in practice
This was the original intent. This way, not state is split between the
JS and Java mirror. It is also the less confusing behavior, allowing
private, fields, but not exposing them to JS, could be unexpected
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label May 22, 2025
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.

2 participants