author | tpivovarova |
Tue, 10 Nov 2015 21:09:49 +0300 | |
changeset 34172 | 19299c8b7c81 |
parent 29351 | caf03a304610 |
child 40059 | c2304140ed64 |
permissions | -rw-r--r-- |
29351
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
1 |
/* |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
2 |
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
4 |
* |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
8 |
* |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
13 |
* accompanied this code). |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
14 |
* |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
18 |
* |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
21 |
* questions. |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
22 |
*/ |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
23 |
|
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
24 |
/** |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
25 |
* @test |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
26 |
* @bug 8073154 |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
27 |
* @build TestProfileReturnTypePrinting |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
28 |
* @run main/othervm -XX:TypeProfileLevel=020 |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
29 |
* -XX:CompileOnly=TestProfileReturnTypePrinting.testMethod |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
30 |
* -XX:+IgnoreUnrecognizedVMOptions -XX:+PrintLIR |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
31 |
* TestProfileReturnTypePrinting |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
32 |
* @summary Verify that c1's LIR that contains ProfileType node could be dumped |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
33 |
* without a crash disregard to an exact class knowledge. |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
34 |
*/ |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
35 |
public class TestProfileReturnTypePrinting { |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
36 |
private static final int ITERATIONS = 1_000_000; |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
37 |
|
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
38 |
public static void main(String args[]) { |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
39 |
for (int i = 0; i < ITERATIONS; i++) { |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
40 |
TestProfileReturnTypePrinting.testMethod(i); |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
41 |
} |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
42 |
} |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
43 |
|
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
44 |
private static int testMethod(int i) { |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
45 |
return TestProfileReturnTypePrinting.foo().hashCode() |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
46 |
+ TestProfileReturnTypePrinting.bar(i).hashCode(); |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
47 |
} |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
48 |
|
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
49 |
/* Exact class of returned value is known statically. */ |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
50 |
private static B foo() { |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
51 |
return new B(); |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
52 |
} |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
53 |
|
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
54 |
/* Exact class of returned value is not known statically. */ |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
55 |
private static Object bar(int i) { |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
56 |
if (i % 2 == 0) { |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
57 |
return new A(); |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
58 |
} else { |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
59 |
return new B(); |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
60 |
} |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
61 |
} |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
62 |
|
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
63 |
private static class A { |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
64 |
} |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
65 |
|
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
66 |
private static class B extends A { |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
67 |
} |
caf03a304610
8073154: NULL-pointer dereferencing in LIR_OpProfileType::print_instr
fzhinkin
parents:
diff
changeset
|
68 |
} |