/** * Redirect the handles from oldList to newList. "This" flow list * is assumed to be relative to oldList. */ public FlowList copyAndRedirect(InstructionList oldList, InstructionList newList) { final FlowList result = new FlowList(); if (_elements == null) { return result; } final int n = _elements.size(); final Iterator oldIter = oldList.iterator(); final Iterator newIter = newList.iterator(); while (oldIter.hasNext()) { final InstructionHandle oldIh = (InstructionHandle) oldIter.next(); final InstructionHandle newIh = (InstructionHandle) newIter.next(); for (int i = 0; i < n; i++) { if (_elements.elementAt(i) == oldIh) { result.add(newIh); } } } return result; } }
public void desynthesize(ClassGenerator classGen, MethodGenerator methodGen) { final InstructionList il = methodGen.getInstructionList(); _falseList.add(il.append(new IFEQ(null))); }
public void translateDesynthesized(ClassGenerator classGen, MethodGenerator methodGen) { final InstructionList il = methodGen.getInstructionList(); if (_value) { il.append(NOP); // true list falls through } else { _falseList.add(il.append(new GOTO(null))); } } }
public void translateDesynthesized(ClassGenerator classGen, MethodGenerator methodGen) { final InstructionList il = methodGen.getInstructionList(); final Expression exp = argument(); exp.translateDesynthesized(classGen, methodGen); final BranchHandle gotoh = il.append(new GOTO(null)); _trueList = exp._falseList; // swap flow lists _falseList = exp._trueList; _falseList.add(gotoh); } }
/** * Compile the function call and treat as an expression * Update true/false-lists. */ public void translateDesynthesized(ClassGenerator classGen, MethodGenerator methodGen) { Type type = Type.Boolean; if (_chosenMethodType != null) type = _chosenMethodType.resultType(); final InstructionList il = methodGen.getInstructionList(); translate(classGen, methodGen); if ((type instanceof BooleanType) || (type instanceof IntType)) { _falseList.add(il.append(new IFEQ(null))); } }
_left.translate(classGen, methodGen); _right.translate(classGen, methodGen); _falseList.add(il.append(_op == Operators.EQ ? (BranchInstruction)new IF_ICMPNE(null) : (BranchInstruction)new IF_ICMPEQ(null))); _falseList.add(il.append(_op == Operators.EQ ? (BranchInstruction)new IFNE(null) : (BranchInstruction)new IFEQ(null))); _falseList.add(il.append(_op == Operators.EQ ? (BranchInstruction)new IF_ICMPNE(null) : (BranchInstruction)new IF_ICMPEQ(null)));
/** * Compile expression and update true/false-lists */ public void translateDesynthesized(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); _base.translate(classGen, methodGen); _token.translate(classGen, methodGen); il.append(new INVOKEVIRTUAL(cpg.addMethodref(STRING_CLASS, "indexOf", "("+STRING_SIG+")I"))); _falseList.add(il.append(new IFLT(null))); } }
public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final InstructionList il = methodGen.getInstructionList(); _left.translate(classGen, methodGen); final InstructionHandle gotot = il.append(new GOTO(null)); il.append(methodGen.loadContextNode()); _right.translate(classGen, methodGen); _left._trueList.backPatch(gotot); _left._falseList.backPatch(gotot.getNext()); _trueList.append(_right._trueList.add(gotot)); _falseList.append(_right._falseList); } }
_falseList.add(il.append(new GOTO(null)));
_falseList.add(il.append(bi)); // must be backpatched
il.append(methodGen.loadContextNode()); il.append(new INVOKEINTERFACE(idx, 2)); _falseList.add(il.append(new IF_ICMPNE(null)));
_trueList.add(ih).append(_right._trueList);
_falseList.add(il.append(new GOTO_W(null))); skip.setTarget(il.append(NOP));
_falseList.add(il.append(new IFLT(null))); il.append(loadLocal);
il.append(methodGen.storeCurrentNode()); exp.backPatchFalseList(restore); _falseList.add(il.append(new GOTO(null)));