8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /**
25 * @test
26 * @bug 8057967
27 * @modules java.base/jdk.internal.misc
28 * @modules java.base/jdk.internal.org.objectweb.asm
29 * @library patches
30 * @build java.base/java.lang.invoke.MethodHandleHelper
31 * @run main/bootclasspath/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -Xlog:class+unload
32 * -XX:+PrintCompilation -XX:+TraceDependencies -XX:+TraceReferenceGC
33 * -verbose:gc compiler.jsr292.CallSiteDepContextTest
34 */
35
36 package compiler.jsr292;
37
38 import java.lang.invoke.CallSite;
39 import java.lang.invoke.MethodHandle;
40 import java.lang.invoke.MethodHandleHelper;
41 import java.lang.invoke.MethodHandles;
42 import java.lang.invoke.MethodType;
43 import java.lang.invoke.MutableCallSite;
44 import java.lang.ref.PhantomReference;
45 import java.lang.ref.Reference;
46 import java.lang.ref.ReferenceQueue;
47 import java.lang.reflect.Field;
48
49 import jdk.internal.org.objectweb.asm.*;
50 import jdk.internal.misc.Unsafe;
51
52 import static jdk.internal.org.objectweb.asm.Opcodes.*;
53
54 public class CallSiteDepContextTest {
55 static final Unsafe UNSAFE = Unsafe.getUnsafe();
56 static final MethodHandles.Lookup LOOKUP = MethodHandleHelper.IMPL_LOOKUP;
57 static final String CLASS_NAME = "java/lang/invoke/Test";
58 static final String METHOD_NAME = "m";
59 static final MethodType TYPE = MethodType.methodType(int.class);
60
61 static MutableCallSite mcs;
62 static MethodHandle bsmMH;
63
64 static {
65 try {
66 bsmMH = LOOKUP.findStatic(
67 CallSiteDepContextTest.class, "bootstrap",
68 MethodType.methodType(CallSite.class, MethodHandles.Lookup.class, String.class, MethodType.class));
69 } catch(Throwable e) {
70 throw new InternalError(e);
71 }
72 }
73
|
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /**
25 * @test
26 * @bug 8057967
27 * @modules java.base/jdk.internal.misc
28 * java.base/jdk.internal.org.objectweb.asm
29 * @library patches /
30 *
31 * @build java.base/java.lang.invoke.MethodHandleHelper
32 * @run main/bootclasspath/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -Xlog:class+unload
33 * -XX:+PrintCompilation -XX:+TraceDependencies -XX:+TraceReferenceGC
34 * -verbose:gc
35 * compiler.jsr292.CallSiteDepContextTest
36 */
37
38 package compiler.jsr292;
39
40 import jdk.internal.misc.Unsafe;
41 import jdk.internal.org.objectweb.asm.ClassWriter;
42 import jdk.internal.org.objectweb.asm.Handle;
43 import jdk.internal.org.objectweb.asm.MethodVisitor;
44
45 import java.lang.invoke.CallSite;
46 import java.lang.invoke.MethodHandle;
47 import java.lang.invoke.MethodHandleHelper;
48 import java.lang.invoke.MethodHandles;
49 import java.lang.invoke.MethodType;
50 import java.lang.invoke.MutableCallSite;
51 import java.lang.ref.PhantomReference;
52 import java.lang.ref.Reference;
53 import java.lang.ref.ReferenceQueue;
54 import java.lang.reflect.Field;
55
56 import static jdk.internal.org.objectweb.asm.Opcodes.ACC_PUBLIC;
57 import static jdk.internal.org.objectweb.asm.Opcodes.ACC_STATIC;
58 import static jdk.internal.org.objectweb.asm.Opcodes.ACC_SUPER;
59 import static jdk.internal.org.objectweb.asm.Opcodes.H_INVOKESTATIC;
60 import static jdk.internal.org.objectweb.asm.Opcodes.IRETURN;
61
62 public class CallSiteDepContextTest {
63 static final Unsafe UNSAFE = Unsafe.getUnsafe();
64 static final MethodHandles.Lookup LOOKUP = MethodHandleHelper.IMPL_LOOKUP;
65 static final String CLASS_NAME = "java/lang/invoke/Test";
66 static final String METHOD_NAME = "m";
67 static final MethodType TYPE = MethodType.methodType(int.class);
68
69 static MutableCallSite mcs;
70 static MethodHandle bsmMH;
71
72 static {
73 try {
74 bsmMH = LOOKUP.findStatic(
75 CallSiteDepContextTest.class, "bootstrap",
76 MethodType.methodType(CallSite.class, MethodHandles.Lookup.class, String.class, MethodType.class));
77 } catch(Throwable e) {
78 throw new InternalError(e);
79 }
80 }
81
|