private static InsnList instructions(final MethodNode method, final AbstractInsnNode n) { InsnList instructions = new InsnList(); instructions.add(n); new Insn<>(method, n).next().forEach(instructions::add); return instructions; }
private InsnList extractCallToSuperConstructor(MutableClass mutableClass, MethodNode ctor) { InsnList removedInstructions = new InsnList(); int startIndex = 0;
InsnList extraInsns = new InsnList(); MethodFlow flow = targetBB.flow; InsnList instructions = flow.instructions;
public void restoreNonInstructionNodes() { InsnList newinsns = new InsnList(); int sz = instructions.size(); for (int i = 0; i < sz; i++) { LabelNode l = getLabelAt(i); if (l != null) { newinsns.add(l); } LineNumberNode ln = lineNumberNodes.get(i); if (ln != null) { newinsns.add(ln); } AbstractInsnNode ain = instructions.get(i); newinsns.add(ain); } LabelNode l = getLabelAt(sz); if (l != null) { newinsns.add(l); } LineNumberNode ln = lineNumberNodes.get(sz); if (ln != null) { newinsns.add(ln); } super.instructions = newinsns; }
/** * 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}, {@link Opcodes#ASM6} or {@link Opcodes#ASM7}. */ public MethodNode(final int api) { super(api); this.instructions = new InsnList(); }
/** * Constructs an uninitialized {@link MethodNode}. * * @param api * the ASM API version implemented by this visitor. Must be one * of {@link Opcodes#ASM4} or {@link Opcodes#ASM5}. */ public MethodNode(final int api) { super(api); this.instructions = new InsnList(); }
/** * @return An {@link InsnList} that contains the given instruction nodes. */ public static InsnList il(AbstractInsnNode... ains) { InsnList insns = new InsnList(); for (AbstractInsnNode ain : ains) { insns.add(ain); } return insns; }
/** * @return An {@link InsnList} with the single instruction {@code ain}. */ public static InsnList il(AbstractInsnNode ain) { InsnList insns = new InsnList(); insns.add(ain); return insns; }
/** * <p> * getDefaultInfectionDistance * </p> * * @return a {@link org.objectweb.asm.tree.InsnList} object. */ public static InsnList getDefaultInfectionDistance() { InsnList defaultDistance = new InsnList(); defaultDistance.add(new LdcInsnNode(0.0)); return defaultDistance; }
public InsnList instantiateInsns() { InsnList il = new InsnList(); doInstantiate(il); il.add(new FieldInsnNode( PUTSTATIC, ownerClassType.getInternalName(), fieldName, fieldType.getDescriptor())); return il; }
private static InsnList generateSIZEOFInstructions(final FieldInsnNode fieldInsn, final MappedSubtypeInfo mappedSubtype) { if ( !"I".equals(fieldInsn.desc) ) throw new InternalError(); final InsnList list = new InsnList(); if ( fieldInsn.getOpcode() == GETSTATIC ) { list.add(getIntNode(mappedSubtype.sizeof)); return list; } if ( fieldInsn.getOpcode() == PUTSTATIC ) throwAccessErrorOnReadOnlyField(fieldInsn.owner, fieldInsn.name); throw new InternalError(); }
public static InsnList createArgumentLoaders(String methodDescriptor) { checkArgNotNull(methodDescriptor, "methodDescriptor"); InsnList instructions = new InsnList(); Type[] types = Type.getArgumentTypes(methodDescriptor); for (int i = 0; i < types.length; i++) { instructions.add(new VarInsnNode(getLoadingOpcode(types[i]), i + 1)); } return instructions; }
public static InsnList getClassRefInst(Type type, int majorVersion) { char charType = type.getDescriptor().charAt(0); if (charType == '[' || charType == 'L') return getClassConstantRef(type, majorVersion); String wrapper = getWrapper(type, charType); InsnList list = new InsnList(); list.add(new FieldInsnNode(GETSTATIC, wrapper, "TYPE", ci(Class.class))); return list; }
private static InsnList newByteString(ByteString value) { InsnList il = new InsnList(); il.add(new LdcInsnNode(value.toRawString())); il.add(new MethodInsnNode(INVOKESTATIC, Type.getInternalName(ByteString.class), "fromRaw", Type.getMethodDescriptor( Type.getType(ByteString.class), Type.getType(String.class)), false)); return il; }
private static InsnList generateRunViewConstructorInstructions(final MethodInsnNode methodInsn) { final InsnList list = new InsnList(); // stack: this list.add(new InsnNode(DUP)); // stack: this, this list.add(new MethodInsnNode(INVOKEVIRTUAL, methodInsn.owner, VIEW_CONSTRUCTOR_NAME, "()V")); // stack: this return list; }
private InsnList saveState(int state) { InsnList il = new InsnList(); il.add(ASMUtils.loadInt(state)); il.add(new VarInsnNode(ISTORE, runMethod.LV_RESUME)); return il; }
public InsnList retrieve_0() { InsnList il = new InsnList(); il.add(loadExecutionContext()); il.add(loadReturnBuffer()); il.add(ReturnBufferMethods.get(0)); return il; }
private InsnList _return() { InsnList il = new InsnList(); if (!isSub()) { il.add(new InsnNode(RETURN)); } else { il.add(new InsnNode(ACONST_NULL)); il.add(new InsnNode(ARETURN)); } return il; }
private InsnList _goto(Label label) { InsnList il = new InsnList(); if (!isSub() || resolver.isLocalLabel(label)) { il.add(new JumpInsnNode(GOTO, l(label))); } else { il.add(_nonLocalGoto(label)); } return il; }