author | amlu |
Tue, 30 Jun 2015 10:00:46 +0200 | |
changeset 31427 | 42740247adcf |
parent 21579 | c396d68f3e48 |
child 40059 | c2304140ed64 |
permissions | -rw-r--r-- |
21579
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
1 |
/* |
c396d68f3e48
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. |
c396d68f3e48
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. |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
4 |
* |
c396d68f3e48
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 |
c396d68f3e48
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 |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
8 |
* |
c396d68f3e48
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 |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
c396d68f3e48
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 |
c396d68f3e48
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 |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
13 |
* accompanied this code). |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
14 |
* |
c396d68f3e48
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 |
c396d68f3e48
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, |
c396d68f3e48
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. |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
18 |
* |
c396d68f3e48
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 |
c396d68f3e48
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 |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
21 |
* questions. |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
22 |
*/ |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
23 |
|
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
24 |
/* |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
25 |
* @test |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
26 |
* @bug 8027631 |
c396d68f3e48
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 |
c396d68f3e48
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 |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
29 |
* |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
30 |
*/ |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
31 |
|
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
32 |
import java.lang.invoke.*; |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
33 |
|
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
34 |
public class TestUnexpectedProfilingMismatch { |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
35 |
|
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
36 |
static class A { |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
37 |
} |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
38 |
|
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
39 |
static class B { |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
40 |
} |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
41 |
|
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
42 |
static void mA(A a) { |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
43 |
} |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
44 |
|
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
45 |
static void mB(B b) { |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
46 |
} |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
47 |
|
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
48 |
static final MethodHandle mhA; |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
49 |
static final MethodHandle mhB; |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
50 |
static { |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
51 |
MethodHandles.Lookup lookup = MethodHandles.lookup(); |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
52 |
MethodType mt = MethodType.methodType(void.class, A.class); |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
53 |
MethodHandle res = null; |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
54 |
try { |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
55 |
res = lookup.findStatic(TestUnexpectedProfilingMismatch.class, "mA", mt); |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
56 |
} catch(NoSuchMethodException ex) { |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
57 |
} catch(IllegalAccessException ex) { |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
58 |
} |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
59 |
mhA = res; |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
60 |
mt = MethodType.methodType(void.class, B.class); |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
61 |
try { |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
62 |
res = lookup.findStatic(TestUnexpectedProfilingMismatch.class, "mB", mt); |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
63 |
} catch(NoSuchMethodException ex) { |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
64 |
} catch(IllegalAccessException ex) { |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
65 |
} |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
66 |
mhB = res; |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
67 |
} |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
68 |
|
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
69 |
void m1(A a, boolean doit) throws Throwable { |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
70 |
if (doit) { |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
71 |
mhA.invoke(a); |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
72 |
} |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
73 |
} |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
74 |
|
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
75 |
void m2(B b) throws Throwable { |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
76 |
mhB.invoke(b); |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
77 |
} |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
78 |
|
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
79 |
static public void main(String[] args) { |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
80 |
TestUnexpectedProfilingMismatch tih = new TestUnexpectedProfilingMismatch(); |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
81 |
A a = new A(); |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
82 |
B b = new B(); |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
83 |
try { |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
84 |
for (int i = 0; i < 256 - 1; i++) { |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
85 |
tih.m1(a, true); |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
86 |
} |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
87 |
// Will trigger the compilation but will also run once |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
88 |
// more interpreted with a non null MDO which it will |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
89 |
// update. Make it skip the body of the method. |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
90 |
tih.m1(a, false); |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
91 |
// Compile this one as well and do the profiling |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
92 |
for (int i = 0; i < 256; i++) { |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
93 |
tih.m2(b); |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
94 |
} |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
95 |
// Will run and see a conflict |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
96 |
tih.m1(a, true); |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
97 |
} catch(Throwable ex) { |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
98 |
ex.printStackTrace(); |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
99 |
} |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
100 |
System.out.println("TEST PASSED"); |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
101 |
} |
c396d68f3e48
8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents:
diff
changeset
|
102 |
} |