Skip to content
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

Recognize and handle Memory Segment View VarHandles in JDK21+ #19662

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nbhuiyan
Copy link
Member

This PR enables UnsafeFastPath transformation to fast-path Unsafe operations that are part of Memory Segment View VarHandle usage in JDK 21 and above.

This PR depends on #19566, and will remain in draft state until it is merged.

@nbhuiyan
Copy link
Member Author

@jdmpapin @0xdaryl FYI

Signed-off-by: Nazim Bhuiyan <nubhuiyan@ibm.com>
@nbhuiyan nbhuiyan marked this pull request as ready for review June 13, 2024 14:57
@nbhuiyan nbhuiyan requested a review from dsouzai as a code owner June 13, 2024 14:57
@nbhuiyan
Copy link
Member Author

@jdmpapin requesting review

@jdmpapin
Copy link
Contributor

I don't think there should be extra auxiliary unsafe accesses (like the ones in byte buffer view handles) that this would mess up

However, this will attempt to transform get/put as array operations even if arraylets are in use, and that will generate a SpineCHK which IIUC will unconditionally load the contiguous length field and unexpectedly segfault when the base object is null

Soon this would also be expected to transform get/put as array operations even with off-heap arrays, which similarly will generate an unconditional load, but this time of the data address field

If we're sure that the base object for these accesses is always null - which it looked to be at a glance, but I don't really know - then we could treat them as non-array accesses, but only for int, long, float, and double. Accesses to narrow integral values in native memory would need to compute the address as though for non-array/null but then load from it in the same way as we do for array elements (i.e. narrow load + extend)

At the moment I think it will suffice to decline to transform if arraylets or off-heap are enabled. Once you rebase and pick up #19731 to resolve the conflicts (sorry), maybe it would make sense to update the isVarHandleOperationMethod() wrapper function for this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants