Skip to content

[GR-60208] [GR-52447] Trace FFM API calls in native image agent. #11270

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 1 commit into
base: master
Choose a base branch
from

Conversation

graalvmbot
Copy link
Collaborator

This implements agent support for FFM API usage.

The agent intercepts calls to AbstractLinker.downcallHandle0 and AbstractLinker.upcallStub and generates an appropriate foreign configuration file (i.e. foreign-config.json).
It also attempts to crack the target method handle for upcalls in order to generate a direct upcall.

The descriptor string for memory layouts are generated by recursively traversing the parameter and return layouts. This should be the most reliable approach because the classes are public JDK classes and won't easily change. The downside is that this may involve quite some JNI calls.
An alternative would be to parse the string representation of a memory layout which uses an undocumented format (with the risk to be changed) and is also ambiguous in some cases.

This PR also adds support for foreign configurations to the native-image-configure tool.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label May 27, 2025
@graalvmbot graalvmbot force-pushed the fa/GR-60208/ffm_api_agent_support branch from 06a27f2 to 7cd3d39 Compare May 27, 2025 14:23
@graalvmbot graalvmbot force-pushed the fa/GR-60208/ffm_api_agent_support branch from 7cd3d39 to 309e6d0 Compare May 28, 2025 05:03
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