changeset 60074:5986dc015a9f

Merge
author jwilhelm
date Tue, 07 Jul 2020 03:12:11 +0200
parents a5852eb26137 2b603ab47450
children a37f2e2b6fee
files src/hotspot/share/opto/cfgnode.cpp src/hotspot/share/opto/memnode.cpp src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/LauncherData.java
diffstat 7 files changed, 110 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/opto/cfgnode.cpp	Mon Jul 06 17:52:52 2020 -0700
+++ b/src/hotspot/share/opto/cfgnode.cpp	Tue Jul 07 03:12:11 2020 +0200
@@ -1334,6 +1334,30 @@
     if (id != NULL)  return id;
   }
 
+  // Looking for phis with identical inputs.  If we find one that has
+  // type TypePtr::BOTTOM, replace the current phi with the bottom phi.
+  if (phase->is_IterGVN() && type() == Type::MEMORY && adr_type() !=
+      TypePtr::BOTTOM && !adr_type()->is_known_instance()) {
+    uint phi_len = req();
+    Node* phi_reg = region();
+    for (DUIterator_Fast imax, i = phi_reg->fast_outs(imax); i < imax; i++) {
+      Node* u = phi_reg->fast_out(i);
+      if (u->is_Phi() && u->as_Phi()->type() == Type::MEMORY &&
+          u->adr_type() == TypePtr::BOTTOM && u->in(0) == phi_reg &&
+          u->req() == phi_len) {
+        for (uint j = 1; j < phi_len; j++) {
+          if (in(j) != u->in(j)) {
+            u = NULL;
+            break;
+          }
+        }
+        if (u != NULL) {
+          return u;
+        }
+      }
+    }
+  }
+
   return this;                     // No identity
 }
 
--- a/src/hotspot/share/opto/memnode.cpp	Mon Jul 06 17:52:52 2020 -0700
+++ b/src/hotspot/share/opto/memnode.cpp	Tue Jul 07 03:12:11 2020 +0200
@@ -4601,24 +4601,6 @@
     }
     // else preceding memory was not a MergeMem
 
-    // replace equivalent phis (unfortunately, they do not GVN together)
-    if (new_mem != NULL && new_mem != new_base &&
-        new_mem->req() == phi_len && new_mem->in(0) == phi_reg) {
-      if (new_mem->is_Phi()) {
-        PhiNode* phi_mem = new_mem->as_Phi();
-        for (uint i = 1; i < phi_len; i++) {
-          if (phi_base->in(i) != phi_mem->in(i)) {
-            phi_mem = NULL;
-            break;
-          }
-        }
-        if (phi_mem != NULL) {
-          // equivalent phi nodes; revert to the def
-          new_mem = new_base;
-        }
-      }
-    }
-
     // maybe store down a new value
     Node* new_in = new_mem;
     if (new_in == new_base)  new_in = empty_mem;
