changeset 9230:1e62a32a8517 jdk8u242-b01-aarch32-191129

Merge
author snazarki
date Fri, 29 Nov 2019 14:14:18 +0300
parents 90d7b3c8e368 ed8892ef0a8d
children 919f5da2b09c
files .hgtags src/share/vm/runtime/safepoint.cpp
diffstat 11 files changed, 314 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Wed Oct 16 16:46:54 2019 +0300
+++ b/.hgtags	Fri Nov 29 14:14:18 2019 +0300
@@ -1309,6 +1309,7 @@
 921c5ee7965fdfde75f578ddda24d5cd16f124dc jdk8u232-b04
 b13d7942036329f64c77a93cffc25e1b52523a3c jdk8u232-b05
 52c26cd6c7e2c7812c1a80d737916554a877838d jdk8u232-b05-aarch32-190906
+760b28d871785cd508239a5f635cfb45451f9202 jdk8u242-b00
 fea2c7f50ce8e6aee1e946eaec7b834193747d82 jdk8u232-b06
 c751303497d539aa85c6373aa0fa85580d3f3044 jdk8u232-b07
 6206dd7c35b8165f90aaccd3511a702e4265ee29 jdk8u232-b07-aarch32-190926
@@ -1318,3 +1319,4 @@
 12177d88b89c12c14daa5ad681030d7551e8a5a0 jdk8u232-ga
 fd0f7e6f5d8636bb654a35767bb700f880da1868 jdk8u232-b09-aarch32-191016
 0d7b61c79fee31075122f6ee338c31145653b094 jdk8u232-ga-aarch32-191016
+ce42ae95d4d671f74246091f89bd101d5bcbfd91 jdk8u242-b01
--- a/src/share/vm/c1/c1_LIR.cpp	Wed Oct 16 16:46:54 2019 +0300
+++ b/src/share/vm/c1/c1_LIR.cpp	Fri Nov 29 14:14:18 2019 +0300
@@ -2112,8 +2112,14 @@
 
 // LIR_OpProfileType
 void LIR_OpProfileType::print_instr(outputStream* out) const {
-  out->print("exact = "); exact_klass()->print_name_on(out);
-  out->print("current = "); ciTypeEntries::print_ciklass(out, current_klass());
+  out->print("exact = ");
+  if  (exact_klass() == NULL) {
+    out->print("unknown");
+  } else {
+    exact_klass()->print_name_on(out);
+  }
+  out->print(" current = "); ciTypeEntries::print_ciklass(out, current_klass());
+  out->print(" ");
   mdp()->print(out);          out->print(" ");
   obj()->print(out);          out->print(" ");
   tmp()->print(out);          out->print(" ");
--- a/src/share/vm/opto/loopTransform.cpp	Wed Oct 16 16:46:54 2019 +0300
+++ b/src/share/vm/opto/loopTransform.cpp	Fri Nov 29 14:14:18 2019 +0300
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, 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
@@ -2231,6 +2231,13 @@
     // We also need to replace the original limit to collapse loop exit.
     Node* cmp = cl->loopexit()->cmp_node();
     assert(cl->limit() == cmp->in(2), "sanity");
+    // Duplicate cmp node if it has other users
+    if (cmp->outcnt() > 1) {
+      cmp = cmp->clone();
+      cmp = phase->_igvn.register_new_node_with_optimizer(cmp);
+      BoolNode *bol = cl->loopexit()->in(CountedLoopEndNode::TestValue)->as_Bool();
+      phase->_igvn.replace_input_of(bol, 1, cmp); // put bol on worklist
+    }
     phase->_igvn._worklist.push(cmp->in(2)); // put limit on worklist
     phase->_igvn.replace_input_of(cmp, 2, exact_limit); // put cmp on worklist
   }
