Skip to content

[GR-52567] FFM API support for windows-amd64. #10788

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 1 commit into from
Feb 28, 2025

Conversation

graalvmbot
Copy link
Collaborator

Brings back FFM API support for windows-amd64.

There are two main changes to make that happen:

  1. Properly implement the system lookup (i.e. Linker.nativeLinker().defaultLookup()). The problem on Windows is that if the runtime library is ucrtbase.dll, functions like fprintf, fscanf, and all variants of it, are defined as inline functions. In order to make those symbols available for symbol lookups via the FFM API, we need to reference them in C code such that we force the compiler to generate those functions. I've therefore added an array to libchelper (file syslookup.c) which contains function pointers to those inline functions just like JDK does.
  2. Avoid generating incorrect reg2reg moves when saving callee-save registers in upcall stubs. We manually save those registers because the low-level upcall stub acts as a bridge between our custom (native) and the Java calling convention. The set of callee-save registers can be different and we cannot rely on the compiler to take care of this. However, we were emitting ReadRegisterNodes accessing all registers with word kind. This lead to the problem that a reg2reg move was emitted, that would move a value between registers of a different register category which triggered an assertion. For some reason, this happened only on Windows but is a potential problem on all other platforms as well.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Feb 27, 2025
@graalvmbot graalvmbot closed this Feb 28, 2025
@graalvmbot graalvmbot deleted the fa/GR-52567/reenable_win64_tests branch February 28, 2025 14:59
@graalvmbot graalvmbot merged commit 1635d4a into master Feb 28, 2025
12 of 13 checks passed
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