mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8331734: Atomic MemorySegment VarHandle operations fails for element layouts
Reviewed-by: pminborg, psandoz
This commit is contained in:
parent
65abf24fde
commit
1c5f1501ac
3 changed files with 49 additions and 15 deletions
|
@ -26,6 +26,7 @@
|
|||
package jdk.internal.foreign;
|
||||
|
||||
import jdk.internal.vm.annotation.ForceInline;
|
||||
|
||||
import java.lang.foreign.AddressLayout;
|
||||
import java.lang.foreign.GroupLayout;
|
||||
import java.lang.foreign.MemoryLayout;
|
||||
|
@ -204,10 +205,7 @@ public class LayoutPath {
|
|||
String.format("Path does not select a value layout: %s", breadcrumbs()));
|
||||
}
|
||||
|
||||
// If we have an enclosing layout, drop the alignment check for the accessed element,
|
||||
// we check the root layout instead
|
||||
ValueLayout accessedLayout = enclosing != null ? valueLayout.withByteAlignment(1) : valueLayout;
|
||||
VarHandle handle = accessedLayout.varHandle();
|
||||
VarHandle handle = valueLayout.varHandle();
|
||||
handle = MethodHandles.collectCoordinates(handle, 1, offsetHandle());
|
||||
|
||||
// we only have to check the alignment of the root layout for the first dereference we do,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue