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))); } } }
} else if (ins instanceof GOTO) { GOTO i = (GOTO) ins; System.out.println(formatName(ins) +" target => "+i.getTarget().toString()); } else { System.out.println(formatName(ins));
/** * Called in pass 2 of InstructionList.setPositions() in order to update * the branch target, that may shift due to variable length instructions. * * @param offset additional offset caused by preceding (variable length) instructions * @param max_offset the maximum offset that may be caused by these instructions * @return additional offset caused by possible change of this instruction's length */ @Override protected int updatePosition( final int offset, final int max_offset ) { final int i = getTargetOffset(); // Depending on old position value setPosition(getPosition() + offset); // Position may be shifted by preceding expansions if (Math.abs(i) >= (Short.MAX_VALUE - max_offset)) { // to large for short (estimate) super.setOpcode(org.apache.bcel.Const.GOTO_W); final short old_length = (short) super.getLength(); super.setLength(5); return super.getLength() - old_length; } return 0; }
/** * Dump instruction as byte code to stream out. * @param out Output stream */ @Override public void dump( final DataOutputStream out ) throws IOException { super.setIndex(getTargetOffset()); final short _opcode = getOpcode(); if (_opcode == org.apache.bcel.Const.GOTO) { super.dump(out); } else { // GOTO_W super.setIndex(getTargetOffset()); out.writeByte(_opcode); out.writeInt(super.getIndex()); } }
/** Called in pass 2 of InstructionList.setPositions() in order to update * the branch target, that may shift due to variable length instructions. */ protected int updatePosition(int offset, int max_offset) { int i = getTargetOffset(); // Depending on old position value position += offset; // Position may be shifted by preceding expansions if(Math.abs(i) >= (32767 - max_offset)) { // to large for short (estimate) opcode = org.apache.bcel.Constants.GOTO_W; length = 5; return 2; // 5 - 3 } return 0; }
/** * Dump instruction as byte code to stream out. * @param out Output stream */ public void dump(DataOutputStream out) throws IOException { index = getTargetOffset(); if(opcode == org.apache.bcel.Constants.GOTO) super.dump(out); else { // GOTO_W index = getTargetOffset(); out.writeByte(opcode); out.writeInt(index); } }
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); } }
return priority; if(!(middle.getInstruction() instanceof GOTO) || ((GOTO)middle.getInstruction()).getTarget() != after) { return priority;
/** * Translates a string into a synthesized boolean. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, BooleanType type) { final InstructionList il = methodGen.getInstructionList(); FlowList falsel = translateToDesynthesized(classGen, methodGen, type); il.append(ICONST_1); final BranchHandle truec = il.append(new GOTO(null)); falsel.backPatch(il.append(ICONST_0)); truec.setTarget(il.append(NOP)); }
GOTO g = (GOTO) next2.getInstruction(); int c2 = ((ICONST) next3.getInstruction()).getValue().intValue(); if (g.getTarget().equals(next4) && (c1 == 1 && c2 == 0 || c1 == 0 && c2 == 1)) { boolean nullIsTrue = i instanceof IFNULL && c2 == 1 || i instanceof IFNONNULL && c2 == 0;
/** * Expects a real on the stack and pushes a 0 if that number is 0.0 and * a 1 otherwise. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, BooleanType type) { final InstructionList il = methodGen.getInstructionList(); FlowList falsel = translateToDesynthesized(classGen, methodGen, type); il.append(ICONST_1); final BranchHandle truec = il.append(new GOTO(null)); falsel.backPatch(il.append(ICONST_0)); truec.setTarget(il.append(NOP)); }
} else if (ins instanceof GOTO) { GOTO i = (GOTO) ins; System.out.println(formatName(ins) +" target => "+i.getTarget().toString()); } else { System.out.println(formatName(ins));
/** * Translates a node into a synthesized boolean. * If the expression is "@attr", * then "true" is pushed iff "attr" is an attribute of the current node. * If the expression is ".", the result is always "true". * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, BooleanType type) { final InstructionList il = methodGen.getInstructionList(); FlowList falsel = translateToDesynthesized(classGen, methodGen, type); il.append(ICONST_1); final BranchHandle truec = il.append(new GOTO(null)); falsel.backPatch(il.append(ICONST_0)); truec.setTarget(il.append(NOP)); }
&& ((handles[i].getInstruction() instanceof GOTO && ((GOTO) handles[i].getInstruction()).getTarget().getInstruction() instanceof IXOR) || handles[i].getInstruction() instanceof IXOR)) { keyAsChars[found] = (char) ((BIPUSH) handles[i - 1].getInstruction()).getValue().intValue(); found++; } else if ((handles[i - 1].getInstruction() instanceof ICONST) && ((handles[i].getInstruction() instanceof GOTO && ((GOTO) handles[i].getInstruction()).getTarget().getInstruction() instanceof IXOR) || handles[i].getInstruction() instanceof IXOR)) { keyAsChars[found] = (char) ((ICONST) handles[i - 1].getInstruction()).getValue().intValue();
/** * Translates a node-set into a synthesized boolean. * The boolean value of a node-set is "true" if non-empty * and "false" otherwise. Notice that the * function getFirstNode() is called in translateToDesynthesized(). * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, BooleanType type) { final InstructionList il = methodGen.getInstructionList(); FlowList falsel = translateToDesynthesized(classGen, methodGen, type); il.append(ICONST_1); final BranchHandle truec = il.append(new GOTO(null)); falsel.backPatch(il.append(ICONST_0)); truec.setTarget(il.append(NOP)); }
return priority; if(!(middle.getInstruction() instanceof GOTO) || ((GOTO)middle.getInstruction()).getTarget() != after) { return priority;
/** * Expects an integer on the stack and pushes a 0 if its value is 0 and * a 1 otherwise. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, BooleanType type) { final InstructionList il = methodGen.getInstructionList(); final BranchHandle falsec = il.append(new IFEQ(null)); il.append(ICONST_1); final BranchHandle truec = il.append(new GOTO(null)); falsec.setTarget(il.append(ICONST_0)); truec.setTarget(il.append(NOP)); }
GOTO g = (GOTO) next2.getInstruction(); int c2 = ((ICONST) next3.getInstruction()).getValue().intValue(); if (g.getTarget().equals(next4) && (c1 == 1 && c2 == 0 || c1 == 0 && c2 == 1)) { boolean nullIsTrue = i instanceof IFNULL && c2 == 1 || i instanceof IFNONNULL && c2 == 0;
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); } }