author | vtewari |
Tue, 13 Sep 2016 17:00:06 +0530 | |
changeset 40937 | f72e61ec734b |
parent 40059 | c2304140ed64 |
permissions | -rw-r--r-- |
22926
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
1 |
/* |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
2 |
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
4 |
* |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
8 |
* |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
13 |
* accompanied this code). |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
14 |
* |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
18 |
* |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
21 |
* questions. |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
22 |
*/ |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
23 |
|
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
24 |
/* |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
25 |
* @test |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
26 |
* @bug 8032011 |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
27 |
* @summary biased locking's revoke_bias locks monitor in compiled frame with eliminated lock |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
28 |
* |
40059 | 29 |
* @run main/othervm -XX:-UseOnStackReplacement |
30 |
* -XX:CompileCommand=dontinline,compiler.uncommontrap.TestLockEliminatedAtDeopt$A::m2 |
|
31 |
* -XX:-BackgroundCompilation -XX:BiasedLockingStartupDelay=0 |
|
32 |
* compiler.uncommontrap.TestLockEliminatedAtDeopt |
|
22926
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
33 |
*/ |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
34 |
|
40059 | 35 |
package compiler.uncommontrap; |
36 |
||
22926
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
37 |
public class TestLockEliminatedAtDeopt { |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
38 |
|
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
39 |
static class A { |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
40 |
void m() { |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
41 |
} |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
42 |
|
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
43 |
// This lock is not eliminated but biased to main thread on |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
44 |
// first call |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
45 |
synchronized void m2(boolean trap) { |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
46 |
if (trap) { |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
47 |
new B(); |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
48 |
} |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
49 |
} |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
50 |
} |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
51 |
|
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
52 |
static class B extends A { |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
53 |
void m() { |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
54 |
} |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
55 |
} |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
56 |
|
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
57 |
static void m1(boolean trap) { |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
58 |
A a = new A(); |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
59 |
// This lock is eliminated by c2 |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
60 |
synchronized(a) { |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
61 |
a.m2(trap); |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
62 |
a.m(); |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
63 |
} |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
64 |
} |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
65 |
|
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
66 |
public static void main(String[] args) { |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
67 |
for (int i = 0; i < 20000; i++) { |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
68 |
m1(false); |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
69 |
} |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
70 |
// Trigger uncommon trap in A.m2() (class unloaded) and |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
71 |
// deoptimization of m1() (CHA invalidated). Uncommon trap |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
72 |
// code locks monitor in m1's frame where's it's eliminated. |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
73 |
m1(true); |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
74 |
} |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
75 |
} |