Java Code Examples for jdk.internal.org.objectweb.asm.commons.InstructionAdapter#invokevirtual()
The following examples show how to use
jdk.internal.org.objectweb.asm.commons.InstructionAdapter#invokevirtual() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JavaAdapterBytecodeGenerator.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
private static void emitInvokeExact(final InstructionAdapter mv, final MethodType type) { mv.invokevirtual(METHOD_HANDLE_TYPE.getInternalName(), "invokeExact", type.toMethodDescriptorString(), false); }
Example 2
Source File: JavaAdapterServices.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
private static MethodHandle createNoPermissionsInvoker() { final String className = "NoPermissionsInvoker"; final ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); cw.visit(Opcodes.V1_7, ACC_PUBLIC | ACC_SUPER | ACC_FINAL, className, null, "java/lang/Object", null); final Type objectType = Type.getType(Object.class); final Type methodHandleType = Type.getType(MethodHandle.class); final InstructionAdapter mv = new InstructionAdapter(cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "invoke", Type.getMethodDescriptor(Type.VOID_TYPE, methodHandleType, objectType), null, null)); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 1); mv.invokevirtual(methodHandleType.getInternalName(), "invokeExact", Type.getMethodDescriptor( Type.VOID_TYPE, objectType), false); mv.visitInsn(RETURN); mv.visitMaxs(0, 0); mv.visitEnd(); cw.visitEnd(); final byte[] bytes = cw.toByteArray(); final ClassLoader loader = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() { @Override public ClassLoader run() { return new SecureClassLoader(null) { @Override protected Class<?> findClass(String name) throws ClassNotFoundException { if(name.equals(className)) { return defineClass(name, bytes, 0, bytes.length, new ProtectionDomain( new CodeSource(null, (CodeSigner[])null), new Permissions())); } throw new ClassNotFoundException(name); } }; } }); try { return MethodHandles.lookup().findStatic(Class.forName(className, true, loader), "invoke", MethodType.methodType(void.class, MethodHandle.class, Object.class)); } catch(ReflectiveOperationException e) { throw new AssertionError(e.getMessage(), e); } }
Example 3
Source File: JavaAdapterBytecodeGenerator.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
private static void invokeGetGlobalWithNullCheck(final InstructionAdapter mv) { invokeGetGlobal(mv); mv.dup(); mv.invokevirtual(OBJECT_TYPE_NAME, "getClass", GET_CLASS_METHOD_DESCRIPTOR); // check against null Context mv.pop(); }
Example 4
Source File: JavaAdapterServices.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
private static MethodHandle createNoPermissionsInvoker() { final String className = "NoPermissionsInvoker"; final ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); cw.visit(Opcodes.V1_7, ACC_PUBLIC | ACC_SUPER | ACC_FINAL, className, null, "java/lang/Object", null); final Type objectType = Type.getType(Object.class); final Type methodHandleType = Type.getType(MethodHandle.class); final InstructionAdapter mv = new InstructionAdapter(cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "invoke", Type.getMethodDescriptor(Type.VOID_TYPE, methodHandleType, objectType), null, null)); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 1); mv.invokevirtual(methodHandleType.getInternalName(), "invokeExact", Type.getMethodDescriptor( Type.VOID_TYPE, objectType), false); mv.visitInsn(RETURN); mv.visitMaxs(0, 0); mv.visitEnd(); cw.visitEnd(); final byte[] bytes = cw.toByteArray(); final ClassLoader loader = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() { @Override public ClassLoader run() { return new SecureClassLoader(null) { @Override protected Class<?> findClass(String name) throws ClassNotFoundException { if(name.equals(className)) { return defineClass(name, bytes, 0, bytes.length, new ProtectionDomain( new CodeSource(null, (CodeSigner[])null), new Permissions())); } throw new ClassNotFoundException(name); } }; } }); try { return MethodHandles.lookup().findStatic(Class.forName(className, true, loader), "invoke", MethodType.methodType(void.class, MethodHandle.class, Object.class)); } catch(ReflectiveOperationException e) { throw new AssertionError(e.getMessage(), e); } }
Example 5
Source File: JavaAdapterBytecodeGenerator.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
private static void invokeGetGlobalWithNullCheck(final InstructionAdapter mv) { invokeGetGlobal(mv); mv.dup(); mv.invokevirtual(OBJECT_TYPE_NAME, "getClass", GET_CLASS_METHOD_DESCRIPTOR); // check against null Context mv.pop(); }
Example 6
Source File: JavaAdapterServices.java From hottub with GNU General Public License v2.0 | 4 votes |
private static MethodHandle createNoPermissionsInvoker() { final String className = "NoPermissionsInvoker"; final ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); cw.visit(Opcodes.V1_7, ACC_PUBLIC | ACC_SUPER | ACC_FINAL, className, null, "java/lang/Object", null); final Type objectType = Type.getType(Object.class); final Type methodHandleType = Type.getType(MethodHandle.class); final InstructionAdapter mv = new InstructionAdapter(cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "invoke", Type.getMethodDescriptor(Type.VOID_TYPE, methodHandleType, objectType), null, null)); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 1); mv.invokevirtual(methodHandleType.getInternalName(), "invokeExact", Type.getMethodDescriptor( Type.VOID_TYPE, objectType), false); mv.visitInsn(RETURN); mv.visitMaxs(0, 0); mv.visitEnd(); cw.visitEnd(); final byte[] bytes = cw.toByteArray(); final ClassLoader loader = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() { @Override public ClassLoader run() { return new SecureClassLoader(null) { @Override protected Class<?> findClass(final String name) throws ClassNotFoundException { if(name.equals(className)) { return defineClass(name, bytes, 0, bytes.length, new ProtectionDomain( new CodeSource(null, (CodeSigner[])null), new Permissions())); } throw new ClassNotFoundException(name); } }; } }); try { return MethodHandles.lookup().findStatic(Class.forName(className, true, loader), "invoke", MethodType.methodType(void.class, MethodHandle.class, Object.class)); } catch(final ReflectiveOperationException e) { throw new AssertionError(e.getMessage(), e); } }
Example 7
Source File: JavaAdapterBytecodeGenerator.java From hottub with GNU General Public License v2.0 | 4 votes |
private static void emitInvokeExact(final InstructionAdapter mv, final MethodType type) { mv.invokevirtual(METHOD_HANDLE_TYPE.getInternalName(), "invokeExact", type.toMethodDescriptorString(), false); }
Example 8
Source File: JavaAdapterServices.java From jdk8u_nashorn with GNU General Public License v2.0 | 4 votes |
private static MethodHandle createNoPermissionsInvoker() { final String className = "NoPermissionsInvoker"; final ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); cw.visit(Opcodes.V1_7, ACC_PUBLIC | ACC_SUPER | ACC_FINAL, className, null, "java/lang/Object", null); final Type objectType = Type.getType(Object.class); final Type methodHandleType = Type.getType(MethodHandle.class); final InstructionAdapter mv = new InstructionAdapter(cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "invoke", Type.getMethodDescriptor(Type.VOID_TYPE, methodHandleType, objectType), null, null)); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 1); mv.invokevirtual(methodHandleType.getInternalName(), "invokeExact", Type.getMethodDescriptor( Type.VOID_TYPE, objectType), false); mv.visitInsn(RETURN); mv.visitMaxs(0, 0); mv.visitEnd(); cw.visitEnd(); final byte[] bytes = cw.toByteArray(); final ClassLoader loader = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() { @Override public ClassLoader run() { return new SecureClassLoader(null) { @Override protected Class<?> findClass(final String name) throws ClassNotFoundException { if(name.equals(className)) { return defineClass(name, bytes, 0, bytes.length, new ProtectionDomain( new CodeSource(null, (CodeSigner[])null), new Permissions())); } throw new ClassNotFoundException(name); } }; } }); try { return MethodHandles.lookup().findStatic(Class.forName(className, true, loader), "invoke", MethodType.methodType(void.class, MethodHandle.class, Object.class)); } catch(final ReflectiveOperationException e) { throw new AssertionError(e.getMessage(), e); } }
Example 9
Source File: JavaAdapterBytecodeGenerator.java From jdk8u_nashorn with GNU General Public License v2.0 | 4 votes |
private static void invokeGetGlobalWithNullCheck(final InstructionAdapter mv) { invokeGetGlobal(mv); mv.dup(); mv.invokevirtual(OBJECT_TYPE_NAME, "getClass", GET_CLASS_METHOD_DESCRIPTOR, false); // check against null Context mv.pop(); }
Example 10
Source File: JavaAdapterServices.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
private static MethodHandle createNoPermissionsInvoker() { final String className = "NoPermissionsInvoker"; final ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); cw.visit(Opcodes.V1_7, ACC_PUBLIC | ACC_SUPER | ACC_FINAL, className, null, "java/lang/Object", null); final Type objectType = Type.getType(Object.class); final Type methodHandleType = Type.getType(MethodHandle.class); final InstructionAdapter mv = new InstructionAdapter(cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "invoke", Type.getMethodDescriptor(Type.VOID_TYPE, methodHandleType, objectType), null, null)); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 1); mv.invokevirtual(methodHandleType.getInternalName(), "invokeExact", Type.getMethodDescriptor( Type.VOID_TYPE, objectType), false); mv.visitInsn(RETURN); mv.visitMaxs(0, 0); mv.visitEnd(); cw.visitEnd(); final byte[] bytes = cw.toByteArray(); final ClassLoader loader = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() { @Override public ClassLoader run() { return new SecureClassLoader(null) { @Override protected Class<?> findClass(final String name) throws ClassNotFoundException { if(name.equals(className)) { return defineClass(name, bytes, 0, bytes.length, new ProtectionDomain( new CodeSource(null, (CodeSigner[])null), new Permissions())); } throw new ClassNotFoundException(name); } }; } }); try { return MethodHandles.lookup().findStatic(Class.forName(className, true, loader), "invoke", MethodType.methodType(void.class, MethodHandle.class, Object.class)); } catch(final ReflectiveOperationException e) { throw new AssertionError(e.getMessage(), e); } }
Example 11
Source File: JavaAdapterBytecodeGenerator.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
private static void invokeGetGlobalWithNullCheck(final InstructionAdapter mv) { invokeGetGlobal(mv); mv.dup(); mv.invokevirtual(OBJECT_TYPE_NAME, "getClass", GET_CLASS_METHOD_DESCRIPTOR, false); // check against null Context mv.pop(); }
Example 12
Source File: JavaAdapterBytecodeGenerator.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
private static void invokeGetGlobalWithNullCheck(final InstructionAdapter mv) { invokeGetGlobal(mv); mv.dup(); mv.invokevirtual(OBJECT_TYPE_NAME, "getClass", GET_CLASS_METHOD_DESCRIPTOR, false); // check against null Context mv.pop(); }
Example 13
Source File: JavaAdapterServices.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
private static MethodHandle createNoPermissionsInvoker() { final String className = "NoPermissionsInvoker"; final ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); cw.visit(Opcodes.V1_7, ACC_PUBLIC | ACC_SUPER | ACC_FINAL, className, null, "java/lang/Object", null); final Type objectType = Type.getType(Object.class); final Type methodHandleType = Type.getType(MethodHandle.class); final InstructionAdapter mv = new InstructionAdapter(cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "invoke", Type.getMethodDescriptor(Type.VOID_TYPE, methodHandleType, objectType), null, null)); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 1); mv.invokevirtual(methodHandleType.getInternalName(), "invokeExact", Type.getMethodDescriptor( Type.VOID_TYPE, objectType), false); mv.visitInsn(RETURN); mv.visitMaxs(0, 0); mv.visitEnd(); cw.visitEnd(); final byte[] bytes = cw.toByteArray(); final ClassLoader loader = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() { @Override public ClassLoader run() { return new SecureClassLoader(null) { @Override protected Class<?> findClass(final String name) throws ClassNotFoundException { if(name.equals(className)) { return defineClass(name, bytes, 0, bytes.length, new ProtectionDomain( new CodeSource(null, (CodeSigner[])null), new Permissions())); } throw new ClassNotFoundException(name); } }; } }); try { return MethodHandles.lookup().findStatic(Class.forName(className, true, loader), "invoke", MethodType.methodType(void.class, MethodHandle.class, Object.class)); } catch(final ReflectiveOperationException e) { throw new AssertionError(e.getMessage(), e); } }
Example 14
Source File: JavaAdapterBytecodeGenerator.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
private static void emitInvokeExact(final InstructionAdapter mv, final MethodType type) { mv.invokevirtual(METHOD_HANDLE_TYPE.getInternalName(), "invokeExact", type.toMethodDescriptorString(), false); }
Example 15
Source File: JavaAdapterBytecodeGenerator.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
private static void invokeGetGlobalWithNullCheck(final InstructionAdapter mv) { invokeGetGlobal(mv); mv.dup(); mv.invokevirtual(OBJECT_TYPE_NAME, "getClass", GET_CLASS_METHOD_DESCRIPTOR, false); // check against null Context mv.pop(); }
Example 16
Source File: JavaAdapterBytecodeGenerator.java From nashorn with GNU General Public License v2.0 | 4 votes |
private static void invokeGetGlobalWithNullCheck(final InstructionAdapter mv) { invokeGetGlobal(mv); mv.dup(); mv.invokevirtual(OBJECT_TYPE_NAME, "getClass", GET_CLASS_METHOD_DESCRIPTOR); // check against null Context mv.pop(); }
Example 17
Source File: JavaAdapterBytecodeGenerator.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
private static void emitInvokeExact(final InstructionAdapter mv, final MethodType type) { mv.invokevirtual(METHOD_HANDLE_TYPE.getInternalName(), "invokeExact", type.toMethodDescriptorString(), false); }
Example 18
Source File: JavaAdapterBytecodeGenerator.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
private static void invokeGetGlobalWithNullCheck(final InstructionAdapter mv) { invokeGetGlobal(mv); mv.dup(); mv.invokevirtual(OBJECT_TYPE_NAME, "getClass", GET_CLASS_METHOD_DESCRIPTOR, false); // check against null Context mv.pop(); }
Example 19
Source File: JavaAdapterServices.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
private static MethodHandle createNoPermissionsInvoker() { final String className = "NoPermissionsInvoker"; final ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); cw.visit(Opcodes.V1_7, ACC_PUBLIC | ACC_SUPER | ACC_FINAL, className, null, "java/lang/Object", null); final Type objectType = Type.getType(Object.class); final Type methodHandleType = Type.getType(MethodHandle.class); final InstructionAdapter mv = new InstructionAdapter(cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "invoke", Type.getMethodDescriptor(Type.VOID_TYPE, methodHandleType, objectType), null, null)); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 1); mv.invokevirtual(methodHandleType.getInternalName(), "invokeExact", Type.getMethodDescriptor( Type.VOID_TYPE, objectType), false); mv.visitInsn(RETURN); mv.visitMaxs(0, 0); mv.visitEnd(); cw.visitEnd(); final byte[] bytes = cw.toByteArray(); final ClassLoader loader = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() { @Override public ClassLoader run() { return new SecureClassLoader(null) { @Override protected Class<?> findClass(final String name) throws ClassNotFoundException { if(name.equals(className)) { return defineClass(name, bytes, 0, bytes.length, new ProtectionDomain( new CodeSource(null, (CodeSigner[])null), new Permissions())); } throw new ClassNotFoundException(name); } }; } }); try { return MethodHandles.lookup().findStatic(Class.forName(className, true, loader), "invoke", MethodType.methodType(void.class, MethodHandle.class, Object.class)); } catch(final ReflectiveOperationException e) { throw new AssertionError(e.getMessage(), e); } }
Example 20
Source File: JavaAdapterBytecodeGenerator.java From jdk8u_nashorn with GNU General Public License v2.0 | 4 votes |
private static void emitInvokeExact(final InstructionAdapter mv, final MethodType type) { mv.invokevirtual(METHOD_HANDLE_TYPE.getInternalName(), "invokeExact", type.toMethodDescriptorString(), false); }