--- a/src/share/vm/opto/loopnode.hpp	Wed Oct 16 16:46:54 2019 +0300
+++ b/src/share/vm/opto/loopnode.hpp	Fri Nov 29 14:14:18 2019 +0300
@@ -279,6 +279,7 @@
     if (iv_phi == NULL) {
       return NULL;
     }
+    assert(iv_phi->is_Phi(), "should be PhiNode");
     Node *ln = iv_phi->in(0);
     if (ln->is_CountedLoop() && ln->as_CountedLoop()->loopexit() == this) {
       return (CountedLoopNode*)ln;
--- a/src/share/vm/opto/superword.cpp	Wed Oct 16 16:46:54 2019 +0300
+++ b/src/share/vm/opto/superword.cpp	Fri Nov 29 14:14:18 2019 +0300
@@ -448,6 +448,7 @@
     return true;   // no induction variable
   }
   CountedLoopEndNode* pre_end = get_pre_loop_end(lp()->as_CountedLoop());
+  assert(pre_end != NULL, "we must have a correct pre-loop");
   assert(pre_end->stride_is_con(), "pre loop stride is constant");
   int preloop_stride = pre_end->stride_con();
 
@@ -2052,7 +2053,7 @@
   CountedLoopNode *main_head = lp()->as_CountedLoop();
   assert(main_head->is_main_loop(), "");
   CountedLoopEndNode* pre_end = get_pre_loop_end(main_head);
-  assert(pre_end != NULL, "");
+  assert(pre_end != NULL, "we must have a correct pre-loop");
   Node *pre_opaq1 = pre_end->limit();
   assert(pre_opaq1->Opcode() == Op_Opaque1, "");
   Opaque1Node *pre_opaq = (Opaque1Node*)pre_opaq1;
@@ -2207,16 +2208,27 @@
 
 //----------------------------get_pre_loop_end---------------------------
 // Find pre loop end from main loop.  Returns null if none.
-CountedLoopEndNode* SuperWord::get_pre_loop_end(CountedLoopNode *cl) {
-  Node *ctrl = cl->in(LoopNode::EntryControl);
+CountedLoopEndNode* SuperWord::get_pre_loop_end(CountedLoopNode* cl) {
+  Node* ctrl = cl->in(LoopNode::EntryControl);
   if (!ctrl->is_IfTrue() && !ctrl->is_IfFalse()) return NULL;
-  Node *iffm = ctrl->in(0);
+  Node* iffm = ctrl->in(0);
   if (!iffm->is_If()) return NULL;
-  Node *p_f = iffm->in(0);
+  Node* bolzm = iffm->in(1);
+  if (!bolzm->is_Bool()) return NULL;
+  Node* cmpzm = bolzm->in(1);
+  if (!cmpzm->is_Cmp()) return NULL;
+  Node* opqzm = cmpzm->in(2);
+  // Can not optimize a loop if zero-trip Opaque1 node is optimized
+  // away and then another round of loop opts attempted.
+  if (opqzm->Opcode() != Op_Opaque1) {
+    return NULL;
+  }
+  Node* p_f = iffm->in(0);
   if (!p_f->is_IfFalse()) return NULL;
   if (!p_f->in(0)->is_CountedLoopEnd()) return NULL;
-  CountedLoopEndNode *pre_end = p_f->in(0)->as_CountedLoopEnd();
-  if (!pre_end->loopnode()->is_pre_loop()) return NULL;
+  CountedLoopEndNode* pre_end = p_f->in(0)->as_CountedLoopEnd();
+  CountedLoopNode* loop_node = pre_end->loopnode();
+  if (loop_node == NULL || !loop_node->is_pre_loop()) return NULL;
   return pre_end;
 }
 
--- a/src/share/vm/runtime/safepoint.cpp	Wed Oct 16 16:46:54 2019 +0300
+++ b/src/share/vm/runtime/safepoint.cpp	Fri Nov 29 14:14:18 2019 +0300
@@ -541,6 +541,7 @@
 
   // rotate log files?
   if (UseGCLogFileRotation) {
+    TraceTime t8("rotating gc logs", TraceSafepointCleanupTime);
     gclog_or_tty->rotate_log(false);
   }
 
--- a/src/share/vm/runtime/stubRoutines.cpp	Wed Oct 16 16:46:54 2019 +0300
+++ b/src/share/vm/runtime/stubRoutines.cpp	Fri Nov 29 14:14:18 2019 +0300
@@ -176,7 +176,7 @@
     StubGenerator_generate(&buffer, false);
     // When new stubs added we need to make sure there is some space left
     // to catch situation when we should increase size again.
-    assert(buffer.insts_remaining() > 200, "increase code_size1");
+    assert(code_size1 == 0 || buffer.insts_remaining() > 200, "increase code_size1");
   }
 }
 
