Skip to content

[FFI/JDK22] Handle the discontiguous heap array in downcall #19263

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

Conversation

ChengJin01
Copy link

@ChengJin01 ChengJin01 commented Apr 2, 2024

The changes aim to address the case of discontiguous heap
array in the critical downcall by copying the heap array
to a native memory given the passed-in array in the native
function must be a contiguous one for native access.

Related: #17872

Signed-off-by: ChengJin01 [email protected]

@ChengJin01
Copy link
Author

ChengJin01 commented Apr 2, 2024

[1] The PR leverages the code in getArrayElementsImpl & releaseArrayElementsImpl by refactoring the code to move the related code from vm/jnimisc.cpp to vm/ArrayCopyHelpers.cpp to ensure it is shared in the existing JNI code and our FFI specific code.
[2] The changes manually debugged in applications with the balanced GC enabled proves to work well in the case of the discontiguous heap array (the debugging shows it is copied correctly back and forth between the discontiguous heap memory and the native memory).
[3] All heap specific test cases are moved to HeapArrayTests1 & HeapArrayTests2 so as to unify the tests with the heap arguments.
[4] The PR is verified in personal builds on all supported platform without any issue.

@ChengJin01
Copy link
Author

Reviewer: @tajila
FYI: @keithc-ca, @dmitripivkine, @pshipton

@ChengJin01 ChengJin01 added project:panama Used to track Project Panama related work jdk22 comp:vm labels Apr 2, 2024
@ChengJin01 ChengJin01 requested a review from tajila April 2, 2024 22:28
@ChengJin01 ChengJin01 force-pushed the ffi_handle_discontigous_heap_downcall_jdk22 branch 2 times, most recently from 2171583 to 67fcdd3 Compare April 2, 2024 22:32
@ChengJin01 ChengJin01 force-pushed the ffi_handle_discontigous_heap_downcall_jdk22 branch 5 times, most recently from 46d5f6a to 453d97e Compare April 3, 2024 23:30
@ChengJin01 ChengJin01 force-pushed the ffi_handle_discontigous_heap_downcall_jdk22 branch from 453d97e to 3f10fc1 Compare April 4, 2024 15:16
The changes aim to address the case of discontiguous heap
array in the critical downcall by copying the heap array
to a native memory given the passed-in array in the native
function must be a contiguous one for native access.

Related: eclipse-openj9#17872

Signed-off-by: ChengJin01 <[email protected]>
@ChengJin01 ChengJin01 force-pushed the ffi_handle_discontigous_heap_downcall_jdk22 branch from 3f10fc1 to fe4c358 Compare April 4, 2024 17:48
@tajila
Copy link
Contributor

tajila commented Apr 9, 2024

jenkins test sanity pinux jdk22

@tajila
Copy link
Contributor

tajila commented Apr 9, 2024

jenkins test sanity plinux jdk22

@tajila
Copy link
Contributor

tajila commented Apr 9, 2024

jenkins test sanity zlinux jdk22

@tajila
Copy link
Contributor

tajila commented Apr 9, 2024

jenkins test sanity win jdk8

@tajila
Copy link
Contributor

tajila commented Apr 9, 2024

jenkins test sanity aix jdk22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:vm jdk22 project:panama Used to track Project Panama related work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants