com.sun.org.apache.bcel.internal.generic.GOTO Java Examples

The following examples show how to use com.sun.org.apache.bcel.internal.generic.GOTO. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ObjectType.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Expects an integer on the stack and pushes its string value by calling
 * <code>Integer.toString(int i)</code>.
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo
 */
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
                        StringType type) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    il.append(DUP);
    final BranchHandle ifNull = il.append(new IFNULL(null));
    il.append(new INVOKEVIRTUAL(cpg.addMethodref(_javaClassName,
                                                "toString",
                                                "()" + STRING_SIG)));
    final BranchHandle gotobh = il.append(new GOTO(null));
    ifNull.setTarget(il.append(POP));
    il.append(new PUSH(cpg, ""));
    gotobh.setTarget(il.append(NOP));
}
 
Example #2
Source File: ObjectType.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Expects an integer on the stack and pushes its string value by calling
 * <code>Integer.toString(int i)</code>.
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo
 */
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
                        StringType type) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    il.append(DUP);
    final BranchHandle ifNull = il.append(new IFNULL(null));
    il.append(new INVOKEVIRTUAL(cpg.addMethodref(_javaClassName,
                                                "toString",
                                                "()" + STRING_SIG)));
    final BranchHandle gotobh = il.append(new GOTO(null));
    ifNull.setTarget(il.append(POP));
    il.append(new PUSH(cpg, ""));
    gotobh.setTarget(il.append(NOP));
}
 
Example #3
Source File: ObjectType.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * Expects an integer on the stack and pushes its string value by calling
 * <code>Integer.toString(int i)</code>.
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo
 */
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
                        StringType type) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    il.append(DUP);
    final BranchHandle ifNull = il.append(new IFNULL(null));
    il.append(new INVOKEVIRTUAL(cpg.addMethodref(_javaClassName,
                                                "toString",
                                                "()" + STRING_SIG)));
    final BranchHandle gotobh = il.append(new GOTO(null));
    ifNull.setTarget(il.append(POP));
    il.append(new PUSH(cpg, ""));
    gotobh.setTarget(il.append(NOP));
}
 
Example #4
Source File: RealType.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Expects a real on the stack and pushes a 0 if that number is 0.0 and
 * a 1 otherwise.
 *
 * @see     com.sun.org.apache.xalan.internal.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));
}
 
Example #5
Source File: NodeSetType.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * 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     com.sun.org.apache.xalan.internal.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));
}
 
Example #6
Source File: BooleanType.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Expects a boolean on the stack and pushes a string. If the value on the
 * stack is zero, then the string 'false' is pushed. Otherwise, the string
 * 'true' is pushed.
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo
 */
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
                        StringType type) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();
    final BranchHandle falsec = il.append(new IFEQ(null));
    il.append(new PUSH(cpg, "true"));
    final BranchHandle truec = il.append(new GOTO(null));
    falsec.setTarget(il.append(new PUSH(cpg, "false")));
    truec.setTarget(il.append(NOP));
}
 
Example #7
Source File: RealType.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Expects a real on the stack and pushes a 0 if that number is 0.0 and
 * a 1 otherwise.
 *
 * @see     com.sun.org.apache.xalan.internal.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));
}
 
Example #8
Source File: IntType.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Expects an integer on the stack and pushes a 0 if its value is 0 and
 * a 1 otherwise.
 *
 * @see     com.sun.org.apache.xalan.internal.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));
}
 
Example #9
Source File: StringType.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Translates a string into a synthesized boolean.
 *
 * @see     com.sun.org.apache.xalan.internal.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));
}
 
Example #10
Source File: AlternativePattern.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
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);
}
 
Example #11
Source File: NodeType.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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     com.sun.org.apache.xalan.internal.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));
}
 
Example #12
Source File: NotCall.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
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);
}
 
