Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/compiler/jsr292/InvokerSignatureMismatch.java
41149 views
1
package compiler.jsr292;
2
3
import java.lang.invoke.MethodHandle;
4
import java.lang.invoke.MethodHandles;
5
import java.lang.invoke.MethodType;
6
import java.lang.invoke.MethodHandleHelper;
7
import jdk.internal.vm.annotation.ForceInline;
8
9
/*
10
* @test
11
* @bug 8166110
12
* @library /test/lib / patches
13
* @modules java.base/jdk.internal.misc
14
* java.base/jdk.internal.vm.annotation
15
*
16
* @build java.base/java.lang.invoke.MethodHandleHelper
17
* @run main/bootclasspath/othervm -XX:+IgnoreUnrecognizedVMOptions -Xbatch -XX:-TieredCompilation
18
* compiler.jsr292.InvokerSignatureMismatch
19
*/
20
public class InvokerSignatureMismatch {
21
22
static final MethodHandle INT_MH;
23
24
static {
25
MethodHandle mhI = null;
26
try {
27
mhI = MethodHandles.lookup().findStatic(InvokerSignatureMismatch.class, "bodyI", MethodType.methodType(void.class, int.class));
28
} catch (Throwable e) {
29
}
30
INT_MH = mhI;
31
}
32
33
public static void main(String[] args) throws Throwable {
34
for (int i = 0; i < 50_000; i++) { // OSR
35
mainLink(i);
36
mainInvoke(i);
37
}
38
}
39
40
static void mainLink(int i) throws Throwable {
41
Object name = MethodHandleHelper.internalMemberName(INT_MH);
42
MethodHandleHelper.linkToStatic((float) i, name);
43
}
44
45
static void mainInvoke(int i) throws Throwable {
46
MethodHandleHelper.invokeBasicV(INT_MH, (float) i);
47
}
48
49
static int cnt = 0;
50
static void bodyI(int x) {
51
if ((x & 1023) == 0) { // already optimized x % 1024 == 0
52
++cnt;
53
}
54
}
55
56
}
57
58