< prev index next >

test/micro/org/openjdk/bench/jdk/incubator/foreign/VaList.java

Print this page

62         try {
63             MH_ellipsis = linker.downcallHandle(lookup.lookup("ellipsis"),
64                     MethodType.methodType(void.class, int.class, int.class, double.class, long.class),
65                     FunctionDescriptor.ofVoid(C_INT, asVarArg(C_INT), asVarArg(C_DOUBLE), asVarArg(C_LONGLONG)));
66             MH_vaList = linker.downcallHandle(lookup.lookup("vaList"),
67                     MethodType.methodType(void.class, int.class, CSupport.VaList.class),
68                     FunctionDescriptor.ofVoid(C_INT, CSupport.C_VA_LIST));
69         } catch (NoSuchMethodException e) {
70             throw new InternalError(e);
71         }
72     }
73 
74     @Benchmark
75     public void ellipsis() throws Throwable {
76         MH_ellipsis.invokeExact(3,
77                                 1, 2D, 3L);
78     }
79 
80     @Benchmark
81     public void vaList() throws Throwable {
82         try (CSupport.VaList vaList = CSupport.newVaList(b ->
83             b.vargFromInt(C_INT, 1)
84              .vargFromDouble(C_DOUBLE, 2D)
85              .vargFromLong(C_LONGLONG, 3L)
86         )) {
87             MH_vaList.invokeExact(3,
88                                   vaList);
89         }
90     }
91 }

62         try {
63             MH_ellipsis = linker.downcallHandle(lookup.lookup("ellipsis"),
64                     MethodType.methodType(void.class, int.class, int.class, double.class, long.class),
65                     FunctionDescriptor.ofVoid(C_INT, asVarArg(C_INT), asVarArg(C_DOUBLE), asVarArg(C_LONGLONG)));
66             MH_vaList = linker.downcallHandle(lookup.lookup("vaList"),
67                     MethodType.methodType(void.class, int.class, CSupport.VaList.class),
68                     FunctionDescriptor.ofVoid(C_INT, CSupport.C_VA_LIST));
69         } catch (NoSuchMethodException e) {
70             throw new InternalError(e);
71         }
72     }
73 
74     @Benchmark
75     public void ellipsis() throws Throwable {
76         MH_ellipsis.invokeExact(3,
77                                 1, 2D, 3L);
78     }
79 
80     @Benchmark
81     public void vaList() throws Throwable {
82         try (CSupport.VaList vaList = CSupport.VaList.make(b ->
83             b.vargFromInt(C_INT, 1)
84              .vargFromDouble(C_DOUBLE, 2D)
85              .vargFromLong(C_LONGLONG, 3L)
86         )) {
87             MH_vaList.invokeExact(3,
88                                   vaList);
89         }
90     }
91 }
< prev index next >