annotate test/compiler/c2/TestReplacedNodesOSR.java @ 24226:abc19eb35547

allow java.vm.name and java.vm.version to be initialized from a vm.properties file next to libjvm
author Doug Simon <doug.simon@oracle.com>
date Thu, 24 Aug 2017 22:20:40 +0200
parents b1f3fbe39975
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
24205
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
1 /*
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
2 * Copyright (c) 2017, Red Hat, Inc. All rights reserved.
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
4 *
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
7 * published by the Free Software Foundation.
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
8 *
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
13 * accompanied this code).
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
14 *
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
18 *
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
21 * questions.
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
22 */
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
23
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
24 /**
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
25 * @test
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
26 * @bug 8174164
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
27 * @summary SafePointNode::_replaced_nodes breaks with irreducible loops
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
28 * @run main/othervm -XX:-BackgroundCompilation TestReplacedNodesOSR
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
29 *
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
30 */
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
31
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
32 public class TestReplacedNodesOSR {
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
33
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
34 static Object dummy;
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
35
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
36 static interface I {
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
37 }
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
38
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
39 static class A implements I {
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
40 }
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
41
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
42 static final class MyException extends Exception {
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
43 }
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
44
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
45 static final A obj = new A();
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
46 static I static_field() { return obj; }
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
47
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
48 // When OSR compiled, this method has an irreducible loop
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
49 static void test(int v, MyException e) {
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
50 int i = 0;
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
51 for (;;) {
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
52 if (i == 1000) {
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
53 break;
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
54 }
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
55 try {
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
56 if ((i%2) == 0) {
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
57 int j = 0;
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
58 for (;;) {
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
59 j++;
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
60 if (i+j != v) {
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
61 if (j == 1000) {
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
62 break;
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
63 }
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
64 } else {
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
65 A a = (A)static_field();
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
66 // replaced node recorded here
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
67 throw e;
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
68 }
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
69 }
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
70 }
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
71 } catch(MyException ex) {
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
72 }
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
73 i++;
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
74 // replaced node applied on return of the method
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
75 // replaced node used here
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
76 dummy = static_field();
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
77 }
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
78 }
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
79
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
80
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
81 static public void main(String[] args) {
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
82 for (int i = 0; i < 1000; i++) {
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
83 test(1100, new MyException());
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
84 }
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
85 }
b1f3fbe39975 8175097: [TESTBUG] 8174164 fix missed the test
roland
parents:
diff changeset
86 }