author | katleman |
Thu, 16 Oct 2014 12:01:59 -0700 | |
changeset 27002 | 297d6a75d68a |
parent 22926 | 1a4328d3fd0e |
child 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 |
* @run main/othervm -XX:-UseOnStackReplacement -XX:CompileCommand=dontinline,TestLockEliminatedAtDeopt$A.m2 -XX:-BackgroundCompilation -XX:BiasedLockingStartupDelay=0 TestLockEliminatedAtDeopt |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
29 |
* |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
30 |
*/ |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
31 |
|
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
32 |
public class TestLockEliminatedAtDeopt { |
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 |
static class A { |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
35 |
void m() { |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
36 |
} |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
37 |
|
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
38 |
// 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
|
39 |
// first call |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
40 |
synchronized void m2(boolean trap) { |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
41 |
if (trap) { |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
42 |
new B(); |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
43 |
} |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
44 |
} |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
45 |
} |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
46 |
|
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
47 |
static class B extends A { |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
48 |
void m() { |
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 void m1(boolean trap) { |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
53 |
A a = new A(); |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
54 |
// 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
|
55 |
synchronized(a) { |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
56 |
a.m2(trap); |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
57 |
a.m(); |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
58 |
} |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
59 |
} |
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
60 |
|
1a4328d3fd0e
8032011: nsk/stress/jck60/jck60022 crashes in src\share\vm\runtime\synchronizer.cpp:239
roland
parents:
diff
changeset
|
61 |
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
|
62 |
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
|
63 |
m1(false); |
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 |
// 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
|
66 |
// 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
|
67 |
// 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
|
68 |
m1(true); |
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 |
} |