/** * Constructs an uninitialized {@link MethodNode}. * * @param api * the ASM API version implemented by this visitor. Must be one * of {@link Opcodes#ASM4}, {@link Opcodes#ASM5} or {@link Opcodes#ASM6}. */ public MethodNode(final int api) { super(api); this.instructions = new InsnList(); }
this.exceptions.addAll(Arrays.asList(exceptions)); this.instructions = new InsnList();
/** * Creates the new instructions, inlining each instantiation of each * subroutine until the code is fully elaborated. */ private void emitCode() { LinkedList<Instantiation> worklist = new LinkedList<Instantiation>(); // Create an instantiation of the "root" subroutine, which is just the // main routine worklist.add(new Instantiation(null, mainSubroutine)); // Emit instantiations of each subroutine we encounter, including the // main subroutine InsnList newInstructions = new InsnList(); List<TryCatchBlockNode> newTryCatchBlocks = new ArrayList<TryCatchBlockNode>(); List<LocalVariableNode> newLocalVariables = new ArrayList<LocalVariableNode>(); while (!worklist.isEmpty()) { Instantiation inst = worklist.removeFirst(); emitSubroutine(inst, worklist, newInstructions, newTryCatchBlocks, newLocalVariables); } instructions = newInstructions; tryCatchBlocks = newTryCatchBlocks; localVariables = newLocalVariables; }
public static InsnList getBoxInsnList(String primitiveTypeDescriptor, AbstractInsnNode loadPrimtiveInsnNode) { InsnList tmpList = new InsnList(); tmpList.add(loadPrimtiveInsnNode); return getBoxInsnList(primitiveTypeDescriptor, tmpList); }
public static InsnList getBoxInsnList(Class<?> primitiveTypeDescriptor, AbstractInsnNode loadPrimtiveInsnNode) { InsnList tmpList = new InsnList(); tmpList.add(loadPrimtiveInsnNode); return getBoxInsnList(primitiveTypeDescriptor, tmpList); }
public static InsnList getBoxInsnList(org.babyfish.org.objectweb.asm.Type primitiveType, AbstractInsnNode loadPrimtiveInsnNode) { InsnList tmpList = new InsnList(); tmpList.add(loadPrimtiveInsnNode); return getBoxInsnList(primitiveType.getDescriptor(), tmpList); }
protected static InsnList cloneInsnList(InsnList insnList) { InsnList newInsnList = new InsnList(); for (AbstractInsnNode abstractInsnNode = insnList.getFirst(); abstractInsnNode != null; abstractInsnNode = abstractInsnNode.getNext()) { newInsnList.add(cloneInsnNode(abstractInsnNode)); } return newInsnList; }
public static InsnList getUnboxInsnList(Class<?> primitiveType, boolean checkcast) { ExceptionUtil.mustNotBeEqualToValue("primitiveType", primitiveType, void.class); InsnList insnList = new InsnList(); if (!primitiveType.isPrimitive()) { return insnList; } Class<?> clazz = ClassInfo.box(primitiveType); String internalName = org.babyfish.org.objectweb.asm.Type.getInternalName(clazz); if (checkcast) { insnList.add(new TypeInsnNode(Opcodes.CHECKCAST, internalName)); } insnList.add( new MethodInsnNode( Opcodes.INVOKEVIRTUAL, internalName, primitiveType.getName() + "Value", "()" + getDescriptor(primitiveType), false)); return insnList; }
instructions.remove(methodInsnNode.getPrevious()); instructions.remove(methodInsnNode); InsnList tmpInstructions = new InsnList(); tmpInstructions.add(new VarInsnNode(Opcodes.ALOAD, 0)); tmpInstructions.add(
public static InsnList getBoxInsnList(Class<?> primitiveType, InsnList loadPrimtiveInsnNodeList) { if (!primitiveType.isPrimitive()) { return loadPrimtiveInsnNodeList; } ExceptionUtil.mustNotBeEqualToValue("primitiveType", primitiveType, void.class); Class<?> clazz = ClassInfo.box(primitiveType); String internalName = org.babyfish.org.objectweb.asm.Type.getInternalName(clazz); InsnList insnList = new InsnList(); insnList.add(new TypeInsnNode(Opcodes.NEW, internalName)); insnList.add(new InsnNode(Opcodes.DUP)); insnList.add(loadPrimtiveInsnNodeList); insnList.add( new MethodInsnNode( Opcodes.INVOKESPECIAL, internalName, "<init>", '(' + getDescriptor(primitiveType) + ")V", false)); return insnList; }
instructions.remove(typeInsnNode); } else if (typeInsnNode.getOpcode() == Opcodes.ANEWARRAY) { InsnList tmpInstructions = new InsnList(); tmpInstructions.add(new LdcInsnNode(typeInsnNode.desc)); tmpInstructions.add(new MethodInsnNode(
abstractInsnNode = abstractInsnNode.getNext()) { if (abstractInsnNode.getOpcode() == Opcodes.ARETURN) { InsnList tmpInstructions = new InsnList(); tmpInstructions.add(new InsnNode(Opcodes.DUP)); tmpInstructions.add(new VarInsnNode(Opcodes.ALOAD, 0)); fieldInsnNode.owner.equals(ASM.getInternalName(QueryTranslatorImpl.class))) { InsnList beforeInstructions = new InsnList(); beforeInstructions.add(new InsnNode(Opcodes.DUP)); beforeInstructions.add(new VarInsnNode(Opcodes.ALOAD, 0)); instructions.insertBefore(fieldInsnNode, beforeInstructions); InsnList afterInstructions = new InsnList();
abstractInsnNode = abstractInsnNode.getNext()) { if (abstractInsnNode.getOpcode() == Opcodes.ARETURN) { InsnList tmpInstructions = new InsnList(); tmpInstructions.add(new InsnNode(Opcodes.DUP)); tmpInstructions.add(new VarInsnNode(Opcodes.ALOAD, 0));
catchLabelNode, Type.getInternalName(IllegalAccessException.class))); InsnList instructions = new InsnList();
catchLabelNode, Type.getInternalName(IllegalAccessException.class))); InsnList instructions = new InsnList();
InsnList tmpInstructions = new InsnList(); List<TryCatchBlockNode> tmpTryCatchBlocks = new ArrayList<TryCatchBlockNode>(); for (ClassEntry classEntry : ces) {
catchInvocationTargetLabelNode, Type.getInternalName(InvocationTargetException.class))); InsnList instructions = new InsnList();
null); InsnList instructions = new InsnList(); final int walkerIndex = 2; final int sqlAstIndex = walkerIndex + 1;