65 MethodType.methodType(int.class, int.class),
66 FunctionDescriptor.of(C_INT, C_INT));
67 } catch (NoSuchMethodException e) {
68 throw new BootstrapMethodError(e);
69 }
70 }
71
72 static native void blank();
73 static native int identity(int x);
74
75 @Benchmark
76 public void jni_blank() throws Throwable {
77 blank();
78 }
79
80 @Benchmark
81 public void panama_blank() throws Throwable {
82 func.invokeExact();
83 }
84
85 @Benchmark
86 public int jni_identity() throws Throwable {
87 return identity(10);
88 }
89
90 @Benchmark
91 public int panama_identity() throws Throwable {
92 return (int) identity.invokeExact(10);
93 }
94 }
|
65 MethodType.methodType(int.class, int.class),
66 FunctionDescriptor.of(C_INT, C_INT));
67 } catch (NoSuchMethodException e) {
68 throw new BootstrapMethodError(e);
69 }
70 }
71
72 static native void blank();
73 static native int identity(int x);
74
75 @Benchmark
76 public void jni_blank() throws Throwable {
77 blank();
78 }
79
80 @Benchmark
81 public void panama_blank() throws Throwable {
82 func.invokeExact();
83 }
84
85 @Benchmark
86 @Fork(jvmArgsAppend = "-Djdk.internal.foreign.ProgrammableInvoker.NO_SPEC=true")
87 public void panama_blank_NO_SPEC() throws Throwable {
88 func.invokeExact();
89 }
90
91 @Benchmark
92 public int jni_identity() throws Throwable {
93 return identity(10);
94 }
95
96 @Benchmark
97 public int panama_identity() throws Throwable {
98 return (int) identity.invokeExact(10);
99 }
100
101 @Benchmark
102 @Fork(jvmArgsAppend = "-Djdk.internal.foreign.ProgrammableInvoker.NO_SPEC=true")
103 public int panama_identity_NO_SPEC() throws Throwable {
104 return (int) identity.invokeExact(10);
105 }
106 }
|