Java Code Examples for jdk.internal.org.objectweb.asm.Opcodes#F_CHOP
The following examples show how to use
jdk.internal.org.objectweb.asm.Opcodes#F_CHOP .
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: FrameNode.java From jdk8u-dev-jdk with 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 File: FrameNode.java From jdk8u-jdk with 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 3
Source File: FrameNode.java From hottub with 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 4
Source File: FrameNode.java From Bytecoder with Apache License 2.0 | 5 votes |
/** * Constructs a new {@link FrameNode}. * * @param type the type of this frame. Must be {@link Opcodes#F_NEW} for expanded frames, or * {@link Opcodes#F_FULL}, {@link Opcodes#F_APPEND}, {@link Opcodes#F_CHOP}, {@link * Opcodes#F_SAME} or {@link Opcodes#F_APPEND}, {@link Opcodes#F_SAME1} for compressed frames. * @param numLocal number of local variables of this stack map frame. * @param local the types of the local variables of this stack map frame. Elements of this list * can be Integer, String or LabelNode objects (for primitive, reference and uninitialized * types respectively - see {@link MethodVisitor}). * @param numStack number of operand stack elements of this stack map frame. * @param stack the types of the operand stack elements of this stack map frame. Elements of this * list can be Integer, String or LabelNode objects (for primitive, reference and * uninitialized types respectively - see {@link MethodVisitor}). */ public FrameNode( final int type, final int numLocal, final Object[] local, final int numStack, final Object[] stack) { super(-1); this.type = type; switch (type) { case Opcodes.F_NEW: case Opcodes.F_FULL: this.local = Util.asArrayList(numLocal, local); this.stack = Util.asArrayList(numStack, stack); break; case Opcodes.F_APPEND: this.local = Util.asArrayList(numLocal, local); break; case Opcodes.F_CHOP: this.local = Util.asArrayList(numLocal); break; case Opcodes.F_SAME: break; case Opcodes.F_SAME1: this.stack = Util.asArrayList(1, stack); break; default: throw new IllegalArgumentException(); } }
Example 5
Source File: Textifier.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@Override public void visitFrame(final int type, final int nLocal, final Object[] local, final int nStack, final Object[] stack) { buf.setLength(0); buf.append(ltab); buf.append("FRAME "); switch (type) { case Opcodes.F_NEW: case Opcodes.F_FULL: buf.append("FULL ["); appendFrameTypes(nLocal, local); buf.append("] ["); appendFrameTypes(nStack, stack); buf.append(']'); break; case Opcodes.F_APPEND: buf.append("APPEND ["); appendFrameTypes(nLocal, local); buf.append(']'); break; case Opcodes.F_CHOP: buf.append("CHOP ").append(nLocal); break; case Opcodes.F_SAME: buf.append("SAME"); break; case Opcodes.F_SAME1: buf.append("SAME1 "); appendFrameTypes(1, stack); break; } buf.append('\n'); text.add(buf.toString()); }
Example 6
Source File: Textifier.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public void visitFrame(final int type, final int nLocal, final Object[] local, final int nStack, final Object[] stack) { buf.setLength(0); buf.append(ltab); buf.append("FRAME "); switch (type) { case Opcodes.F_NEW: case Opcodes.F_FULL: buf.append("FULL ["); appendFrameTypes(nLocal, local); buf.append("] ["); appendFrameTypes(nStack, stack); buf.append(']'); break; case Opcodes.F_APPEND: buf.append("APPEND ["); appendFrameTypes(nLocal, local); buf.append(']'); break; case Opcodes.F_CHOP: buf.append("CHOP ").append(nLocal); break; case Opcodes.F_SAME: buf.append("SAME"); break; case Opcodes.F_SAME1: buf.append("SAME1 "); appendFrameTypes(1, stack); break; } buf.append('\n'); text.add(buf.toString()); }
Example 7
Source File: ASMifier.java From hottub with GNU General Public License v2.0 | 4 votes |
@Override public void visitFrame(final int type, final int nLocal, final Object[] local, final int nStack, final Object[] stack) { buf.setLength(0); switch (type) { case Opcodes.F_NEW: case Opcodes.F_FULL: declareFrameTypes(nLocal, local); declareFrameTypes(nStack, stack); if (type == Opcodes.F_NEW) { buf.append(name).append(".visitFrame(Opcodes.F_NEW, "); } else { buf.append(name).append(".visitFrame(Opcodes.F_FULL, "); } buf.append(nLocal).append(", new Object[] {"); appendFrameTypes(nLocal, local); buf.append("}, ").append(nStack).append(", new Object[] {"); appendFrameTypes(nStack, stack); buf.append('}'); break; case Opcodes.F_APPEND: declareFrameTypes(nLocal, local); buf.append(name).append(".visitFrame(Opcodes.F_APPEND,") .append(nLocal).append(", new Object[] {"); appendFrameTypes(nLocal, local); buf.append("}, 0, null"); break; case Opcodes.F_CHOP: buf.append(name).append(".visitFrame(Opcodes.F_CHOP,") .append(nLocal).append(", null, 0, null"); break; case Opcodes.F_SAME: buf.append(name).append( ".visitFrame(Opcodes.F_SAME, 0, null, 0, null"); break; case Opcodes.F_SAME1: declareFrameTypes(1, stack); buf.append(name).append( ".visitFrame(Opcodes.F_SAME1, 0, null, 1, new Object[] {"); appendFrameTypes(1, stack); buf.append('}'); break; } buf.append(");\n"); text.add(buf.toString()); }
Example 8
Source File: ASMifier.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
@Override public void visitFrame(final int type, final int nLocal, final Object[] local, final int nStack, final Object[] stack) { buf.setLength(0); switch (type) { case Opcodes.F_NEW: case Opcodes.F_FULL: declareFrameTypes(nLocal, local); declareFrameTypes(nStack, stack); if (type == Opcodes.F_NEW) { buf.append(name).append(".visitFrame(Opcodes.F_NEW, "); } else { buf.append(name).append(".visitFrame(Opcodes.F_FULL, "); } buf.append(nLocal).append(", new Object[] {"); appendFrameTypes(nLocal, local); buf.append("}, ").append(nStack).append(", new Object[] {"); appendFrameTypes(nStack, stack); buf.append('}'); break; case Opcodes.F_APPEND: declareFrameTypes(nLocal, local); buf.append(name).append(".visitFrame(Opcodes.F_APPEND,") .append(nLocal).append(", new Object[] {"); appendFrameTypes(nLocal, local); buf.append("}, 0, null"); break; case Opcodes.F_CHOP: buf.append(name).append(".visitFrame(Opcodes.F_CHOP,") .append(nLocal).append(", null, 0, null"); break; case Opcodes.F_SAME: buf.append(name).append( ".visitFrame(Opcodes.F_SAME, 0, null, 0, null"); break; case Opcodes.F_SAME1: declareFrameTypes(1, stack); buf.append(name).append( ".visitFrame(Opcodes.F_SAME1, 0, null, 1, new Object[] {"); appendFrameTypes(1, stack); buf.append('}'); break; } buf.append(");\n"); text.add(buf.toString()); }
Example 9
Source File: CheckMethodAdapter.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
@Override public void visitFrame(final int type, final int nLocal, final Object[] local, final int nStack, final Object[] stack) { if (insnCount == lastFrame) { throw new IllegalStateException( "At most one frame can be visited at a given code location."); } lastFrame = insnCount; int mLocal; int mStack; switch (type) { case Opcodes.F_NEW: case Opcodes.F_FULL: mLocal = Integer.MAX_VALUE; mStack = Integer.MAX_VALUE; break; case Opcodes.F_SAME: mLocal = 0; mStack = 0; break; case Opcodes.F_SAME1: mLocal = 0; mStack = 1; break; case Opcodes.F_APPEND: case Opcodes.F_CHOP: mLocal = 3; mStack = 0; break; default: throw new IllegalArgumentException("Invalid frame type " + type); } if (nLocal > mLocal) { throw new IllegalArgumentException("Invalid nLocal=" + nLocal + " for frame type " + type); } if (nStack > mStack) { throw new IllegalArgumentException("Invalid nStack=" + nStack + " for frame type " + type); } if (type != Opcodes.F_CHOP) { if (nLocal > 0 && (local == null || local.length < nLocal)) { throw new IllegalArgumentException( "Array local[] is shorter than nLocal"); } for (int i = 0; i < nLocal; ++i) { checkFrameValue(local[i]); } } if (nStack > 0 && (stack == null || stack.length < nStack)) { throw new IllegalArgumentException( "Array stack[] is shorter than nStack"); } for (int i = 0; i < nStack; ++i) { checkFrameValue(stack[i]); } if (type == Opcodes.F_NEW) { ++expandedFrames; } else { ++compressedFrames; } if (expandedFrames > 0 && compressedFrames > 0) { throw new RuntimeException( "Expanded and compressed frames must not be mixed."); } super.visitFrame(type, nLocal, local, nStack, stack); }
Example 10
Source File: FrameNode.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * Constructs a new {@link FrameNode}. * * @param type * the type of this frame. Must be {@link Opcodes#F_NEW} for * expanded frames, or {@link Opcodes#F_FULL}, * {@link Opcodes#F_APPEND}, {@link Opcodes#F_CHOP}, * {@link Opcodes#F_SAME} or {@link Opcodes#F_APPEND}, * {@link Opcodes#F_SAME1} for compressed frames. * @param nLocal * number of local variables of this stack map frame. * @param local * the types of the local variables of this stack map frame. * Elements of this list can be Integer, String or LabelNode * objects (for primitive, reference and uninitialized types * respectively - see {@link MethodVisitor}). * @param nStack * number of operand stack elements of this stack map frame. * @param stack * the types of the operand stack elements of this stack map * frame. Elements of this list can be Integer, String or * LabelNode objects (for primitive, reference and uninitialized * types respectively - see {@link MethodVisitor}). */ public FrameNode(final int type, final int nLocal, final Object[] local, final int nStack, final Object[] stack) { super(-1); this.type = type; switch (type) { case Opcodes.F_NEW: case Opcodes.F_FULL: this.local = asList(nLocal, local); this.stack = asList(nStack, stack); break; case Opcodes.F_APPEND: this.local = asList(nLocal, local); break; case Opcodes.F_CHOP: this.local = Arrays.asList(new Object[nLocal]); break; case Opcodes.F_SAME: break; case Opcodes.F_SAME1: this.stack = asList(1, stack); break; } }
Example 11
Source File: CheckMethodAdapter.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
@Override public void visitFrame(final int type, final int nLocal, final Object[] local, final int nStack, final Object[] stack) { if (insnCount == lastFrame) { throw new IllegalStateException( "At most one frame can be visited at a given code location."); } lastFrame = insnCount; int mLocal; int mStack; switch (type) { case Opcodes.F_NEW: case Opcodes.F_FULL: mLocal = Integer.MAX_VALUE; mStack = Integer.MAX_VALUE; break; case Opcodes.F_SAME: mLocal = 0; mStack = 0; break; case Opcodes.F_SAME1: mLocal = 0; mStack = 1; break; case Opcodes.F_APPEND: case Opcodes.F_CHOP: mLocal = 3; mStack = 0; break; default: throw new IllegalArgumentException("Invalid frame type " + type); } if (nLocal > mLocal) { throw new IllegalArgumentException("Invalid nLocal=" + nLocal + " for frame type " + type); } if (nStack > mStack) { throw new IllegalArgumentException("Invalid nStack=" + nStack + " for frame type " + type); } if (type != Opcodes.F_CHOP) { if (nLocal > 0 && (local == null || local.length < nLocal)) { throw new IllegalArgumentException( "Array local[] is shorter than nLocal"); } for (int i = 0; i < nLocal; ++i) { checkFrameValue(local[i]); } } if (nStack > 0 && (stack == null || stack.length < nStack)) { throw new IllegalArgumentException( "Array stack[] is shorter than nStack"); } for (int i = 0; i < nStack; ++i) { checkFrameValue(stack[i]); } if (type == Opcodes.F_NEW) { ++expandedFrames; } else { ++compressedFrames; } if (expandedFrames > 0 && compressedFrames > 0) { throw new RuntimeException( "Expanded and compressed frames must not be mixed."); } super.visitFrame(type, nLocal, local, nStack, stack); }
Example 12
Source File: ASMifier.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
@Override public void visitFrame(final int type, final int nLocal, final Object[] local, final int nStack, final Object[] stack) { buf.setLength(0); switch (type) { case Opcodes.F_NEW: case Opcodes.F_FULL: declareFrameTypes(nLocal, local); declareFrameTypes(nStack, stack); if (type == Opcodes.F_NEW) { buf.append(name).append(".visitFrame(Opcodes.F_NEW, "); } else { buf.append(name).append(".visitFrame(Opcodes.F_FULL, "); } buf.append(nLocal).append(", new Object[] {"); appendFrameTypes(nLocal, local); buf.append("}, ").append(nStack).append(", new Object[] {"); appendFrameTypes(nStack, stack); buf.append('}'); break; case Opcodes.F_APPEND: declareFrameTypes(nLocal, local); buf.append(name).append(".visitFrame(Opcodes.F_APPEND,") .append(nLocal).append(", new Object[] {"); appendFrameTypes(nLocal, local); buf.append("}, 0, null"); break; case Opcodes.F_CHOP: buf.append(name).append(".visitFrame(Opcodes.F_CHOP,") .append(nLocal).append(", null, 0, null"); break; case Opcodes.F_SAME: buf.append(name).append( ".visitFrame(Opcodes.F_SAME, 0, null, 0, null"); break; case Opcodes.F_SAME1: declareFrameTypes(1, stack); buf.append(name).append( ".visitFrame(Opcodes.F_SAME1, 0, null, 1, new Object[] {"); appendFrameTypes(1, stack); buf.append('}'); break; } buf.append(");\n"); text.add(buf.toString()); }
Example 13
Source File: CheckMethodAdapter.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
@Override public void visitFrame(final int type, final int nLocal, final Object[] local, final int nStack, final Object[] stack) { if (insnCount == lastFrame) { throw new IllegalStateException( "At most one frame can be visited at a given code location."); } lastFrame = insnCount; int mLocal; int mStack; switch (type) { case Opcodes.F_NEW: case Opcodes.F_FULL: mLocal = Integer.MAX_VALUE; mStack = Integer.MAX_VALUE; break; case Opcodes.F_SAME: mLocal = 0; mStack = 0; break; case Opcodes.F_SAME1: mLocal = 0; mStack = 1; break; case Opcodes.F_APPEND: case Opcodes.F_CHOP: mLocal = 3; mStack = 0; break; default: throw new IllegalArgumentException("Invalid frame type " + type); } if (nLocal > mLocal) { throw new IllegalArgumentException("Invalid nLocal=" + nLocal + " for frame type " + type); } if (nStack > mStack) { throw new IllegalArgumentException("Invalid nStack=" + nStack + " for frame type " + type); } if (type != Opcodes.F_CHOP) { if (nLocal > 0 && (local == null || local.length < nLocal)) { throw new IllegalArgumentException( "Array local[] is shorter than nLocal"); } for (int i = 0; i < nLocal; ++i) { checkFrameValue(local[i]); } } if (nStack > 0 && (stack == null || stack.length < nStack)) { throw new IllegalArgumentException( "Array stack[] is shorter than nStack"); } for (int i = 0; i < nStack; ++i) { checkFrameValue(stack[i]); } if (type == Opcodes.F_NEW) { ++expandedFrames; } else { ++compressedFrames; } if (expandedFrames > 0 && compressedFrames > 0) { throw new RuntimeException( "Expanded and compressed frames must not be mixed."); } super.visitFrame(type, nLocal, local, nStack, stack); }
Example 14
Source File: FrameNode.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
/** * Constructs a new {@link FrameNode}. * * @param type * the type of this frame. Must be {@link Opcodes#F_NEW} for * expanded frames, or {@link Opcodes#F_FULL}, * {@link Opcodes#F_APPEND}, {@link Opcodes#F_CHOP}, * {@link Opcodes#F_SAME} or {@link Opcodes#F_APPEND}, * {@link Opcodes#F_SAME1} for compressed frames. * @param nLocal * number of local variables of this stack map frame. * @param local * the types of the local variables of this stack map frame. * Elements of this list can be Integer, String or LabelNode * objects (for primitive, reference and uninitialized types * respectively - see {@link MethodVisitor}). * @param nStack * number of operand stack elements of this stack map frame. * @param stack * the types of the operand stack elements of this stack map * frame. Elements of this list can be Integer, String or * LabelNode objects (for primitive, reference and uninitialized * types respectively - see {@link MethodVisitor}). */ public FrameNode(final int type, final int nLocal, final Object[] local, final int nStack, final Object[] stack) { super(-1); this.type = type; switch (type) { case Opcodes.F_NEW: case Opcodes.F_FULL: this.local = asList(nLocal, local); this.stack = asList(nStack, stack); break; case Opcodes.F_APPEND: this.local = asList(nLocal, local); break; case Opcodes.F_CHOP: this.local = Arrays.asList(new Object[nLocal]); break; case Opcodes.F_SAME: break; case Opcodes.F_SAME1: this.stack = asList(1, stack); break; } }
Example 15
Source File: CheckMethodAdapter.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
@Override public void visitFrame(final int type, final int nLocal, final Object[] local, final int nStack, final Object[] stack) { if (insnCount == lastFrame) { throw new IllegalStateException( "At most one frame can be visited at a given code location."); } lastFrame = insnCount; int mLocal; int mStack; switch (type) { case Opcodes.F_NEW: case Opcodes.F_FULL: mLocal = Integer.MAX_VALUE; mStack = Integer.MAX_VALUE; break; case Opcodes.F_SAME: mLocal = 0; mStack = 0; break; case Opcodes.F_SAME1: mLocal = 0; mStack = 1; break; case Opcodes.F_APPEND: case Opcodes.F_CHOP: mLocal = 3; mStack = 0; break; default: throw new IllegalArgumentException("Invalid frame type " + type); } if (nLocal > mLocal) { throw new IllegalArgumentException("Invalid nLocal=" + nLocal + " for frame type " + type); } if (nStack > mStack) { throw new IllegalArgumentException("Invalid nStack=" + nStack + " for frame type " + type); } if (type != Opcodes.F_CHOP) { if (nLocal > 0 && (local == null || local.length < nLocal)) { throw new IllegalArgumentException( "Array local[] is shorter than nLocal"); } for (int i = 0; i < nLocal; ++i) { checkFrameValue(local[i]); } } if (nStack > 0 && (stack == null || stack.length < nStack)) { throw new IllegalArgumentException( "Array stack[] is shorter than nStack"); } for (int i = 0; i < nStack; ++i) { checkFrameValue(stack[i]); } if (type == Opcodes.F_NEW) { ++expandedFrames; } else { ++compressedFrames; } if (expandedFrames > 0 && compressedFrames > 0) { throw new RuntimeException( "Expanded and compressed frames must not be mixed."); } super.visitFrame(type, nLocal, local, nStack, stack); }
Example 16
Source File: FrameNode.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
/** * Constructs a new {@link FrameNode}. * * @param type * the type of this frame. Must be {@link Opcodes#F_NEW} for * expanded frames, or {@link Opcodes#F_FULL}, * {@link Opcodes#F_APPEND}, {@link Opcodes#F_CHOP}, * {@link Opcodes#F_SAME} or {@link Opcodes#F_APPEND}, * {@link Opcodes#F_SAME1} for compressed frames. * @param nLocal * number of local variables of this stack map frame. * @param local * the types of the local variables of this stack map frame. * Elements of this list can be Integer, String or LabelNode * objects (for primitive, reference and uninitialized types * respectively - see {@link MethodVisitor}). * @param nStack * number of operand stack elements of this stack map frame. * @param stack * the types of the operand stack elements of this stack map * frame. Elements of this list can be Integer, String or * LabelNode objects (for primitive, reference and uninitialized * types respectively - see {@link MethodVisitor}). */ public FrameNode(final int type, final int nLocal, final Object[] local, final int nStack, final Object[] stack) { super(-1); this.type = type; switch (type) { case Opcodes.F_NEW: case Opcodes.F_FULL: this.local = asList(nLocal, local); this.stack = asList(nStack, stack); break; case Opcodes.F_APPEND: this.local = asList(nLocal, local); break; case Opcodes.F_CHOP: this.local = Arrays.asList(new Object[nLocal]); break; case Opcodes.F_SAME: break; case Opcodes.F_SAME1: this.stack = asList(1, stack); break; } }
Example 17
Source File: CheckMethodAdapter.java From Bytecoder with Apache License 2.0 | 4 votes |
@Override public void visitFrame( final int type, final int numLocal, final Object[] local, final int numStack, final Object[] stack) { if (insnCount == lastFrameInsnIndex) { throw new IllegalStateException("At most one frame can be visited at a given code location."); } lastFrameInsnIndex = insnCount; int maxNumLocal; int maxNumStack; switch (type) { case Opcodes.F_NEW: case Opcodes.F_FULL: maxNumLocal = Integer.MAX_VALUE; maxNumStack = Integer.MAX_VALUE; break; case Opcodes.F_SAME: maxNumLocal = 0; maxNumStack = 0; break; case Opcodes.F_SAME1: maxNumLocal = 0; maxNumStack = 1; break; case Opcodes.F_APPEND: case Opcodes.F_CHOP: maxNumLocal = 3; maxNumStack = 0; break; default: throw new IllegalArgumentException("Invalid frame type " + type); } if (numLocal > maxNumLocal) { throw new IllegalArgumentException( "Invalid numLocal=" + numLocal + " for frame type " + type); } if (numStack > maxNumStack) { throw new IllegalArgumentException( "Invalid numStack=" + numStack + " for frame type " + type); } if (type != Opcodes.F_CHOP) { if (numLocal > 0 && (local == null || local.length < numLocal)) { throw new IllegalArgumentException("Array local[] is shorter than numLocal"); } for (int i = 0; i < numLocal; ++i) { checkFrameValue(local[i]); } } if (numStack > 0 && (stack == null || stack.length < numStack)) { throw new IllegalArgumentException("Array stack[] is shorter than numStack"); } for (int i = 0; i < numStack; ++i) { checkFrameValue(stack[i]); } if (type == Opcodes.F_NEW) { ++numExpandedFrames; } else { ++numCompressedFrames; } if (numExpandedFrames > 0 && numCompressedFrames > 0) { throw new IllegalArgumentException("Expanded and compressed frames must not be mixed."); } super.visitFrame(type, numLocal, local, numStack, stack); }
Example 18
Source File: ASMifier.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
@Override public void visitFrame(final int type, final int nLocal, final Object[] local, final int nStack, final Object[] stack) { buf.setLength(0); switch (type) { case Opcodes.F_NEW: case Opcodes.F_FULL: declareFrameTypes(nLocal, local); declareFrameTypes(nStack, stack); if (type == Opcodes.F_NEW) { buf.append(name).append(".visitFrame(Opcodes.F_NEW, "); } else { buf.append(name).append(".visitFrame(Opcodes.F_FULL, "); } buf.append(nLocal).append(", new Object[] {"); appendFrameTypes(nLocal, local); buf.append("}, ").append(nStack).append(", new Object[] {"); appendFrameTypes(nStack, stack); buf.append('}'); break; case Opcodes.F_APPEND: declareFrameTypes(nLocal, local); buf.append(name).append(".visitFrame(Opcodes.F_APPEND,") .append(nLocal).append(", new Object[] {"); appendFrameTypes(nLocal, local); buf.append("}, 0, null"); break; case Opcodes.F_CHOP: buf.append(name).append(".visitFrame(Opcodes.F_CHOP,") .append(nLocal).append(", null, 0, null"); break; case Opcodes.F_SAME: buf.append(name).append( ".visitFrame(Opcodes.F_SAME, 0, null, 0, null"); break; case Opcodes.F_SAME1: declareFrameTypes(1, stack); buf.append(name).append( ".visitFrame(Opcodes.F_SAME1, 0, null, 1, new Object[] {"); appendFrameTypes(1, stack); buf.append('}'); break; } buf.append(");\n"); text.add(buf.toString()); }
Example 19
Source File: FrameNode.java From hottub with GNU General Public License v2.0 | 4 votes |
/** * Constructs a new {@link FrameNode}. * * @param type * the type of this frame. Must be {@link Opcodes#F_NEW} for * expanded frames, or {@link Opcodes#F_FULL}, * {@link Opcodes#F_APPEND}, {@link Opcodes#F_CHOP}, * {@link Opcodes#F_SAME} or {@link Opcodes#F_APPEND}, * {@link Opcodes#F_SAME1} for compressed frames. * @param nLocal * number of local variables of this stack map frame. * @param local * the types of the local variables of this stack map frame. * Elements of this list can be Integer, String or LabelNode * objects (for primitive, reference and uninitialized types * respectively - see {@link MethodVisitor}). * @param nStack * number of operand stack elements of this stack map frame. * @param stack * the types of the operand stack elements of this stack map * frame. Elements of this list can be Integer, String or * LabelNode objects (for primitive, reference and uninitialized * types respectively - see {@link MethodVisitor}). */ public FrameNode(final int type, final int nLocal, final Object[] local, final int nStack, final Object[] stack) { super(-1); this.type = type; switch (type) { case Opcodes.F_NEW: case Opcodes.F_FULL: this.local = asList(nLocal, local); this.stack = asList(nStack, stack); break; case Opcodes.F_APPEND: this.local = asList(nLocal, local); break; case Opcodes.F_CHOP: this.local = Arrays.asList(new Object[nLocal]); break; case Opcodes.F_SAME: break; case Opcodes.F_SAME1: this.stack = asList(1, stack); break; } }
Example 20
Source File: FrameNode.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
/** * Constructs a new {@link FrameNode}. * * @param type * the type of this frame. Must be {@link Opcodes#F_NEW} for * expanded frames, or {@link Opcodes#F_FULL}, * {@link Opcodes#F_APPEND}, {@link Opcodes#F_CHOP}, * {@link Opcodes#F_SAME} or {@link Opcodes#F_APPEND}, * {@link Opcodes#F_SAME1} for compressed frames. * @param nLocal * number of local variables of this stack map frame. * @param local * the types of the local variables of this stack map frame. * Elements of this list can be Integer, String or LabelNode * objects (for primitive, reference and uninitialized types * respectively - see {@link MethodVisitor}). * @param nStack * number of operand stack elements of this stack map frame. * @param stack * the types of the operand stack elements of this stack map * frame. Elements of this list can be Integer, String or * LabelNode objects (for primitive, reference and uninitialized * types respectively - see {@link MethodVisitor}). */ public FrameNode(final int type, final int nLocal, final Object[] local, final int nStack, final Object[] stack) { super(-1); this.type = type; switch (type) { case Opcodes.F_NEW: case Opcodes.F_FULL: this.local = asList(nLocal, local); this.stack = asList(nStack, stack); break; case Opcodes.F_APPEND: this.local = asList(nLocal, local); break; case Opcodes.F_CHOP: this.local = Arrays.asList(new Object[nLocal]); break; case Opcodes.F_SAME: break; case Opcodes.F_SAME1: this.stack = asList(1, stack); break; } }