Mercurial > hg > truffle
annotate test/compiler/profiling/TestUnexpectedProfilingMismatch.java @ 14727:8b772174c514
Backport of 8504393de66b from jdk9
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 24 Mar 2014 23:50:18 +0100 |
parents | e6ba215af802 |
children |
rev | line source |
---|---|
13078
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
1 /* |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
4 * |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
8 * |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
13 * accompanied this code). |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
14 * |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
18 * |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
21 * questions. |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
22 */ |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
23 |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
24 /* |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
25 * @test |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
26 * @bug 8027631 |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
27 * @summary profiling of arguments at calls cannot rely on signature of callee for types |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
28 * @run main/othervm -XX:-BackgroundCompilation -XX:TieredStopAtLevel=3 -XX:TypeProfileLevel=111 -XX:Tier3InvocationThreshold=200 -XX:Tier0InvokeNotifyFreqLog=7 TestUnexpectedProfilingMismatch |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
29 * |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
30 */ |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
31 |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
32 import java.lang.invoke.*; |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
33 |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
34 public class TestUnexpectedProfilingMismatch { |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
35 |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
36 static class A { |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
37 } |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
38 |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
39 static class B { |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
40 } |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
41 |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
42 static void mA(A a) { |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
43 } |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
44 |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
45 static void mB(B b) { |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
46 } |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
47 |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
48 static final MethodHandle mhA; |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
49 static final MethodHandle mhB; |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
50 static { |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
51 MethodHandles.Lookup lookup = MethodHandles.lookup(); |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
52 MethodType mt = MethodType.methodType(void.class, A.class); |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
53 MethodHandle res = null; |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
54 try { |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
55 res = lookup.findStatic(TestUnexpectedProfilingMismatch.class, "mA", mt); |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
56 } catch(NoSuchMethodException ex) { |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
57 } catch(IllegalAccessException ex) { |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
58 } |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
59 mhA = res; |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
60 mt = MethodType.methodType(void.class, B.class); |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
61 try { |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
62 res = lookup.findStatic(TestUnexpectedProfilingMismatch.class, "mB", mt); |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
63 } catch(NoSuchMethodException ex) { |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
64 } catch(IllegalAccessException ex) { |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
65 } |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
66 mhB = res; |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
67 } |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
68 |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
69 void m1(A a, boolean doit) throws Throwable { |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
70 if (doit) { |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
71 mhA.invoke(a); |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
72 } |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
73 } |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
74 |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
75 void m2(B b) throws Throwable { |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
76 mhB.invoke(b); |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
77 } |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
78 |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
79 static public void main(String[] args) { |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
80 TestUnexpectedProfilingMismatch tih = new TestUnexpectedProfilingMismatch(); |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
81 A a = new A(); |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
82 B b = new B(); |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
83 try { |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
84 for (int i = 0; i < 256 - 1; i++) { |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
85 tih.m1(a, true); |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
86 } |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
87 // Will trigger the compilation but will also run once |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
88 // more interpreted with a non null MDO which it will |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
89 // update. Make it skip the body of the method. |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
90 tih.m1(a, false); |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
91 // Compile this one as well and do the profiling |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
92 for (int i = 0; i < 256; i++) { |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
93 tih.m2(b); |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
94 } |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
95 // Will run and see a conflict |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
96 tih.m1(a, true); |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
97 } catch(Throwable ex) { |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
98 ex.printStackTrace(); |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
99 } |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
100 System.out.println("TEST PASSED"); |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
101 } |
e6ba215af802
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
102 } |