--- a/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/LauncherData.java	Mon Jul 06 17:52:52 2020 -0700
+++ b/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/LauncherData.java	Tue Jul 07 03:12:11 2020 +0200
@@ -231,10 +231,11 @@
         if (inputDir == null) {
             classPath = Collections.emptyList();
         } else {
-            try (Stream<Path> walk = Files.walk(inputDir, 1)) {
+            try (Stream<Path> walk = Files.walk(inputDir, Integer.MAX_VALUE)) {
                 Set<Path> jars = walk.filter(Files::isRegularFile)
                         .filter(file -> file.toString().endsWith(".jar"))
-                        .map(Path::getFileName)
+                        .map(p -> inputDir.toAbsolutePath()
+                                  .relativize(p.toAbsolutePath()))
                         .collect(Collectors.toSet());
                 jars.remove(mainJarName);
                 classPath = jars.stream().sorted().collect(Collectors.toList());
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/c2/TestReplaceEquivPhis.java	Tue Jul 07 03:12:11 2020 +0200
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2020, Huawei Technologies Co. Ltd. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8243670
+ * @summary Unexpected test result caused by C2 MergeMemNode::Ideal
+ *
+ * @run main/othervm -Xcomp -XX:-SplitIfBlocks
+ *      -XX:CompileOnly=compiler.c2.TestReplaceEquivPhis::test
+ *      -XX:-BackgroundCompilation compiler.c2.TestReplaceEquivPhis
+ */
+
+package compiler.c2;
+
+public class TestReplaceEquivPhis {
+
+    public static final int N = 400;
+    public static volatile int instanceCount = 0;
+    public int iFld = 0;
+    public static int iArrFld[] = new int[N];
+
+    public int test() {
+        int v = 0;
+        boolean bArr[] = new boolean[N];
+
+        for (int i = 1; i < 344; i++) {
+            iFld = i;
+            for (int j = 2; j <177 ; j++) {
+                v = iFld;
+                iFld = TestReplaceEquivPhis.instanceCount;
+                TestReplaceEquivPhis.iArrFld[i] = 0;
+                iFld += TestReplaceEquivPhis.instanceCount;
+                TestReplaceEquivPhis.iArrFld[i] = 0;
+                bArr[j] = false;
+                TestReplaceEquivPhis.instanceCount = 1;
+
+                for (int k = 1; k < 3; k++) {
+                    // do nothing
+                }
+            }
+        }
+        return v;
+    }
+
+    public static void main(String[] args) {
+            TestReplaceEquivPhis obj = new TestReplaceEquivPhis();
+            for (int i = 0; i < 5; i++) {
+                int result = obj.test();
+                if (result != 2) {
+                    throw new RuntimeException("Test failed.");
+                }
+            }
+            System.out.println("Test passed.");
+    }
+
+}
--- a/test/hotspot/jtreg/serviceability/dcmd/gc/HeapDumpCompressedTest.java	Mon Jul 06 17:52:52 2020 -0700
+++ b/test/hotspot/jtreg/serviceability/dcmd/gc/HeapDumpCompressedTest.java	Tue Jul 07 03:12:11 2020 +0200
@@ -72,7 +72,7 @@
 
 /*
  * @test
- * @requires vm.gc.Z
+ * @requires vm.gc.Z & !vm.graal.enabled
  * @summary Test of diagnostic command GC.heap_dump with gzipped output (Z GC)
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
@@ -84,7 +84,7 @@
 
 /*
  * @test
- * @requires vm.gc.Shenandoah
+ * @requires vm.gc.Shenandoah & !vm.graal.enabled
  * @summary Test of diagnostic command GC.heap_dump with gzipped output (Shenandoah GC)
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
@@ -96,7 +96,7 @@
 
 /*
  * @test
- * @requires vm.gc.Epsilon
+ * @requires vm.gc.Epsilon & !vm.graal.enabled
  * @summary Test of diagnostic command GC.heap_dump with gzipped output (Epsilon GC)
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
--- a/test/jdk/TEST.ROOT	Mon Jul 06 17:52:52 2020 -0700
+++ b/test/jdk/TEST.ROOT	Tue Jul 07 03:12:11 2020 +0200
@@ -24,7 +24,7 @@
 # Tests that cannot run concurrently
 exclusiveAccess.dirs=java/math/BigInteger/largeMemory \
 java/rmi/Naming java/util/prefs sun/management/jmxremote \
-sun/tools/jstatd sun/tools/jcmd sun/tools/jhsdb sun/tools/jhsdb/heapconfig \
+sun/tools/jstatd sun/tools/jcmd \
 sun/tools/jinfo sun/tools/jmap sun/tools/jps sun/tools/jstack sun/tools/jstat \
 com/sun/tools/attach sun/security/mscapi java/util/stream java/util/Arrays/largeMemory \
 java/util/BitSet/stream javax/rmi
--- a/test/jdk/java/security/SecureRandom/ThreadSafe.java	Mon Jul 06 17:52:52 2020 -0700
+++ b/test/jdk/java/security/SecureRandom/ThreadSafe.java	Tue Jul 07 03:12:11 2020 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -87,7 +87,7 @@
             }
             inCall = true;
             try {
-                Thread.sleep(100);
+                Thread.sleep(500);
             } catch (Exception e) {
                 // OK
             }