23 |
23 |
24 /* @test |
24 /* @test |
25 * @summary smoke test for invokedynamic instructions |
25 * @summary smoke test for invokedynamic instructions |
26 * @build indify.Indify |
26 * @build indify.Indify |
27 * @compile InvokeDynamicPrintArgs.java |
27 * @compile InvokeDynamicPrintArgs.java |
28 * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableInvokeDynamic |
28 * @run main/othervm |
29 * indify.Indify |
29 * indify.Indify |
30 * --verify-specifier-count=3 --transitionalJSR292=false |
30 * --verify-specifier-count=3 |
31 * --expand-properties --classpath ${test.classes} |
31 * --expand-properties --classpath ${test.classes} |
32 * --java test.java.lang.invoke.InvokeDynamicPrintArgs --check-output |
32 * --java test.java.lang.invoke.InvokeDynamicPrintArgs --check-output |
33 */ |
33 */ |
34 |
34 |
35 package test.java.lang.invoke; |
35 package test.java.lang.invoke; |
61 public void testInvokeDynamicPrintArgs() throws IOException { |
61 public void testInvokeDynamicPrintArgs() throws IOException { |
62 System.err.println(System.getProperties()); |
62 System.err.println(System.getProperties()); |
63 String testClassPath = System.getProperty("build.test.classes.dir"); |
63 String testClassPath = System.getProperty("build.test.classes.dir"); |
64 if (testClassPath == null) throw new RuntimeException(); |
64 if (testClassPath == null) throw new RuntimeException(); |
65 String[] args = new String[]{ |
65 String[] args = new String[]{ |
66 "--verify-specifier-count=3", "--transitionalJSR292=false", |
66 "--verify-specifier-count=3", |
|
67 "--verbose", |
67 "--expand-properties", "--classpath", testClassPath, |
68 "--expand-properties", "--classpath", testClassPath, |
68 "--java", "test.java.lang.invoke.InvokeDynamicPrintArgs", "--check-output" |
69 "--java", "test.java.lang.invoke.InvokeDynamicPrintArgs", "--check-output" |
69 }; |
70 }; |
70 System.err.println("Indify: "+Arrays.toString(args)); |
71 System.err.println("Indify: "+Arrays.toString(args)); |
71 indify.Indify.main(args); |
72 indify.Indify.main(args); |
157 } |
158 } |
158 private static MethodHandle INDY_bar() throws Throwable { |
159 private static MethodHandle INDY_bar() throws Throwable { |
159 shouldNotCallThis(); |
160 shouldNotCallThis(); |
160 return ((CallSite) MH_bsm2().invokeGeneric(lookup(), |
161 return ((CallSite) MH_bsm2().invokeGeneric(lookup(), |
161 "bar", methodType(void.class, String.class, int.class) |
162 "bar", methodType(void.class, String.class, int.class) |
162 , new Object[] { Void.class, "void type!", |
163 , Void.class, "void type!", 1, 234.5F, 67.5, (long)89 |
163 1, 234.5F, 67.5, (long)89 } |
|
164 )).dynamicInvoker(); |
164 )).dynamicInvoker(); |
165 } |
165 } |
166 private static MethodHandle INDY_bar2() throws Throwable { |
166 private static MethodHandle INDY_bar2() throws Throwable { |
167 shouldNotCallThis(); |
167 shouldNotCallThis(); |
168 return ((CallSite) MH_bsm2().invokeGeneric(lookup(), |
168 return ((CallSite) MH_bsm2().invokeGeneric(lookup(), |
169 "bar2", methodType(void.class, String.class, int.class) |
169 "bar2", methodType(void.class, String.class, int.class) |
170 , new Object[] { Void.class, "void type!", |
170 , Void.class, "void type!", 1, 234.5F, 67.5, (long)89 |
171 1, 234.5F, 67.5, (long)89 } |
|
172 )).dynamicInvoker(); |
171 )).dynamicInvoker(); |
173 } |
172 } |
174 private static MethodHandle INDY_baz() throws Throwable { |
173 private static MethodHandle INDY_baz() throws Throwable { |
175 shouldNotCallThis(); |
174 shouldNotCallThis(); |
176 return ((CallSite) MH_bsm2().invokeGeneric(lookup(), |
175 return ((CallSite) MH_bsm2().invokeGeneric(lookup(), |