Example #13
Source File: BooleanType.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Expects a boolean on the stack and pushes a string. If the value on the
 * stack is zero, then the string 'false' is pushed. Otherwise, the string
 * 'true' is pushed.
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo
 */
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
                        StringType type) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();
    final BranchHandle falsec = il.append(new IFEQ(null));
    il.append(new PUSH(cpg, "true"));
    final BranchHandle truec = il.append(new GOTO(null));
    falsec.setTarget(il.append(new PUSH(cpg, "false")));
    truec.setTarget(il.append(NOP));
}
 
Example #14
Source File: NodeSetType.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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     com.sun.org.apache.xalan.internal.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));
}
 
Example #15
Source File: IntType.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Expects an integer on the stack and pushes a 0 if its value is 0 and
 * a 1 otherwise.
 *
 * @see     com.sun.org.apache.xalan.internal.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));
}
 
Example #16
Source File: BooleanType.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Expects a boolean on the stack and pushes a string. If the value on the
 * stack is zero, then the string 'false' is pushed. Otherwise, the string
 * 'true' is pushed.
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo
 */
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
                        StringType type) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();
    final BranchHandle falsec = il.append(new IFEQ(null));
    il.append(new PUSH(cpg, "true"));
    final BranchHandle truec = il.append(new GOTO(null));
    falsec.setTarget(il.append(new PUSH(cpg, "false")));
    truec.setTarget(il.append(NOP));
}
 
Example #17
Source File: IntType.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Expects an integer on the stack and pushes a 0 if its value is 0 and
 * a 1 otherwise.
 *
 * @see     com.sun.org.apache.xalan.internal.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));
}
 
Example #18
Source File: BooleanExpr.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
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)));
    }
}
 
Example #19
Source File: StringType.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Translates a string into a synthesized boolean.
 *
 * @see     com.sun.org.apache.xalan.internal.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));
}
 
Example #20
Source File: BooleanExpr.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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)));
    }
}
 
Example #21
Source File: NotCall.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example #22
Source File: AlternativePattern.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example #23
Source File: AlternativePattern.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example #24
Source File: NodeSetType.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Translates a node-set into a string. The string value of a node-set is
 * value of its first element.
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo
 */
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
                        StringType type) {
    final InstructionList il = methodGen.getInstructionList();
    getFirstNode(classGen, methodGen);
    il.append(DUP);
    final BranchHandle falsec = il.append(new IFLT(null));
    Type.Node.translateTo(classGen, methodGen, type);
    final BranchHandle truec = il.append(new GOTO(null));
    falsec.setTarget(il.append(POP));
    il.append(new PUSH(classGen.getConstantPool(), ""));
    truec.setTarget(il.append(NOP));
}
 
Example #25
Source File: NodeType.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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     com.sun.org.apache.xalan.internal.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));
}
 
Example #26
Source File: RealType.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Expects a real on the stack and pushes a 0 if that number is 0.0 and
 * a 1 otherwise.
 *
 * @see     com.sun.org.apache.xalan.internal.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));
}
 
Example #27
Source File: NodeSetType.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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     com.sun.org.apache.xalan.internal.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));
}
 
Example #28
Source File: BooleanType.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Expects a boolean on the stack and pushes a string. If the value on the
 * stack is zero, then the string 'false' is pushed. Otherwise, the string
 * 'true' is pushed.
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo
 */
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
                        StringType type) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();
    final BranchHandle falsec = il.append(new IFEQ(null));
    il.append(new PUSH(cpg, "true"));
    final BranchHandle truec = il.append(new GOTO(null));
    falsec.setTarget(il.append(new PUSH(cpg, "false")));
    truec.setTarget(il.append(NOP));
}
 
Example #29
Source File: RealType.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Expects a real on the stack and pushes a 0 if that number is 0.0 and
 * a 1 otherwise.
 *
 * @see     com.sun.org.apache.xalan.internal.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));
}
 
Example #30
Source File: IntType.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Expects an integer on the stack and pushes a 0 if its value is 0 and
 * a 1 otherwise.
 *
 * @see     com.sun.org.apache.xalan.internal.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));
}