On Fri, 23 Oct 2020 14:45:22 GMT, Aleksey Shipilev <sh...@openjdk.org> wrote:

>> Ok - I understand at least why JDK-8254162 fixed it - JDK-8254162 uses a new 
>> API to access memory (MemoryAccess) which disables alignment checks, so 
>> that's why the issue doesn't happen. But that means that there could be a 
>> latent issue in the test. Looking deeper.
>
> Thing is, I don't think there is a way to problem list the _TestNG_ testcase, 
> is it? There is only a way to problem list the entire jtreg test or its 
> separate `@run` with ID. Which is what the patch does. I would think that 
> `generic-i586` only touches `x86_32`, and thus the test, while disabled 
> there, is still operational on every other platform.
> 
> I would love if there is was pointed fix that resolves the actual issue, 
> though.

Can you see if this helps?

diff --git 
a/test/jdk/java/util/stream/test/org/openjdk/tests/java/util/stream/SegmentTestDataProvider.java
 
b/test/jdk/java/util/stream/test/org/openjdk/tests/java/util/stream/SegmentTestDataProvider.java
index 2d2d33d0ab7..c5410865a2b 100644
--- 
a/test/jdk/java/util/stream/test/org/openjdk/tests/java/util/stream/SegmentTestDataProvider.java
+++ 
b/test/jdk/java/util/stream/test/org/openjdk/tests/java/util/stream/SegmentTestDataProvider.java
@@ -40,12 +40,12 @@ import org.testng.annotations.DataProvider;
 public class SegmentTestDataProvider {
 
     static VarHandle BYTE_HANDLE = 
MemoryLayouts.JAVA_BYTE.varHandle(byte.class);
-    static VarHandle CHAR_HANDLE = 
MemoryLayouts.JAVA_CHAR.varHandle(char.class);
-    static VarHandle SHORT_HANDLE = 
MemoryLayouts.JAVA_SHORT.varHandle(short.class);
-    static VarHandle INT_HANDLE = MemoryLayouts.JAVA_INT.varHandle(int.class);
-    static VarHandle LONG_HANDLE = 
MemoryLayouts.JAVA_LONG.varHandle(long.class);
-    static VarHandle FLOAT_HANDLE = 
MemoryLayouts.JAVA_FLOAT.varHandle(float.class);
-    static VarHandle DOUBLE_HANDLE = 
MemoryLayouts.JAVA_DOUBLE.varHandle(double.class);
+    static VarHandle CHAR_HANDLE = 
MemoryLayouts.JAVA_CHAR.withBitAlignment(8).varHandle(char.class);
+    static VarHandle SHORT_HANDLE = 
MemoryLayouts.JAVA_SHORT.withBitAlignment(8).varHandle(short.class);
+    static VarHandle INT_HANDLE = 
MemoryLayouts.JAVA_INT.withBitAlignment(8).varHandle(int.class);
+    static VarHandle LONG_HANDLE = 
MemoryLayouts.JAVA_LONG.withBitAlignment(8).varHandle(long.class);
+    static VarHandle FLOAT_HANDLE = 
MemoryLayouts.JAVA_FLOAT.withBitAlignment(8).varHandle(float.class);
+    static VarHandle DOUBLE_HANDLE = 
MemoryLayouts.JAVA_DOUBLE.withBitAlignment(8).varHandle(double.class);
 
     static boolean compareSegmentsByte(Collection<MemorySegment> segments1, 
Collection<MemorySegment> segments2, boolean isOrdered) {
:
ass);
-    static VarHandle INT_HANDLE = MemoryLayouts.JAVA_INT.varHandle(int.class);
-    static VarHandle LONG_HANDLE = 
MemoryLayouts.JAVA_LONG.varHandle(long.class);
-    static VarHandle FLOAT_HANDLE = 
MemoryLayouts.JAVA_FLOAT.varHandle(float.class);
-    static VarHandle DOUBLE_HANDLE = 
MemoryLayouts.JAVA_DOUBLE.varHandle(double.class);
+    static VarHandle CHAR_HANDLE = 
MemoryLayouts.JAVA_CHAR.withBitAlignment(8).varHandle(char.class);
+    static VarHandle SHORT_HANDLE = 
MemoryLayouts.JAVA_SHORT.withBitAlignment(8).varHandle(short.class);
+    static VarHandle INT_HANDLE = 
MemoryLayouts.JAVA_INT.withBitAlignment(8).varHandle(int.class);
+    static VarHandle LONG_HANDLE = 
MemoryLayouts.JAVA_LONG.withBitAlignment(8).varHandle(long.class);
+    static VarHandle FLOAT_HANDLE = 
MemoryLayouts.JAVA_FLOAT.withBitAlignment(8).varHandle(float.class);
+    static VarHandle DOUBLE_HANDLE = 
MemoryLayouts.JAVA_DOUBLE.withBitAlignment(8).varHandle(double.class);
 
     static boolean compareSegmentsByte(Collection<MemorySegment> segments1, 
Collection<MemorySegment> segments2, boolean isOrdered) {
         Function<MemorySegment, Byte> mapper = segment -> 
(byte)BYTE_HANDLE.get(segment.baseAddress());

-------------

PR: https://git.openjdk.java.net/jdk/pull/836

Reply via email to