File: jdk-8370049-proposed.patch

package info (click to toggle)
openjdk-25 25.0.1%2B8-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 825,408 kB
  • sloc: java: 5,585,680; cpp: 1,333,948; xml: 1,321,242; ansic: 488,034; asm: 404,003; objc: 21,088; sh: 15,106; javascript: 13,265; python: 8,319; makefile: 2,518; perl: 357; awk: 351; pascal: 103; exp: 83; sed: 72; jsp: 24
file content (59 lines) | stat: -rw-r--r-- 2,613 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
Description: [s390x] G1 barrier compareAndExchange does not return old value when compareExchange fails
 Correct typo in g1CompareAndExchangeP
Author: Vladimir Petko <vladimir.petko@canonical.com>
Origin: upstream, https://github.com/openjdk/jdk/pull/27857
Bug: https://bugs.openjdk.org/browse/JDK-8370049
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/openjdk-25/+bug/2127750
Last-Update: 2025-10-20

diff --git a/src/hotspot/cpu/s390/gc/g1/g1_s390.ad b/src/hotspot/cpu/s390/gc/g1/g1_s390.ad
index 7aed374fdae..000ac3bc5ba 100644
--- a/src/hotspot/cpu/s390/gc/g1/g1_s390.ad
+++ b/src/hotspot/cpu/s390/gc/g1/g1_s390.ad
@@ -356,7 +356,7 @@ instruct g1CompareAndExchangeP(iRegP mem_ptr, rarg5RegP oldval, iRegP_N2P newval

     __ z_lgr($res$$Register, $oldval$$Register); // previous content

-    __ z_csg($oldval$$Register, $newval$$Register, 0, $mem_ptr$$reg);
+    __ z_csg($res$$Register, $newval$$Register, 0, $mem_ptr$$reg);

     write_barrier_post(masm, this,
                        $mem_ptr$$Register /* store_addr */,
diff --git a/test/hotspot/jtreg/compiler/gcbarriers/TestG1BarrierGeneration.java b/test/hotspot/jtreg/compiler/gcbarriers/TestG1BarrierGeneration.java
index 01e015d50cb..c1e2dd7a112 100644
--- a/test/hotspot/jtreg/compiler/gcbarriers/TestG1BarrierGeneration.java
+++ b/test/hotspot/jtreg/compiler/gcbarriers/TestG1BarrierGeneration.java
@@ -880,6 +880,16 @@ public void runAtomicTests() {
             Asserts.assertEquals(oldVal, oldVal2);
             Asserts.assertEquals(o.f, newVal);
         }
+        {
+            Outer o = new Outer();
+            Object oldVal = new Object();
+            o.f = oldVal;
+            Object cmpVal = new Object();
+            Object newVal = new Object();
+            Object oldVal2 = testCompareAndExchange(o, cmpVal, newVal);
+            Asserts.assertEquals(oldVal2, oldVal);
+            Asserts.assertEquals(o.f, oldVal);
+        }
         {
             Outer o = new Outer();
             Object oldVal = new Object();
@@ -889,6 +899,16 @@ public void runAtomicTests() {
             Asserts.assertTrue(b);
             Asserts.assertEquals(o.f, newVal);
         }
+        {
+            Outer o = new Outer();
+            Object oldVal = new Object();
+            o.f = oldVal;
+            Object cmpVal = new Object();
+            Object newVal = new Object();
+            boolean b = testCompareAndSwap(o, cmpVal, newVal);
+            Asserts.assertFalse(b);
+            Asserts.assertEquals(o.f, oldVal);
+        }
         {
             Outer o = new Outer();
             Object oldVal = new Object();