@@ -231,7 +231,7 @@
     StubGenerator_generate(&buffer, true);
     // When new stubs added we need to make sure there is some space left
     // to catch situation when we should increase size again.
-    assert(buffer.insts_remaining() > 200, "increase code_size2");
+    assert(code_size2 == 0 || buffer.insts_remaining() > 200, "increase code_size2");
   }
 
 #ifdef ASSERT
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/compiler/loopopts/TestRemoveEmptyLoop.java	Fri Nov 29 14:14:18 2019 +0300
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2019, 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 8231988
+ * @summary Unexpected test result caused by C2 IdealLoopTree::do_remove_empty_loop
+ *
+ * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation
+ *      TestRemoveEmptyLoop
+ */
+
+public class TestRemoveEmptyLoop {
+
+    public void test() {
+        int i = 34;
+        for (; i > 0; i -= 11);
+        if (i < 0) {
+            // do nothing
+        } else {
+            throw new RuntimeException("Test failed.");
+        }
+    }
+
+    public static void main(String[] args) {
+        TestRemoveEmptyLoop _instance = new TestRemoveEmptyLoop();
+        for (int i = 0; i < 50000; i++) {
+            _instance.test();
+        }
+        System.out.println("Test passed.");
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/compiler/loopopts/superword/TestFuzzPreLoop.java	Fri Nov 29 14:14:18 2019 +0300
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2019, Red Hat, Inc. 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 8134739 8010500
+ * @summary SEGV in SuperWord::get_pre_loop_end
+ * @run main/othervm compiler.loopopts.superword.TestFuzzPreLoop
+ */
+
+package compiler.loopopts.superword;
+
+public class TestFuzzPreLoop {
+    static Object sink;
+    short sFld = -19206;
+
+    void doTest() {
+        int[] arr = new int[400];
+
+        for (int i1 = 0; i1 < 200; i1++) {
+            for (int i2 = 0; i2 < 100; i2++) {
+                sink = new int[400];
+            }
+            arr[i1] = 0;
+        }
+
+        float f1 = 0;
+        for (int i3 = 0; i3 < 200; i3++) {
+            f1 += i3 * i3;
+        }
+        for (int i4 = 0; i4 < 200; i4++) {
+            f1 += i4 - sFld;
+        }
+
+        System.out.println(arr);
+        System.out.println(f1);
+    }
+
+    public static void main(String... args) throws Exception {
+        TestFuzzPreLoop test = new TestFuzzPreLoop();
+        for (int i = 0; i < 100; i++) {
+            test.doTest();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/compiler/print/TestProfileReturnTypePrinting.java	Fri Nov 29 14:14:18 2019 +0300
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2015, 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
+ * 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 8073154
+ * @build TestProfileReturnTypePrinting
+ * @run main/othervm -XX:TypeProfileLevel=020
+ *                   -XX:CompileOnly=TestProfileReturnTypePrinting.testMethod
+ *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+PrintLIR
+ *                   TestProfileReturnTypePrinting
+ * @summary Verify that c1's LIR that contains ProfileType node could be dumped
+ *          without a crash disregard to an exact class knowledge.
+ */
+public class TestProfileReturnTypePrinting {
+    private static final int ITERATIONS = 1_000_000;
+
+    public static void main(String args[]) {
+        for (int i = 0; i < ITERATIONS; i++) {
+            TestProfileReturnTypePrinting.testMethod(i);
+        }
+    }
+
+    private static int testMethod(int i) {
+        return TestProfileReturnTypePrinting.foo().hashCode()
+                + TestProfileReturnTypePrinting.bar(i).hashCode();
+    }
+
+    /* Exact class of returned value is known statically. */
+    private static B foo() {
+        return new B();
+    }
+
+    /* Exact class of returned value is not known statically. */
+    private static Object bar(int i) {
+        if (i % 2 == 0) {
+            return new A();
+        } else {
+            return new B();
+        }
+    }
+
+    private static class A {
+    }
+
+    private static class B extends A {
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/runtime/RedefineTests/test8178870.sh	Fri Nov 29 14:14:18 2019 +0300
@@ -0,0 +1,87 @@
+#!/bin/sh
+
+#
+# Copyright (c) 2019, Red Hat, Inc. All rights reserved.
+#
+# 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 test.sh
+## @bug 8178870
+## @summary test instrumentation.retransformClasses
+## @run shell test.sh
+
+if [ "${TESTSRC}" = "" ]
+then
+  TESTSRC=${PWD}
+  echo "TESTSRC not set.  Using "${TESTSRC}" as default"
+fi
+echo "TESTSRC=${TESTSRC}"
+## Adding common setup Variables for running shell tests.
+. ${TESTSRC}/../../test_env.sh
+
+LIB_SRC=${TESTSRC}/../../testlibrary/
+
+# set platform-dependent variables
+OS=`uname -s`
+echo "Testing on " $OS
+case "$OS" in
+  Linux)
+    cc_cmd=`which gcc`
+    if [ "x$cc_cmd" == "x" ]; then
+        echo "WARNING: gcc not found. Cannot execute test." 2>&1
+        exit 0;
+    fi
+    ;;
+  Solaris)
+    cc_cmd=`which cc`
+    if [ "x$cc_cmd" == "x" ]; then
+        echo "WARNING: cc not found. Cannot execute test." 2>&1
+        exit 0;
+    fi
+    ;;
+  *)
+    echo "Test passed. Only on Linux and Solaris"
+    exit 0;
+    ;;
+esac
+
+THIS_DIR=.
+
+cp ${TESTSRC}/RedefineDoubleDelete.java ${THIS_DIR}
+mkdir -p ${THIS_DIR}/classes
+${TESTJAVA}/bin/javac -sourcepath  ${LIB_SRC} -d ${THIS_DIR}/classes ${LIB_SRC}RedefineClassHelper.java
+${TESTJAVA}/bin/javac -cp .:${THIS_DIR}/classes:${TESTJAVA}/lib/tools.jar -d ${THIS_DIR} RedefineDoubleDelete.java
+
+$cc_cmd -fPIC -shared -o ${THIS_DIR}${FS}libRedefineDoubleDelete.so \
+    -I${TESTJAVA}/include -I${TESTJAVA}/include/linux \
+    ${TESTSRC}/libRedefineDoubleDelete.c
+
+LD_LIBRARY_PATH=${THIS_DIR}
+echo   LD_LIBRARY_PATH = ${LD_LIBRARY_PATH}
+export LD_LIBRARY_PATH
+
+# Install redefineagent.jar
+${TESTJAVA}/bin${FS}java -cp ${THIS_DIR}/classes RedefineClassHelper
+
+echo
+echo ${TESTJAVA}/bin/java -agentlib:RedefineDoubleDelete RedefineDoubleDelete
+${TESTJAVA}/bin/java -cp .:${THIS_DIR}${FS}classes -javaagent:redefineagent.jar -agentlib:RedefineDoubleDelete RedefineDoubleDelete
+