Refine search
mv.visitVarInsn(ALOAD, lastVar); if (lastVar < fiberVar) { if (callWeavers.size() > 0) { mv.visitInsn(DUP); // for storing into fiberVar mv.visitVarInsn(ASTORE, getFiberVar()); LabelNode errLabel = new LabelNode(); labels[i + 1] = new LabelNode(); errLabel.accept(mv); mv.visitVarInsn(ALOAD, getFiberVar()); mv.visitMethodInsn(INVOKEVIRTUAL, FIBER_CLASS, "wrongPC", "()V", false); for (int i = 0; i <= last; i++) { CallWeaver cw = callWeavers.get(i); labels[i+1].accept(mv); cw.genRewind(mv); startLabel.accept(mv);
bb.startLabel.accept(mv); LabelNode resumeLabel = new LabelNode(); VMType.loadVar(mv, VMType.TOBJECT, getFiberVar()); mv.visitMethodInsn(INVOKEVIRTUAL, FIBER_CLASS, "upEx", "()I", false); labels[i] = new LabelNode(); keys[i] = callWeavers.indexOf(cwList.get(i)) + 1; mv.visitJumpInsn(GOTO, resumeLabel.getLabel()); labels[i].accept(mv); cw.genRestoreEx(mv, labels[i]); i++; resumeLabel.accept(mv); bb.getInstruction(bb.startPos).accept(mv);
IrMethod convert0(String owner, MethodNode methodNode) throws AnalyzerException { this.methodNode = methodNode; target = populate(owner, methodNode); if (methodNode.instructions.size() == 0) { return target; BitSet[] exBranch = new BitSet[insnList.size()]; parentCount = new int[insnList.size()]; for (TryCatchBlockNode tcb : methodNode.tryCatchBlocks) { target.traps.add(new Trap(getLabel(tcb.start), getLabel(tcb.end), new LabelStmt[]{getLabel(tcb.handler)}, new String[]{tcb.type == null ? null : Type.getObjectType(tcb.type).getDescriptor()})); int handlerIdx = insnList.indexOf(tcb.handler); handlers.set(handlerIdx); for (AbstractInsnNode p = tcb.start.getNext(); p != tcb.end; p = p.getNext()) { BitSet x = exBranch[insnList.indexOf(p)];
mv.visitMethodInsn(INVOKEVIRTUAL, FIBER_CLASS, "up", "()I", false); LabelNode restoreLabel = new LabelNode(); LabelNode saveLabel = new LabelNode(); LabelNode unwindLabel = new LabelNode(); LabelNode[] labels = new LabelNode[] { resumeLabel, restoreLabel, saveLabel, unwindLabel }; genUnwind(mv, unwindLabel); genRestore(mv, restoreLabel); resumeLabel.accept(mv);
saveLabel.accept(mv); mv.visitInsn(TypeDesc.isDoubleWord(retType) ? POP2 : POP); mv.visitTypeInsn(NEW, stateClassName); mv.visitInsn(DUP); // mv.visitMethodInsn(INVOKESPECIAL, stateClassName, "<init>", "()V", false);
mv.visitInsn(VMType.constInsn[vmt]); storeVar(mv, vmt, i); Value v = f.getStack(spos); if (v.isConstant()) { mv.visitInsn(VMType.constInsn[VMType.toVmType(v.getTypeDesc())]); } else { ValInfo vi = valInfoList.find(v); mv.visitInsn(VMType.constInsn[vi.vmt]); mv.visitJumpInsn(GOTO, callLabel.getLabel());
private MethodNode createTranlocalLoadMethod(MethodNode methodNode, boolean readonly) { CloneMap cloneMap = new CloneMap(); LabelNode startLabelNode = new LabelNode(); LabelNode endLabelNode = new LabelNode(); result.instructions = new InsnList(); result.instructions.add(startLabelNode); result.instructions.add(new VarInsnNode(ALOAD, 0)); for (Type argType : getArgumentTypes(methodNode.desc)) { VarInsnNode loadInsn = new VarInsnNode(argType.getOpcode(ILOAD), loadIndex); result.instructions.add(loadInsn); loadIndex += argType.getSize(); int returnOpCode = Type.getReturnType(methodNode.desc).getOpcode(IRETURN); result.instructions.add(new InsnNode(returnOpCode));
public MethodNode methodNode() { MethodNode node = new MethodNode(ACC_STATIC, "<clinit>", "()V", null, null); InsnList il = node.instructions; LabelNode begin = new LabelNode(); LabelNode end = new LabelNode(); il.add(begin); if (!context.hasUpvalues()) { il.add(new TypeInsnNode(NEW, context.thisClassType().getInternalName())); il.add(new InsnNode(DUP)); il.add(new MethodInsnNode( INVOKESPECIAL, context.thisClassType().getInternalName(), "<init>", ctorMethod.methodType().getDescriptor(), false)); il.add(new FieldInsnNode( PUTSTATIC, context.thisClassType().getInternalName(), context.instanceFieldName(), context.thisClassType().getDescriptor())); } if (!runMethod.constFields().isEmpty()) { for (RunMethod.ConstFieldInstance cfi : runMethod.constFields()) { il.add(cfi.instantiateInsns()); } } il.add(new InsnNode(RETURN)); il.add(end); return node; }
code.add(new InsnNode(SWAP)); writePushDup(); } else { ValueIfElseToken valueIfElseToken = (ValueIfElseToken) operator; LabelNode end = new LabelNode(); LabelNode elseL = new LabelNode(); code.add(new JumpInsnNode(Opcodes.IFEQ, elseL)); stackPop(); stackPop(); code.add(new JumpInsnNode(Opcodes.GOTO, end)); code.add(elseL); writePopBoolean(); code.add(new JumpInsnNode(Opcodes.IFEQ, elseL)); stackPop(); writeExpression(valueIfElseToken.getValue(), true, false);
destructor.name = "finalize"; destructor.access = ACC_PUBLIC; destructor.desc = Type.getMethodDescriptor(Type.getType(void.class)); methodCompiler.writeHeader(); LabelNode end = new LabelNode(); LabelNode l0 = writeLabel(destructor, statement.getMeta().getStartLine()); methodCompiler.addLocalVariable("~this", l0); destructor.instructions.add(new JumpInsnNode(IFEQ, end)); expressionCompiler.writePopAll(1); destructor.instructions.add(end); destructor.instructions.add(new InsnNode(Opcodes.RETURN)); methodCompiler.writeFooter(); node.methods.add(destructor);
newDesc = newDesc.replace("(", "([L" + owner + ";"); Type[] argumentTypes = Type.getArgumentTypes(newDesc); AbstractInsnNode insn = method.instructions.getFirst(); while (insn != loadThis) { fixed.add(insn); int newArgument = mv.newLocal(Type.getType("[Ljava/lang/Object;")); insn = insn.getNext(); LabelNode labelBefore = new LabelNode(); labelBefore.accept(mv); Type[] returnTypes = Type.getArgumentTypes(delegation.desc); newArgument = mv.newLocal(Type.getType("[Ljava/lang/Object;")); LabelNode labelAfter = new LabelNode(); labelAfter.accept(body); Set<LabelNode> bodyLabels = new HashSet<LabelNode>();
DebugInfo debugInfo = findDebugInfo(methodNode); LabelNode startLabelNode = new LabelNode(); LabelNode endLabelNode = new LabelNode(); InsnList initTranlocal = new InsnList(); initTranlocal.add(new VarInsnNode(ALOAD, transactionVar)); initTranlocal.add(new VarInsnNode(ALOAD, 0)); getDescriptor(AlphaTransactionalObject.class), getDescriptor(AlphaTranlocal.class)); initTranlocal.add(new MethodInsnNode( INVOKEINTERFACE, getInternalName(AlphaTransaction.class), "openForConstruction", openForConstructionDesc)); initTranlocal.add(new InsnNode(POP)); result.instructions.insertBefore(result.instructions.get(indexOfFirst), initTranlocal);
return defaultVisitor; } else { ArrayList<Type> args = new ArrayList<Type>(Arrays.asList(Type.getArgumentTypes(desc))); boolean isStatic = (access & Opcodes.ACC_STATIC) != 0; if (!isStatic) { args.add(0, Type.getType(Object.class)); if (name.equals(ByteCodeUtils.CONSTRUCTOR)) { Constructor constructor = ConstructorBuilder.build(visitedClassName, method); LabelNode start = new LabelNode(); method.instructions.insert(constructor.loadThis, start); if (constructor.lineForLoad != -1) { method.instructions.insert(constructor.loadThis, new LineNumberNode(constructor.lineForLoad, start)); } else { mv.addRedirection(new MethodRedirection( new LabelNode(mv.getStartLabel()), name + "." + desc, args, Type.getReturnType(desc)));
@SuppressWarnings( {"unchecked"}) private void generateGetFromCache() { Type[] paramTypes = Type.getArgumentTypes(method.desc); cacheFieldName = findUnusedCacheFieldName(); insert(new InsnNode(DUP)); LabelNode alreadyInitialized = new LabelNode(); insert(new JumpInsnNode(IFNONNULL, alreadyInitialized)); insert(new InsnNode(POP)); insert(new InsnNode(DUP_X1)); insert(new InsnNode(DUP)); if (paramTypes.length > 1 || paramTypes[0].getSort() == Type.ARRAY) { String arguments = Type.getInternalName(Arguments.class);
public void process(ParserClassNode classNode, RuleMethod method) throws Exception { checkArgNotNull(classNode, "classNode"); checkArgNotNull(method, "method"); checkState(!method.isSuperMethod()); // super methods have flag moved to the overriding method InsnList instructions = method.instructions; AbstractInsnNode ret = instructions.getLast(); while (ret.getOpcode() != ARETURN) { ret = ret.getPrevious(); } LabelNode isNullLabel = new LabelNode(); // stack: <rule> instructions.insertBefore(ret, new InsnNode(DUP)); // stack: <rule> :: <rule> instructions.insertBefore(ret, new JumpInsnNode(IFNULL, isNullLabel)); // stack: <rule> instructions.insertBefore(ret, new LdcInsnNode(getLabelText(method))); // stack: <rule> :: <labelText> instructions.insertBefore(ret, new MethodInsnNode(INVOKEINTERFACE, Types.RULE.getInternalName(), "label", "(Ljava/lang/String;)" + Types.RULE_DESC, true)); // stack: <rule> instructions.insertBefore(ret, isNullLabel); // stack: <rule> }
List<Mutation> mutations) { InsnList instructions = new InsnList(); instructions.add(mutation.getInfectionDistance()); instructions.add(new LdcInsnNode(mutation.getId())); MethodInsnNode touched = new MethodInsnNode(Opcodes.INVOKESTATIC, Type.getInternalName(ExecutionTracer.class), "passedMutation", Type.getMethodDescriptor(Type.VOID_TYPE, new Type[] { Type.DOUBLE_TYPE, Type.INT_TYPE }), false); instructions.add(touched); LabelNode endLabel = new LabelNode(); for (Mutation mutation : mutations) { LabelNode nextLabel = new LabelNode(); instructions.add(mutationId); FieldInsnNode activeId = new FieldInsnNode(Opcodes.GETSTATIC, Type.getInternalName(MutationObserver.class), "activeMutation", "I"); instructions.add(activeId); instructions.add(new JumpInsnNode(Opcodes.IF_ICMPNE, nextLabel)); instructions.add(mutation.getMutation()); instructions.add(new JumpInsnNode(Opcodes.GOTO, endLabel)); instructions.add(nextLabel);
ACC_PRIVATE, methodName, methodType(returnType).getDescriptor(), null, throwsExceptions()); LabelNode l_begin = new LabelNode(); LabelNode l_end = new LabelNode(); InsnList prefix = new InsnList(); InsnList suffix = new InsnList(); l_head = new LabelNode(); els.add(l_head); LabelNode l_error_state = new LabelNode(); LabelNode l_handler_begin = new LabelNode(); prefix.add(dispatchTable(els, rls, l_error_state)); suffix.add(resumptionHandler(l_handler_begin)); node.tryCatchBlocks.add(new TryCatchBlockNode(l_entry, l_error_state, l_handler_begin, Type.getInternalName(UnresolvedControlThrowable.class)));
mv.visitLabel(callLabel.getLabel()); loadVar(mv, TOBJECT, methodWeaver.getFiberVar()); mv.visitMethodInsn(INVOKEVIRTUAL, FIBER_CLASS, "down", "()" + D_FIBER, false); MethodInsnNode mi = getMethodInsn(); if (isSAM(mi)) {
LabelNode labelNode = new LabelNode(label); currentMethodNode.instructions.insertBefore(position, labelNode); currentMethodNode.instructions.insertBefore(position, new LdcInsnNode( getControlDependentBranchID(currentMethodNode, position))); currentMethodNode.instructions.insertBefore(position, new InsnNode(Opcodes.SWAP)); currentMethodNode.instructions.insertBefore(position, new LdcInsnNode( getApproximationLevel(currentMethodNode, position))); currentMethodNode.instructions.insertBefore(position, new InsnNode(Opcodes.SWAP)); Type.getInternalName(BooleanHelper.class), "getDistance", Type.getMethodDescriptor(Type.INT_TYPE, new Type[] { Type.INT_TYPE, Type.INT_TYPE, Type.INT_TYPE }), false); list.insertBefore(position, get);
restoreLabel.accept(mv); Frame f = bb.startFrame; int numBottom = getNumBottom(); Value v = f.getStack(i); int insn = v.isCategory1() ? POP : POP2; mv.visitInsn(insn); if (vi.var == -1) { loadVar(mv, TOBJECT, stateVar); mv.visitFieldInsn(GETFIELD, stateClassName, vi.fieldName, vi.fieldDesc()); checkcast(mv, v); } else {