Java Code Examples for jdk.internal.org.objectweb.asm.MethodVisitor#visitFrame()
The following examples show how to use
jdk.internal.org.objectweb.asm.MethodVisitor#visitFrame() .
These examples are extracted from open source projects.
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 Project: dragonwell8_jdk File: FrameNode.java License: GNU General Public License v2.0 | 6 votes |
/** * Makes the given visitor visit this stack map frame. * * @param mv * a method visitor. */ @Override public void accept(final MethodVisitor mv) { switch (type) { case Opcodes.F_NEW: case Opcodes.F_FULL: mv.visitFrame(type, local.size(), asArray(local), stack.size(), asArray(stack)); break; case Opcodes.F_APPEND: mv.visitFrame(type, local.size(), asArray(local), 0, null); break; case Opcodes.F_CHOP: mv.visitFrame(type, local.size(), null, 0, null); break; case Opcodes.F_SAME: mv.visitFrame(type, 0, null, 0, null); break; case Opcodes.F_SAME1: mv.visitFrame(type, 0, null, 1, asArray(stack)); break; } }
Example 2
Source Project: TencentKona-8 File: RedefineRunningMethodsWithResolutionErrors.java License: GNU General Public License v2.0 | 6 votes |
private static void createMethodBody(MethodVisitor mv) { Label classExists = new Label(); // Cache resolution errors createLoadNonExistentClassCode(mv, classExists); // Redefine our own class and method mv.visitMethodInsn(INVOKESTATIC, "RedefineRunningMethodsWithResolutionErrors", "redefine", "()V"); // Provoke the same error again to make sure the resolution error cache works createLoadNonExistentClassCode(mv, classExists); // Test passed mv.visitInsn(RETURN); mv.visitFrame(F_SAME, 0, new Object[0], 0, new Object[0]); mv.visitLabel(classExists); createThrowRuntimeExceptionCode(mv, "Loaded class that shouldn't exist (\"NonExistentClass\")"); }
Example 3
Source Project: TencentKona-8 File: RedefineRunningMethodsWithResolutionErrors.java License: GNU General Public License v2.0 | 6 votes |
private static void createLoadNonExistentClassCode(MethodVisitor mv, Label classExists) { Label tryLoadBegin = new Label(); Label tryLoadEnd = new Label(); Label catchLoadBlock = new Label(); mv.visitTryCatchBlock(tryLoadBegin, tryLoadEnd, catchLoadBlock, "java/lang/NoClassDefFoundError"); // Try to load a class that does not exist to provoke resolution errors mv.visitLabel(tryLoadBegin); mv.visitMethodInsn(INVOKESTATIC, "NonExistentClass", "nonExistentMethod", "()V"); mv.visitLabel(tryLoadEnd); // No NoClassDefFoundError means NonExistentClass existed, which shouldn't happen mv.visitJumpInsn(GOTO, classExists); mv.visitFrame(F_SAME1, 0, new Object[0], 1, new Object[] { "java/lang/NoClassDefFoundError" }); mv.visitLabel(catchLoadBlock); // Ignore the expected NoClassDefFoundError mv.visitInsn(POP); }
Example 4
Source Project: jdk8u_jdk File: FrameNode.java License: GNU General Public License v2.0 | 6 votes |
/** * Makes the given visitor visit this stack map frame. * * @param mv * a method visitor. */ @Override public void accept(final MethodVisitor mv) { switch (type) { case Opcodes.F_NEW: case Opcodes.F_FULL: mv.visitFrame(type, local.size(), asArray(local), stack.size(), asArray(stack)); break; case Opcodes.F_APPEND: mv.visitFrame(type, local.size(), asArray(local), 0, null); break; case Opcodes.F_CHOP: mv.visitFrame(type, local.size(), null, 0, null); break; case Opcodes.F_SAME: mv.visitFrame(type, 0, null, 0, null); break; case Opcodes.F_SAME1: mv.visitFrame(type, 0, null, 1, asArray(stack)); break; } }
Example 5
Source Project: jdk8u60 File: FrameNode.java License: GNU General Public License v2.0 | 6 votes |
/** * Makes the given visitor visit this stack map frame. * * @param mv * a method visitor. */ @Override public void accept(final MethodVisitor mv) { switch (type) { case Opcodes.F_NEW: case Opcodes.F_FULL: mv.visitFrame(type, local.size(), asArray(local), stack.size(), asArray(stack)); break; case Opcodes.F_APPEND: mv.visitFrame(type, local.size(), asArray(local), 0, null); break; case Opcodes.F_CHOP: mv.visitFrame(type, local.size(), null, 0, null); break; case Opcodes.F_SAME: mv.visitFrame(type, 0, null, 0, null); break; case Opcodes.F_SAME1: mv.visitFrame(type, 0, null, 1, asArray(stack)); break; } }
Example 6
Source Project: openjdk-jdk8u File: RedefineRunningMethodsWithResolutionErrors.java License: GNU General Public License v2.0 | 6 votes |
private static void createMethodBody(MethodVisitor mv) { Label classExists = new Label(); // Cache resolution errors createLoadNonExistentClassCode(mv, classExists); // Redefine our own class and method mv.visitMethodInsn(INVOKESTATIC, "RedefineRunningMethodsWithResolutionErrors", "redefine", "()V"); // Provoke the same error again to make sure the resolution error cache works createLoadNonExistentClassCode(mv, classExists); // Test passed mv.visitInsn(RETURN); mv.visitFrame(F_SAME, 0, new Object[0], 0, new Object[0]); mv.visitLabel(classExists); createThrowRuntimeExceptionCode(mv, "Loaded class that shouldn't exist (\"NonExistentClass\")"); }
Example 7
Source Project: openjdk-jdk8u File: RedefineRunningMethodsWithResolutionErrors.java License: GNU General Public License v2.0 | 6 votes |
private static void createLoadNonExistentClassCode(MethodVisitor mv, Label classExists) { Label tryLoadBegin = new Label(); Label tryLoadEnd = new Label(); Label catchLoadBlock = new Label(); mv.visitTryCatchBlock(tryLoadBegin, tryLoadEnd, catchLoadBlock, "java/lang/NoClassDefFoundError"); // Try to load a class that does not exist to provoke resolution errors mv.visitLabel(tryLoadBegin); mv.visitMethodInsn(INVOKESTATIC, "NonExistentClass", "nonExistentMethod", "()V"); mv.visitLabel(tryLoadEnd); // No NoClassDefFoundError means NonExistentClass existed, which shouldn't happen mv.visitJumpInsn(GOTO, classExists); mv.visitFrame(F_SAME1, 0, new Object[0], 1, new Object[] { "java/lang/NoClassDefFoundError" }); mv.visitLabel(catchLoadBlock); // Ignore the expected NoClassDefFoundError mv.visitInsn(POP); }
Example 8
Source Project: openjdk-jdk8u File: FrameNode.java License: GNU General Public License v2.0 | 6 votes |
/** * Makes the given visitor visit this stack map frame. * * @param mv * a method visitor. */ @Override public void accept(final MethodVisitor mv) { switch (type) { case Opcodes.F_NEW: case Opcodes.F_FULL: mv.visitFrame(type, local.size(), asArray(local), stack.size(), asArray(stack)); break; case Opcodes.F_APPEND: mv.visitFrame(type, local.size(), asArray(local), 0, null); break; case Opcodes.F_CHOP: mv.visitFrame(type, local.size(), null, 0, null); break; case Opcodes.F_SAME: mv.visitFrame(type, 0, null, 0, null); break; case Opcodes.F_SAME1: mv.visitFrame(type, 0, null, 1, asArray(stack)); break; } }
Example 9
Source Project: jdk8u-jdk File: FrameNode.java License: GNU General Public License v2.0 | 6 votes |
/** * Makes the given visitor visit this stack map frame. * * @param mv * a method visitor. */ @Override public void accept(final MethodVisitor mv) { switch (type) { case Opcodes.F_NEW: case Opcodes.F_FULL: mv.visitFrame(type, local.size(), asArray(local), stack.size(), asArray(stack)); break; case Opcodes.F_APPEND: mv.visitFrame(type, local.size(), asArray(local), 0, null); break; case Opcodes.F_CHOP: mv.visitFrame(type, local.size(), null, 0, null); break; case Opcodes.F_SAME: mv.visitFrame(type, 0, null, 0, null); break; case Opcodes.F_SAME1: mv.visitFrame(type, 0, null, 1, asArray(stack)); break; } }
Example 10
Source Project: openjdk-jdk8u-backup File: RedefineRunningMethodsWithResolutionErrors.java License: GNU General Public License v2.0 | 6 votes |
private static void createLoadNonExistentClassCode(MethodVisitor mv, Label classExists) { Label tryLoadBegin = new Label(); Label tryLoadEnd = new Label(); Label catchLoadBlock = new Label(); mv.visitTryCatchBlock(tryLoadBegin, tryLoadEnd, catchLoadBlock, "java/lang/NoClassDefFoundError"); // Try to load a class that does not exist to provoke resolution errors mv.visitLabel(tryLoadBegin); mv.visitMethodInsn(INVOKESTATIC, "NonExistentClass", "nonExistentMethod", "()V"); mv.visitLabel(tryLoadEnd); // No NoClassDefFoundError means NonExistentClass existed, which shouldn't happen mv.visitJumpInsn(GOTO, classExists); mv.visitFrame(F_SAME1, 0, new Object[0], 1, new Object[] { "java/lang/NoClassDefFoundError" }); mv.visitLabel(catchLoadBlock); // Ignore the expected NoClassDefFoundError mv.visitInsn(POP); }
Example 11
Source Project: openjdk-jdk8u-backup File: FrameNode.java License: GNU General Public License v2.0 | 6 votes |
/** * Makes the given visitor visit this stack map frame. * * @param mv * a method visitor. */ @Override public void accept(final MethodVisitor mv) { switch (type) { case Opcodes.F_NEW: case Opcodes.F_FULL: mv.visitFrame(type, local.size(), asArray(local), stack.size(), asArray(stack)); break; case Opcodes.F_APPEND: mv.visitFrame(type, local.size(), asArray(local), 0, null); break; case Opcodes.F_CHOP: mv.visitFrame(type, local.size(), null, 0, null); break; case Opcodes.F_SAME: mv.visitFrame(type, 0, null, 0, null); break; case Opcodes.F_SAME1: mv.visitFrame(type, 0, null, 1, asArray(stack)); break; } }
Example 12
Source Project: jdk8u-dev-jdk File: FrameNode.java License: GNU General Public License v2.0 | 6 votes |
/** * Makes the given visitor visit this stack map frame. * * @param mv * a method visitor. */ @Override public void accept(final MethodVisitor mv) { switch (type) { case Opcodes.F_NEW: case Opcodes.F_FULL: mv.visitFrame(type, local.size(), asArray(local), stack.size(), asArray(stack)); break; case Opcodes.F_APPEND: mv.visitFrame(type, local.size(), asArray(local), 0, null); break; case Opcodes.F_CHOP: mv.visitFrame(type, local.size(), null, 0, null); break; case Opcodes.F_SAME: mv.visitFrame(type, 0, null, 0, null); break; case Opcodes.F_SAME1: mv.visitFrame(type, 0, null, 1, asArray(stack)); break; } }
Example 13
Source Project: openjdk-jdk9 File: RedefineRunningMethodsWithResolutionErrors.java License: GNU General Public License v2.0 | 6 votes |
private static void createMethodBody(MethodVisitor mv) { Label classExists = new Label(); // Cache resolution errors createLoadNonExistentClassCode(mv, classExists); // Redefine our own class and method mv.visitMethodInsn(INVOKESTATIC, "RedefineRunningMethodsWithResolutionErrors", "redefine", "()V"); // Provoke the same error again to make sure the resolution error cache works createLoadNonExistentClassCode(mv, classExists); // Test passed mv.visitInsn(RETURN); mv.visitFrame(F_SAME, 0, new Object[0], 0, new Object[0]); mv.visitLabel(classExists); createThrowRuntimeExceptionCode(mv, "Loaded class that shouldn't exist (\"NonExistentClass\")"); }
Example 14
Source Project: openjdk-jdk9 File: RedefineRunningMethodsWithResolutionErrors.java License: GNU General Public License v2.0 | 6 votes |
private static void createLoadNonExistentClassCode(MethodVisitor mv, Label classExists) { Label tryLoadBegin = new Label(); Label tryLoadEnd = new Label(); Label catchLoadBlock = new Label(); mv.visitTryCatchBlock(tryLoadBegin, tryLoadEnd, catchLoadBlock, "java/lang/NoClassDefFoundError"); // Try to load a class that does not exist to provoke resolution errors mv.visitLabel(tryLoadBegin); mv.visitMethodInsn(INVOKESTATIC, "NonExistentClass", "nonExistentMethod", "()V"); mv.visitLabel(tryLoadEnd); // No NoClassDefFoundError means NonExistentClass existed, which shouldn't happen mv.visitJumpInsn(GOTO, classExists); mv.visitFrame(F_SAME1, 0, new Object[0], 1, new Object[] { "java/lang/NoClassDefFoundError" }); mv.visitLabel(catchLoadBlock); // Ignore the expected NoClassDefFoundError mv.visitInsn(POP); }
Example 15
Source Project: openjdk-jdk9 File: FrameNode.java License: GNU General Public License v2.0 | 6 votes |
/** * Makes the given visitor visit this stack map frame. * * @param mv * a method visitor. */ @Override public void accept(final MethodVisitor mv) { switch (type) { case Opcodes.F_NEW: case Opcodes.F_FULL: mv.visitFrame(type, local.size(), asArray(local), stack.size(), asArray(stack)); break; case Opcodes.F_APPEND: mv.visitFrame(type, local.size(), asArray(local), 0, null); break; case Opcodes.F_CHOP: mv.visitFrame(type, local.size(), null, 0, null); break; case Opcodes.F_SAME: mv.visitFrame(type, 0, null, 0, null); break; case Opcodes.F_SAME1: mv.visitFrame(type, 0, null, 1, asArray(stack)); break; } }
Example 16
Source Project: jdk8u-jdk File: FrameNode.java License: GNU General Public License v2.0 | 6 votes |
/** * Makes the given visitor visit this stack map frame. * * @param mv * a method visitor. */ @Override public void accept(final MethodVisitor mv) { switch (type) { case Opcodes.F_NEW: case Opcodes.F_FULL: mv.visitFrame(type, local.size(), asArray(local), stack.size(), asArray(stack)); break; case Opcodes.F_APPEND: mv.visitFrame(type, local.size(), asArray(local), 0, null); break; case Opcodes.F_CHOP: mv.visitFrame(type, local.size(), null, 0, null); break; case Opcodes.F_SAME: mv.visitFrame(type, 0, null, 0, null); break; case Opcodes.F_SAME1: mv.visitFrame(type, 0, null, 1, asArray(stack)); break; } }
Example 17
Source Project: hottub File: RedefineRunningMethodsWithResolutionErrors.java License: GNU General Public License v2.0 | 6 votes |
private static void createMethodBody(MethodVisitor mv) { Label classExists = new Label(); // Cache resolution errors createLoadNonExistentClassCode(mv, classExists); // Redefine our own class and method mv.visitMethodInsn(INVOKESTATIC, "RedefineRunningMethodsWithResolutionErrors", "redefine", "()V"); // Provoke the same error again to make sure the resolution error cache works createLoadNonExistentClassCode(mv, classExists); // Test passed mv.visitInsn(RETURN); mv.visitFrame(F_SAME, 0, new Object[0], 0, new Object[0]); mv.visitLabel(classExists); createThrowRuntimeExceptionCode(mv, "Loaded class that shouldn't exist (\"NonExistentClass\")"); }
Example 18
Source Project: nashorn File: FrameNode.java License: GNU General Public License v2.0 | 6 votes |
/** * Makes the given visitor visit this stack map frame. * * @param mv a method visitor. */ @Override public void accept(final MethodVisitor mv) { switch (type) { case Opcodes.F_NEW: case Opcodes.F_FULL: mv.visitFrame(type, local.size(), asArray(local), stack.size(), asArray(stack)); break; case Opcodes.F_APPEND: mv.visitFrame(type, local.size(), asArray(local), 0, null); break; case Opcodes.F_CHOP: mv.visitFrame(type, local.size(), null, 0, null); break; case Opcodes.F_SAME: mv.visitFrame(type, 0, null, 0, null); break; case Opcodes.F_SAME1: mv.visitFrame(type, 0, null, 1, asArray(stack)); break; } }
Example 19
Source Project: hottub File: FrameNode.java License: GNU General Public License v2.0 | 6 votes |
/** * Makes the given visitor visit this stack map frame. * * @param mv * a method visitor. */ @Override public void accept(final MethodVisitor mv) { switch (type) { case Opcodes.F_NEW: case Opcodes.F_FULL: mv.visitFrame(type, local.size(), asArray(local), stack.size(), asArray(stack)); break; case Opcodes.F_APPEND: mv.visitFrame(type, local.size(), asArray(local), 0, null); break; case Opcodes.F_CHOP: mv.visitFrame(type, local.size(), null, 0, null); break; case Opcodes.F_SAME: mv.visitFrame(type, 0, null, 0, null); break; case Opcodes.F_SAME1: mv.visitFrame(type, 0, null, 1, asArray(stack)); break; } }
Example 20
Source Project: openjdk-8 File: FrameNode.java License: GNU General Public License v2.0 | 6 votes |
/** * Makes the given visitor visit this stack map frame. * * @param mv * a method visitor. */ @Override public void accept(final MethodVisitor mv) { switch (type) { case Opcodes.F_NEW: case Opcodes.F_FULL: mv.visitFrame(type, local.size(), asArray(local), stack.size(), asArray(stack)); break; case Opcodes.F_APPEND: mv.visitFrame(type, local.size(), asArray(local), 0, null); break; case Opcodes.F_CHOP: mv.visitFrame(type, local.size(), null, 0, null); break; case Opcodes.F_SAME: mv.visitFrame(type, 0, null, 0, null); break; case Opcodes.F_SAME1: mv.visitFrame(type, 0, null, 1, asArray(stack)); break; } }