List of usage examples for org.objectweb.asm.tree VarInsnNode getOpcode
public int getOpcode()
From source file:com.android.build.gradle.internal.incremental.ConstructorBuilder.java
License:Apache License
/** * Deconstruct a constructor into its components and adds the necessary code to link the components * later. This code is not valid java, but it can be expressed in bytecode. In essence for this constructor: * <pre>{@code/*from w w w . j ava 2 s .c o m*/ * <init>(int x) { * int a = 2; * super(int b = 3, x = 1, expr2() ? 3 : a++) * doSomething(x + a) * } * }</pre> * it creates two parts: * <pre>{@code * Object[] init$args(Clazz this, int x, Object[] locals) { // this is always null here * int a = locals[0]; * int b = 3; * Object[] args = new Object[3]; * args[0] = b; * args[1] = (x = 1) * args[2] = expr2() ? 3 : a++; * locals = new Object[3]; // The arguments + the locals * locals[0] = NULL; * locals[1] = x; * locals[2] = new Object[2]; * locals[2][0] = a; * locals[2][1] = b; * return new Object[] {locals, "myclass.<init>(I;I;)V", args}; * } * * void init$body(int x, Object[] locals) { * int a = locals[0]; * int b = locals[1]; * doSomething(x + a); * } * }</pre> * * @param owner the owning class. * @param method the constructor method. */ @NonNull public static Constructor build(@NonNull String owner, @NonNull MethodNode method) { // Basic interpreter uses BasicValue.REFERENCE_VALUE for all object types. However // we need to distinguish one in particular. The value of the local variable 0, ie. the // uninitialized this. By doing it this way we ensure that whenever there is a ALOAD_0 // a LocalValue instance will be on the stack. BasicInterpreter interpreter = new BasicInterpreter() { boolean done = false; @Override // newValue is called first to initialize the frame values of all the local variables // we intercept the first one to create our own special value. public BasicValue newValue(Type type) { if (type == null) { return BasicValue.UNINITIALIZED_VALUE; } else if (type.getSort() == Type.VOID) { return null; } else { // If this is the first value created (i.e. the first local variable) // we use a special marker. BasicValue ret = done ? super.newValue(type) : new LocalValue(type); done = true; return ret; } } }; Analyzer analyzer = new Analyzer(interpreter); AbstractInsnNode[] instructions = method.instructions.toArray(); try { Frame[] frames = analyzer.analyze(owner, method); if (frames.length != instructions.length) { // Should never happen. throw new IllegalStateException("The number of frames is not equals to the number of instructions"); } int stackAtThis = -1; boolean poppedThis = false; int firstLocal = 1; for (Type type : Type.getArgumentTypes(method.desc)) { firstLocal += type.getSize(); } LinkedHashSet<LocalVariable> variables = new LinkedHashSet<LocalVariable>(); VarInsnNode lastThis = null; int localsAtLastThis = 0; // Records the most recent line number encountered. For javac, there should always be // a line number node before the call of interest to this(...) or super(...). For robustness, // -1 is recorded as a sentinel to indicate this assumption didn't hold. Upstream consumers // should check for -1 and recover in a reasonable way (for example, don't set the line // number in generated code). int recentLine = -1; for (int i = 0; i < instructions.length; i++) { AbstractInsnNode insn = instructions[i]; Frame frame = frames[i]; if (frame.getStackSize() < stackAtThis) { poppedThis = true; } if (insn instanceof MethodInsnNode) { // TODO: Do we need to check that the stack is empty after this super call? MethodInsnNode methodhInsn = (MethodInsnNode) insn; Type[] types = Type.getArgumentTypes(methodhInsn.desc); Value value = frame.getStack(frame.getStackSize() - types.length - 1); if (value instanceof LocalValue && methodhInsn.name.equals("<init>")) { if (poppedThis) { throw new IllegalStateException("Unexpected constructor structure."); } return split(owner, method, lastThis, methodhInsn, recentLine, new ArrayList<LocalVariable>(variables), localsAtLastThis); } } else if (insn instanceof VarInsnNode) { VarInsnNode var = (VarInsnNode) insn; if (var.var == 0) { lastThis = var; localsAtLastThis = variables.size(); stackAtThis = frame.getStackSize(); poppedThis = false; } Type type = ByteCodeUtils.getTypeForStoreOpcode(var.getOpcode()); if (type != null && var.var >= firstLocal) { // Variables are equals based on their number, so they will be added // to the set only if they are new, and in the order they are seen. variables.add(new LocalVariable(type, var.var)); } } else if (insn instanceof LineNumberNode) { // Record the most recent line number encountered so that call to this(...) // or super(...) has line number information. Ultimately used to emit a line // number in the generated code. LineNumberNode lineNumberNode = (LineNumberNode) insn; recentLine = lineNumberNode.line; } } throw new IllegalStateException("Unexpected constructor structure."); } catch (AnalyzerException e) { throw new IllegalStateException(e); } }
From source file:com.android.build.gradle.internal2.incremental.ConstructorBuilder.java
License:Apache License
/** * Deconstruct a constructor into its components and adds the necessary code to link the components * later. This code is not valid java, but it can be expressed in bytecode. In essence for this constructor: * <pre>{@code// ww w. j a v a2 s . co m * <init>(int x) { * int a = 2; * super(int b = 3, x = 1, expr2() ? 3 : a++) * doSomething(x + a) * } * }</pre> * it creates two parts: * <pre>{@code * Object[] init$args(Clazz this, int x, Object[] locals) { // this is always null here * int a = locals[0]; * int b = 3; * Object[] args = new Object[3]; * args[0] = b; * args[1] = (x = 1) * args[2] = expr2() ? 3 : a++; * locals = new Object[3]; // The arguments + the locals * locals[0] = NULL; * locals[1] = x; * locals[2] = new Object[2]; * locals[2][0] = a; * locals[2][1] = b; * return new Object[] {locals, "myclass.<init>(I;I;)V", args}; * } * * void init$body(int x, Object[] locals) { * int a = locals[0]; * int b = locals[1]; * doSomething(x + a); * } * }</pre> * * @param owner the owning class. * @param method the constructor method. */ @NonNull public static Constructor build(@NonNull String owner, @NonNull MethodNode method) { // Basic interpreter uses BasicValue.REFERENCE_VALUE for all object types. However // we need to distinguish one in particular. The value of the local variable 0, ie. the // uninitialized this. By doing it this way we ensure that whenever there is a ALOAD_0 // a LocalValue instance will be on the stack. BasicInterpreter interpreter = new BasicInterpreter() { boolean done = false; @Override // newValue is called first to initialize the frame values of all the local variables // we intercept the first one to create our own special value. public BasicValue newValue(Type type) { if (type == null) { return BasicValue.UNINITIALIZED_VALUE; } else if (type.getSort() == Type.VOID) { return null; } else { // If this is the first value created (i.e. the first local variable) // we use a special marker. BasicValue ret = done ? super.newValue(type) : new LocalValue(type); done = true; return ret; } } }; Analyzer analyzer = new Analyzer(interpreter); AbstractInsnNode[] instructions = method.instructions.toArray(); try { Frame[] frames = analyzer.analyze(owner, method); if (frames.length != instructions.length) { // Should never happen. throw new IllegalStateException("The number of frames is not equals to the number of instructions"); } int stackAtThis = -1; boolean poppedThis = false; int firstLocal = 1; for (Type type : Type.getArgumentTypes(method.desc)) { firstLocal += type.getSize(); } LinkedHashSet<LocalVariable> variables = new LinkedHashSet<LocalVariable>(); VarInsnNode lastThis = null; int localsAtLastThis = 0; // Records the most recent line number encountered. For javac, there should always be // a line number node before the call of interest to this(...) or super(...). For robustness, // -1 is recorded as a sentinel to indicate this assumption didn't hold. Upstream consumers // should check for -1 and recover in a reasonable way (for example, don't set the line // number in generated code). int recentLine = -1; for (int i = 0; i < instructions.length; i++) { AbstractInsnNode insn = instructions[i]; Frame frame = frames[i]; if (frame.getStackSize() < stackAtThis) { poppedThis = true; } if (insn instanceof MethodInsnNode) { // TODO: Do we need to check that the stack is empty after this super call? MethodInsnNode methodhInsn = (MethodInsnNode) insn; Type[] types = Type.getArgumentTypes(methodhInsn.desc); Value value = frame.getStack(frame.getStackSize() - types.length - 1); if (value instanceof LocalValue && methodhInsn.name.equals(ByteCodeUtils.CONSTRUCTOR)) { if (poppedThis) { throw new IllegalStateException("Unexpected constructor structure."); } return split(owner, method, lastThis, methodhInsn, recentLine, new ArrayList<LocalVariable>(variables), localsAtLastThis); } } else if (insn instanceof VarInsnNode) { VarInsnNode var = (VarInsnNode) insn; if (var.var == 0) { lastThis = var; localsAtLastThis = variables.size(); stackAtThis = frame.getStackSize(); poppedThis = false; } Type type = ByteCodeUtils.getTypeForStoreOpcode(var.getOpcode()); if (type != null && var.var >= firstLocal) { // Variables are equals based on their number, so they will be added // to the set only if they are new, and in the order they are seen. variables.add(new LocalVariable(type, var.var)); } } else if (insn instanceof LineNumberNode) { // Record the most recent line number encountered so that call to this(...) // or super(...) has line number information. Ultimately used to emit a line // number in the generated code. LineNumberNode lineNumberNode = (LineNumberNode) insn; recentLine = lineNumberNode.line; } } throw new IllegalStateException("Unexpected constructor structure."); } catch (AnalyzerException e) { throw new IllegalStateException(e); } }
From source file:com.android.tools.lint.checks.UnsafeBroadcastReceiverDetector.java
License:Apache License
@SuppressWarnings("rawtypes") public void checkClass(@NonNull final ClassContext context, @NonNull ClassNode classNode) { // If class isn't in mReceiversWithIntentFilter (set below by // XmlScanner), skip it. if (!mReceiversWithProtectedBroadcastIntentFilter.contains(classNode.name)) { return;//from ww w . j av a 2s . co m } // Search for "void onReceive(android.content.Context, android.content.Intent)" method List methodList = classNode.methods; for (Object m : methodList) { MethodNode method = (MethodNode) m; if (!"onReceive".equals(method.name) || !"(Landroid/content/Context;Landroid/content/Intent;)V".equals(method.desc)) { continue; } // Search for call to getAction but also search for references to aload_2, // which indicates that the method is making use of the received intent in // some way. // // If the onReceive method doesn't call getAction but does make use of // the received intent, it is possible that it is passing it to another // method that might be performing the getAction check, so we warn that the // finding may be a false positive. (An alternative option would be to not // report a finding at all in this case.) boolean getActionEncountered = false; boolean intentParameterEncountered = false; InsnList nodes = method.instructions; for (int i = 0, n = nodes.size(); i < n; i++) { AbstractInsnNode instruction = nodes.get(i); int type = instruction.getType(); if (type == AbstractInsnNode.VAR_INSN) { VarInsnNode node = (VarInsnNode) instruction; if (node.getOpcode() == Opcodes.ALOAD) { if (node.var == 2) { intentParameterEncountered = true; } } } else if (type == AbstractInsnNode.METHOD_INSN) { MethodInsnNode node = (MethodInsnNode) instruction; if ("android/content/Intent".equals(node.owner) && "getAction".equals(node.name)) { getActionEncountered = true; break; } } } if (!getActionEncountered) { Location location = context.getLocation(method, classNode); String report; if (!intentParameterEncountered) { report = "This broadcast receiver declares an intent-filter for a protected " + "broadcast action string, which can only be sent by the system, " + "not third-party applications. However, the receiver's onReceive " + "method does not appear to call getAction to ensure that the " + "received Intent's action string matches the expected value, " + "potentially making it possible for another actor to send a " + "spoofed intent with no action string or a different action " + "string and cause undesired behavior."; } else { // An alternative implementation option is to not report a finding at all in // this case, if we are worried about false positives causing confusion or // resulting in developers ignoring other lint warnings. report = "This broadcast receiver declares an intent-filter for a protected " + "broadcast action string, which can only be sent by the system, " + "not third-party applications. However, the receiver's onReceive " + "method does not appear to call getAction to ensure that the " + "received Intent's action string matches the expected value, " + "potentially making it possible for another actor to send a " + "spoofed intent with no action string or a different action " + "string and cause undesired behavior. In this case, it is " + "possible that the onReceive method passed the received Intent " + "to another method that checked the action string. If so, this " + "finding can safely be ignored."; } context.report(ACTION_STRING, method, null, location, report); } } }
From source file:com.github.antag99.retinazer.weaver.SystemProcessor.java
License:Open Source License
private void processMethod(MethodNode methodNode) { InsnList insns = methodNode.instructions; // Filter out debugging nodes/labels int count = 0; int maxCount = insns.size(); AbstractInsnNode[] nodes = new AbstractInsnNode[maxCount]; for (AbstractInsnNode node = insns.getFirst(); node != null; node = node.getNext()) if (node.getOpcode() > 0) nodes[count++] = node;// ww w . jav a 2s . co m // Find mapper get() calls and create an own flyweight instance for each for (int i = 0; i <= count - 4; i++) { if (!(nodes[i + 0] instanceof VarInsnNode)) continue; if (!(nodes[i + 1] instanceof FieldInsnNode)) continue; if (!(nodes[i + 2] instanceof VarInsnNode)) continue; if (!(nodes[i + 3] instanceof MethodInsnNode)) continue; VarInsnNode loadThis = (VarInsnNode) nodes[i + 0]; FieldInsnNode getField = (FieldInsnNode) nodes[i + 1]; VarInsnNode loadEntity = (VarInsnNode) nodes[i + 2]; MethodInsnNode getMethod = (MethodInsnNode) nodes[i + 3]; if (loadThis.var != 0 || loadThis.getOpcode() != ALOAD) continue; if (!getField.owner.equals(metadata.internalName) || !getField.desc.equals("L" + WeaverConstants.MAPPER_NAME + ";") || !metadata.mappersByName.containsKey(getField.name)) continue; if (loadEntity.getOpcode() != ILOAD) continue; if (!getMethod.owner.equals(WeaverConstants.MAPPER_NAME) || !getMethod.desc.equals("(I)L" + WeaverConstants.COMPONENT_NAME + ";") || !getMethod.name.equals("get")) continue; SystemMapper mapper = metadata.mappersByName.get(getField.name); // Add field to hold the flyweight String fieldName = "flyweight$" + flyweightFields.size(); String fieldDesc = mapper.componentType.getDescriptor(); FieldNode fieldNode = new FieldNode(ACC_PRIVATE, fieldName, fieldDesc, null, null); fieldNode.visitAnnotation("Lcom/github/antag99/retinazer/SkipWire;", true); FlyweightField flyweightField = new FlyweightField(); flyweightField.fieldNode = fieldNode; flyweightField.mapper = mapper; flyweightFields.add(flyweightField); // Rewrite access to use the flyweight getField.owner = metadata.internalName; getField.name = fieldName; getField.desc = fieldDesc; insns.insert(getField, new InsnNode(DUP)); insns.insert(loadEntity, new FieldInsnNode(PUTFIELD, mapper.componentType.getInternalName(), WeaverConstants.INDEX_FIELD_NAME, WeaverConstants.INDEX_FIELD_DESC)); insns.remove(getMethod); } }
From source file:de.tuberlin.uebb.jbop.optimizer.methodsplitter.Block.java
License:Open Source License
/** * Adds the insn to this block./*from w ww . j a va 2s. c o m*/ * Computes parameters and types if deep is true. * * @param insn * the insn * @param deep * compute parameters and types? */ void addInsn(final AbstractInsnNode insn, final boolean deep) { insns.add(insn); if (!(insn instanceof SplitMarkNode)) { insn.accept(sizeEvaluator); } if (!deep) { return; } if (isStore(insn)) { final int index = getIndex(insn); if (writers.containsIndex(index)) { return; } final Type findType = findType(insn); if (insn instanceof InsnNode) { writers.add(new Var(-1, insns.indexOf(insn), VarType.WRITE, findType)); } else { final VarInsnNode var = (VarInsnNode) insn; writers.add(new Var(var.var, insns.indexOf(insn), VarType.WRITE, findType)); } } else if (isLoad(insn)) { final VarInsnNode var = (VarInsnNode) insn; final int index = var.var; if (index == 0) { return; } final Type findType = findType(insn); final Var e = new Var(index, insns.indexOf(insn), VarType.READ, findType); readers.add(e); if (!writers.containsIndex(index) && !parameters.containsIndex(index)) { parameters.add(e); final VarInsnNode node = new VarInsnNode(var.getOpcode(), index); pushParameters.add(node); descBuilder.append(findType.getDescriptor()); addVarMapping(var, findType); } } }
From source file:de.unisb.cs.st.javaslicer.tracer.instrumentation.TracingMethodInstrumenter.java
License:Open Source License
private void transformVarInsn(final VarInsnNode insn) { registerInstruction(new VarInstruction(this.readMethod, insn.getOpcode(), this.currentLine, insn.var), insn.getOpcode() == RET ? InstructionType.UNSAFE : InstructionType.SAFE); if (insn.var >= this.tracerLocalVarIndex) ++insn.var; }
From source file:edu.mit.streamjit.util.bytecode.MethodResolver.java
License:Open Source License
private void interpret(VarInsnNode insn, FrameState frame, BBInfo block) { int var = insn.var; switch (insn.getOpcode()) { case Opcodes.ILOAD: assert frame.locals[var].getType().isSubtypeOf(typeFactory.getType(int.class)); frame.stack.push(frame.locals[var]); break;//from ww w. j av a 2 s.c om case Opcodes.LLOAD: assert frame.locals[var].getType().isSubtypeOf(typeFactory.getType(long.class)); frame.stack.push(frame.locals[var]); break; case Opcodes.FLOAD: assert frame.locals[var].getType().isSubtypeOf(typeFactory.getType(float.class)); frame.stack.push(frame.locals[var]); break; case Opcodes.DLOAD: assert frame.locals[var].getType().isSubtypeOf(typeFactory.getType(double.class)); frame.stack.push(frame.locals[var]); break; case Opcodes.ALOAD: assert frame.locals[var].getType().isSubtypeOf(typeFactory.getType(Object.class)); frame.stack.push(frame.locals[var]); break; case Opcodes.ISTORE: assert frame.stack.peek().getType().isSubtypeOf(typeFactory.getType(int.class)); frame.locals[var] = frame.stack.pop(); break; case Opcodes.LSTORE: assert frame.stack.peek().getType().isSubtypeOf(typeFactory.getType(long.class)); frame.locals[var] = frame.stack.pop(); break; case Opcodes.FSTORE: assert frame.stack.peek().getType().isSubtypeOf(typeFactory.getType(float.class)); frame.locals[var] = frame.stack.pop(); break; case Opcodes.DSTORE: assert frame.stack.peek().getType().isSubtypeOf(typeFactory.getType(double.class)); frame.locals[var] = frame.stack.pop(); break; case Opcodes.ASTORE: assert frame.stack.peek().getType().isSubtypeOf(typeFactory.getType(Object.class)); frame.locals[var] = frame.stack.pop(); break; default: throw new UnsupportedOperationException("" + insn.getOpcode()); } }
From source file:name.martingeisse.minimal.compiler.Compiler.java
License:Open Source License
/** * Compiles a {@link MethodNode} to MCode. * // ww w . ja v a2 s . c om * @param methodNode the method node to compile * @return the compiled code */ public ImmutableList<MCodeEntry> compile(final MethodNode methodNode) { for (int i = 0; i < methodNode.instructions.size(); i++) { final AbstractInsnNode instruction = methodNode.instructions.get(i); if (instruction instanceof LineNumberNode) { // ignored } else if (instruction instanceof FrameNode) { // this could be useful in the future } else if (instruction instanceof LabelNode) { label(((LabelNode) instruction).getLabel()); } else if (instruction instanceof InsnNode) { switch (instruction.getOpcode()) { case Opcodes.ICONST_M1: iconst(-1); break; case Opcodes.ICONST_0: iconst(0); break; case Opcodes.ICONST_1: iconst(1); break; case Opcodes.ICONST_2: iconst(2); break; case Opcodes.ICONST_3: iconst(3); break; case Opcodes.ICONST_4: iconst(4); break; case Opcodes.ICONST_5: iconst(5); break; default: unsupported(instruction); break; } } else if (instruction instanceof VarInsnNode) { final VarInsnNode varInsnNode = (VarInsnNode) instruction; switch (varInsnNode.getOpcode()) { case Opcodes.ILOAD: iload(varInsnNode.var); break; case Opcodes.ISTORE: istore(varInsnNode.var); break; default: unsupported(instruction); break; } } else if (instruction instanceof IincInsnNode) { final IincInsnNode iincInsnNode = (IincInsnNode) instruction; iinc(iincInsnNode.var, iincInsnNode.incr); } else if (instruction instanceof JumpInsnNode) { final JumpInsnNode jumpInsnNode = (JumpInsnNode) instruction; switch (jumpInsnNode.getOpcode()) { case Opcodes.IFEQ: case Opcodes.IFNE: case Opcodes.IFLT: case Opcodes.IFGE: case Opcodes.IFGT: case Opcodes.IFLE: branch1(jumpInsnNode.label.getLabel(), jumpInsnNode.getOpcode()); break; case Opcodes.IF_ICMPEQ: case Opcodes.IF_ICMPNE: case Opcodes.IF_ICMPLT: case Opcodes.IF_ICMPGE: case Opcodes.IF_ICMPGT: case Opcodes.IF_ICMPLE: branch2(jumpInsnNode.label.getLabel(), jumpInsnNode.getOpcode()); break; case Opcodes.IFNULL: case Opcodes.IFNONNULL: // unsupported: one-argument reference comparison operator unsupported(instruction); break; case Opcodes.IF_ACMPEQ: case Opcodes.IF_ACMPNE: // unsupported: two-argument reference comparison operator unsupported(instruction); break; case Opcodes.GOTO: jump(jumpInsnNode.label.getLabel()); break; case Opcodes.JSR: jsr(jumpInsnNode.label.getLabel()); break; default: unsupported(instruction); break; } } else if (instruction instanceof IntInsnNode) { final IntInsnNode intInsnNode = (IntInsnNode) instruction; if (instruction.getOpcode() == Opcodes.BIPUSH || instruction.getOpcode() == Opcodes.SIPUSH) { iconst(intInsnNode.operand); } else { // NEWARRAY unsupported(instruction); } } else if (instruction instanceof MethodInsnNode) { final MethodInsnNode methodInsnNode = (MethodInsnNode) instruction; if (methodInsnNode.getOpcode() == Opcodes.INVOKESTATIC) { if (methodInsnNode.owner.replace('/', '.').equals(Native.class.getName())) { nativeCall(methodInsnNode.name, methodInsnNode.desc); } else { unsupported(instruction); } } else { unsupported(instruction); } } else { unsupported(instruction); } } return builder.build(); }
From source file:net.sourceforge.cobertura.instrument.FindTouchPointsMethodAdapter.java
License:GNU General Public License
/** * We try to detect such a last 2 instructions and extract the enum signature. */// w ww. ja v a 2 s . c om private String tryToFindSignatureOfConditionEnum() { // mv.visitMethodInsn(INVOKESTATIC, "net/sourceforge/cobertura/instrument/FindTouchPointsMethodAdapter", "$SWITCH_TABLE$net$sourceforge$cobertura$instrument$FindTouchPointsMethodAdapter$Abc", "()[I"); // mv.visitVarInsn(ALOAD, 1); // mv.visitMethodInsn(INVOKEVIRTUAL, "net/sourceforge/cobertura/instrument/FindTouchPointsMethodAdapter$Abc", "ordinal", "()I"); // mv.visitInsn(IALOAD); if (backlog == null || backlog.size() < 4) return null; int last = backlog.size() - 1; if ((backlog.get(last) instanceof InsnNode) && (backlog.get(last - 1) instanceof MethodInsnNode) && (backlog.get(last - 2) instanceof VarInsnNode)) { VarInsnNode i2 = (VarInsnNode) backlog.get(last - 2); MethodInsnNode i3 = (MethodInsnNode) backlog.get(last - 1); InsnNode i4 = (InsnNode) backlog.get(last); if ((i2.getOpcode() == Opcodes.ALOAD) && (i3.getOpcode() == Opcodes.INVOKEVIRTUAL && i3.name.equals("ordinal")) && (i4.getOpcode() == Opcodes.IALOAD)) { return i3.owner; } } return null; }
From source file:nova.core.wrapper.mc.forge.v17.asm.lib.InsnListPrinter.java
License:Open Source License
private void _visitInsn(AbstractInsnNode insn) { switch (insn.getType()) { case 0:// w ww. j a va 2s. c om visitInsn(insn.getOpcode()); break; case 1: IntInsnNode iinsn = (IntInsnNode) insn; visitIntInsn(iinsn.getOpcode(), iinsn.operand); break; case 2: VarInsnNode vinsn = (VarInsnNode) insn; visitVarInsn(vinsn.getOpcode(), vinsn.var); break; case 3: TypeInsnNode tinsn = (TypeInsnNode) insn; visitTypeInsn(tinsn.getOpcode(), tinsn.desc); break; case 4: FieldInsnNode finsn = (FieldInsnNode) insn; visitFieldInsn(finsn.getOpcode(), finsn.owner, finsn.name, finsn.desc); break; case 5: MethodInsnNode minsn = (MethodInsnNode) insn; visitMethodInsn(minsn.getOpcode(), minsn.owner, minsn.name, minsn.desc); break; case 6: InvokeDynamicInsnNode idinsn = (InvokeDynamicInsnNode) insn; visitInvokeDynamicInsn(idinsn.name, idinsn.desc, idinsn.bsm, idinsn.bsmArgs); break; case 7: JumpInsnNode jinsn = (JumpInsnNode) insn; visitJumpInsn(jinsn.getOpcode(), jinsn.label.getLabel()); break; case 8: LabelNode linsn = (LabelNode) insn; visitLabel(linsn.getLabel()); break; case 9: LdcInsnNode ldcinsn = (LdcInsnNode) insn; visitLdcInsn(ldcinsn.cst); break; case 10: IincInsnNode iiinsn = (IincInsnNode) insn; visitIincInsn(iiinsn.var, iiinsn.incr); break; case 11: TableSwitchInsnNode tsinsn = (TableSwitchInsnNode) insn; Label[] tslables = new Label[tsinsn.labels.size()]; for (int i = 0; i < tslables.length; i++) { tslables[i] = tsinsn.labels.get(i).getLabel(); } visitTableSwitchInsn(tsinsn.min, tsinsn.max, tsinsn.dflt.getLabel(), tslables); break; case 12: LookupSwitchInsnNode lsinsn = (LookupSwitchInsnNode) insn; Label[] lslables = new Label[lsinsn.labels.size()]; for (int i = 0; i < lslables.length; i++) { lslables[i] = lsinsn.labels.get(i).getLabel(); } int[] lskeys = new int[lsinsn.keys.size()]; for (int i = 0; i < lskeys.length; i++) { lskeys[i] = lsinsn.keys.get(i); } visitLookupSwitchInsn(lsinsn.dflt.getLabel(), lskeys, lslables); break; case 13: MultiANewArrayInsnNode ainsn = (MultiANewArrayInsnNode) insn; visitMultiANewArrayInsn(ainsn.desc, ainsn.dims); break; case 14: FrameNode fnode = (FrameNode) insn; switch (fnode.type) { case -1: case 0: visitFrame(fnode.type, fnode.local.size(), fnode.local.toArray(), fnode.stack.size(), fnode.stack.toArray()); break; case 1: visitFrame(fnode.type, fnode.local.size(), fnode.local.toArray(), 0, null); break; case 2: visitFrame(fnode.type, fnode.local.size(), null, 0, null); break; case 3: visitFrame(fnode.type, 0, null, 0, null); break; case 4: visitFrame(fnode.type, 0, null, 1, fnode.stack.toArray()); } break; case 15: LineNumberNode lnode = (LineNumberNode) insn; visitLineNumber(lnode.line, lnode.start.getLabel()); break; } }