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

The following examples show how to use com.sun.org.apache.bcel.internal.generic.IFNE. 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: RealType.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Translates a real into a non-synthesized boolean. It does not push a
 * 0 or a 1 but instead returns branchhandle list to be appended to the
 * false list. A NaN must be converted to "false".
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateToDesynthesized
 */
public FlowList translateToDesynthesized(ClassGenerator classGen,
                                         MethodGenerator methodGen,
                                         BooleanType type) {
    LocalVariableGen local;
    final FlowList flowlist = new FlowList();
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    // Store real into a local variable
    il.append(DUP2);
    local = methodGen.addLocalVariable("real_to_boolean_tmp",
                                       com.sun.org.apache.bcel.internal.generic.Type.DOUBLE,
                                       null, null);
    local.setStart(il.append(new DSTORE(local.getIndex())));

    // Compare it to 0.0
    il.append(DCONST_0);
    il.append(DCMPG);
    flowlist.add(il.append(new IFEQ(null)));

    //!!! call isNaN
    // Compare it to itself to see if NaN
    il.append(new DLOAD(local.getIndex()));
    local.setEnd(il.append(new DLOAD(local.getIndex())));
    il.append(DCMPG);
    flowlist.add(il.append(new IFNE(null)));        // NaN != NaN
    return flowlist;
}
 
Example #2
Source File: RealType.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Translates a real into a non-synthesized boolean. It does not push a
 * 0 or a 1 but instead returns branchhandle list to be appended to the
 * false list. A NaN must be converted to "false".
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateToDesynthesized
 */
public FlowList translateToDesynthesized(ClassGenerator classGen,
                                         MethodGenerator methodGen,
                                         BooleanType type) {
    LocalVariableGen local;
    final FlowList flowlist = new FlowList();
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    // Store real into a local variable
    il.append(DUP2);
    local = methodGen.addLocalVariable("real_to_boolean_tmp",
                                       com.sun.org.apache.bcel.internal.generic.Type.DOUBLE,
                                       null, null);
    local.setStart(il.append(new DSTORE(local.getIndex())));

    // Compare it to 0.0
    il.append(DCONST_0);
    il.append(DCMPG);
    flowlist.add(il.append(new IFEQ(null)));

    //!!! call isNaN
    // Compare it to itself to see if NaN
    il.append(new DLOAD(local.getIndex()));
    local.setEnd(il.append(new DLOAD(local.getIndex())));
    il.append(DCMPG);
    flowlist.add(il.append(new IFNE(null)));        // NaN != NaN
    return flowlist;
}
 
Example #3
Source File: EqualityExpr.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void translateDesynthesized(ClassGenerator classGen,
                                   MethodGenerator methodGen) {
    final Type tleft = _left.getType();
    final InstructionList il = methodGen.getInstructionList();

    if (tleft instanceof BooleanType) {
        _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)));
    }
    else if (tleft instanceof NumberType) {
        _left.translate(classGen, methodGen);
        _right.translate(classGen, methodGen);

        if (tleft instanceof RealType) {
            il.append(DCMPG);
    _falseList.add(il.append(_op == Operators.EQ ?
                                     (BranchInstruction)new IFNE(null) :
                                     (BranchInstruction)new IFEQ(null)));
        }
        else {
        _falseList.add(il.append(_op == Operators.EQ ?
                                     (BranchInstruction)new IF_ICMPNE(null) :
                                     (BranchInstruction)new IF_ICMPEQ(null)));
        }
    }
    else {
        translate(classGen, methodGen);
        desynthesize(classGen, methodGen);
    }
}
 
Example #4
Source File: RealType.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Translates a real into a non-synthesized boolean. It does not push a
 * 0 or a 1 but instead returns branchhandle list to be appended to the
 * false list. A NaN must be converted to "false".
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateToDesynthesized
 */
public FlowList translateToDesynthesized(ClassGenerator classGen,
                                         MethodGenerator methodGen,
                                         BooleanType type) {
    LocalVariableGen local;
    final FlowList flowlist = new FlowList();
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    // Store real into a local variable
    il.append(DUP2);
    local = methodGen.addLocalVariable("real_to_boolean_tmp",
                                       com.sun.org.apache.bcel.internal.generic.Type.DOUBLE,
                                       null, null);
    local.setStart(il.append(new DSTORE(local.getIndex())));

    // Compare it to 0.0
    il.append(DCONST_0);
    il.append(DCMPG);
    flowlist.add(il.append(new IFEQ(null)));

    //!!! call isNaN
    // Compare it to itself to see if NaN
    il.append(new DLOAD(local.getIndex()));
    local.setEnd(il.append(new DLOAD(local.getIndex())));
    il.append(DCMPG);
    flowlist.add(il.append(new IFNE(null)));        // NaN != NaN
    return flowlist;
}
 
Example #5
Source File: EqualityExpr.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void translateDesynthesized(ClassGenerator classGen,
                                   MethodGenerator methodGen) {
    final Type tleft = _left.getType();
    final InstructionList il = methodGen.getInstructionList();

    if (tleft instanceof BooleanType) {
        _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)));
    }
    else if (tleft instanceof NumberType) {
        _left.translate(classGen, methodGen);
        _right.translate(classGen, methodGen);

        if (tleft instanceof RealType) {
            il.append(DCMPG);
    _falseList.add(il.append(_op == Operators.EQ ?
                                     (BranchInstruction)new IFNE(null) :
                                     (BranchInstruction)new IFEQ(null)));
        }
        else {
        _falseList.add(il.append(_op == Operators.EQ ?
                                     (BranchInstruction)new IF_ICMPNE(null) :
                                     (BranchInstruction)new IF_ICMPEQ(null)));
        }
    }
    else {
        translate(classGen, methodGen);
        desynthesize(classGen, methodGen);
    }
}
 
Example #6
Source File: RealType.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Translates a real into a non-synthesized boolean. It does not push a
 * 0 or a 1 but instead returns branchhandle list to be appended to the
 * false list. A NaN must be converted to "false".
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateToDesynthesized
 */
public FlowList translateToDesynthesized(ClassGenerator classGen,
                                         MethodGenerator methodGen,
                                         BooleanType type) {
    LocalVariableGen local;
    final FlowList flowlist = new FlowList();
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    // Store real into a local variable
    il.append(DUP2);
    local = methodGen.addLocalVariable("real_to_boolean_tmp",
                                       com.sun.org.apache.bcel.internal.generic.Type.DOUBLE,
                                       null, null);
    local.setStart(il.append(new DSTORE(local.getIndex())));

    // Compare it to 0.0
    il.append(DCONST_0);
    il.append(DCMPG);
    flowlist.add(il.append(new IFEQ(null)));

    //!!! call isNaN
    // Compare it to itself to see if NaN
    il.append(new DLOAD(local.getIndex()));
    local.setEnd(il.append(new DLOAD(local.getIndex())));
    il.append(DCMPG);
    flowlist.add(il.append(new IFNE(null)));        // NaN != NaN
    return flowlist;
}
 
Example #7
Source File: EqualityExpr.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void translateDesynthesized(ClassGenerator classGen,
                                   MethodGenerator methodGen) {
    final Type tleft = _left.getType();
    final InstructionList il = methodGen.getInstructionList();

    if (tleft instanceof BooleanType) {
        _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)));
    }
    else if (tleft instanceof NumberType) {
        _left.translate(classGen, methodGen);
        _right.translate(classGen, methodGen);

        if (tleft instanceof RealType) {
            il.append(DCMPG);
    _falseList.add(il.append(_op == Operators.EQ ?
                                     (BranchInstruction)new IFNE(null) :
                                     (BranchInstruction)new IFEQ(null)));
        }
        else {
        _falseList.add(il.append(_op == Operators.EQ ?
                                     (BranchInstruction)new IF_ICMPNE(null) :
                                     (BranchInstruction)new IF_ICMPEQ(null)));
        }
    }
    else {
        translate(classGen, methodGen);
        desynthesize(classGen, methodGen);
    }
}
 
Example #8
Source File: RealType.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Translates a real into a non-synthesized boolean. It does not push a
 * 0 or a 1 but instead returns branchhandle list to be appended to the
 * false list. A NaN must be converted to "false".
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateToDesynthesized
 */
public FlowList translateToDesynthesized(ClassGenerator classGen,
                                         MethodGenerator methodGen,
                                         BooleanType type) {
    LocalVariableGen local;
    final FlowList flowlist = new FlowList();
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    // Store real into a local variable
    il.append(DUP2);
    local = methodGen.addLocalVariable("real_to_boolean_tmp",
                                       com.sun.org.apache.bcel.internal.generic.Type.DOUBLE,
                                       null, null);
    local.setStart(il.append(new DSTORE(local.getIndex())));

    // Compare it to 0.0
    il.append(DCONST_0);
    il.append(DCMPG);
    flowlist.add(il.append(new IFEQ(null)));

    //!!! call isNaN
    // Compare it to itself to see if NaN
    il.append(new DLOAD(local.getIndex()));
    local.setEnd(il.append(new DLOAD(local.getIndex())));
    il.append(DCMPG);
    flowlist.add(il.append(new IFNE(null)));        // NaN != NaN
    return flowlist;
}
 
Example #9
Source File: EqualityExpr.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void translateDesynthesized(ClassGenerator classGen,
                                   MethodGenerator methodGen) {
    final Type tleft = _left.getType();
    final InstructionList il = methodGen.getInstructionList();

    if (tleft instanceof BooleanType) {
        _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)));
    }
    else if (tleft instanceof NumberType) {
        _left.translate(classGen, methodGen);
        _right.translate(classGen, methodGen);

        if (tleft instanceof RealType) {
            il.append(DCMPG);
    _falseList.add(il.append(_op == Operators.EQ ?
                                     (BranchInstruction)new IFNE(null) :
                                     (BranchInstruction)new IFEQ(null)));
        }
        else {
        _falseList.add(il.append(_op == Operators.EQ ?
                                     (BranchInstruction)new IF_ICMPNE(null) :
                                     (BranchInstruction)new IF_ICMPEQ(null)));
        }
    }
    else {
        translate(classGen, methodGen);
        desynthesize(classGen, methodGen);
    }
}
 
Example #10
Source File: RealType.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Translates a real into a non-synthesized boolean. It does not push a
 * 0 or a 1 but instead returns branchhandle list to be appended to the
 * false list. A NaN must be converted to "false".
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateToDesynthesized
 */
public FlowList translateToDesynthesized(ClassGenerator classGen,
                                         MethodGenerator methodGen,
                                         BooleanType type) {
    LocalVariableGen local;
    final FlowList flowlist = new FlowList();
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    // Store real into a local variable
    il.append(DUP2);
    local = methodGen.addLocalVariable("real_to_boolean_tmp",
                                       com.sun.org.apache.bcel.internal.generic.Type.DOUBLE,
                                       null, null);
    local.setStart(il.append(new DSTORE(local.getIndex())));

    // Compare it to 0.0
    il.append(DCONST_0);
    il.append(DCMPG);
    flowlist.add(il.append(new IFEQ(null)));

    //!!! call isNaN
    // Compare it to itself to see if NaN
    il.append(new DLOAD(local.getIndex()));
    local.setEnd(il.append(new DLOAD(local.getIndex())));
    il.append(DCMPG);
    flowlist.add(il.append(new IFNE(null)));        // NaN != NaN
    return flowlist;
}
 
Example #11
Source File: EqualityExpr.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
public void translateDesynthesized(ClassGenerator classGen,
                                   MethodGenerator methodGen) {
    final Type tleft = _left.getType();
    final InstructionList il = methodGen.getInstructionList();

    if (tleft instanceof BooleanType) {
        _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)));
    }
    else if (tleft instanceof NumberType) {
        _left.translate(classGen, methodGen);
        _right.translate(classGen, methodGen);

        if (tleft instanceof RealType) {
            il.append(DCMPG);
    _falseList.add(il.append(_op == Operators.EQ ?
                                     (BranchInstruction)new IFNE(null) :
                                     (BranchInstruction)new IFEQ(null)));
        }
        else {
        _falseList.add(il.append(_op == Operators.EQ ?
                                     (BranchInstruction)new IF_ICMPNE(null) :
                                     (BranchInstruction)new IF_ICMPEQ(null)));
        }
    }
    else {
        translate(classGen, methodGen);
        desynthesize(classGen, methodGen);
    }
}
 
Example #12
Source File: RealType.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Translates a real into a non-synthesized boolean. It does not push a
 * 0 or a 1 but instead returns branchhandle list to be appended to the
 * false list. A NaN must be converted to "false".
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateToDesynthesized
 */
public FlowList translateToDesynthesized(ClassGenerator classGen,
                                         MethodGenerator methodGen,
                                         BooleanType type) {
    LocalVariableGen local;
    final FlowList flowlist = new FlowList();
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    // Store real into a local variable
    il.append(DUP2);
    local = methodGen.addLocalVariable("real_to_boolean_tmp",
                                       com.sun.org.apache.bcel.internal.generic.Type.DOUBLE,
                                       null, null);
    local.setStart(il.append(new DSTORE(local.getIndex())));

    // Compare it to 0.0
    il.append(DCONST_0);
    il.append(DCMPG);
    flowlist.add(il.append(new IFEQ(null)));

    //!!! call isNaN
    // Compare it to itself to see if NaN
    il.append(new DLOAD(local.getIndex()));
    local.setEnd(il.append(new DLOAD(local.getIndex())));
    il.append(DCMPG);
    flowlist.add(il.append(new IFNE(null)));        // NaN != NaN
    return flowlist;
}
 
Example #13
Source File: EqualityExpr.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void translateDesynthesized(ClassGenerator classGen,
                                   MethodGenerator methodGen) {
    final Type tleft = _left.getType();
    final InstructionList il = methodGen.getInstructionList();

    if (tleft instanceof BooleanType) {
        _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)));
    }
    else if (tleft instanceof NumberType) {
        _left.translate(classGen, methodGen);
        _right.translate(classGen, methodGen);

        if (tleft instanceof RealType) {
            il.append(DCMPG);
    _falseList.add(il.append(_op == Operators.EQ ?
                                     (BranchInstruction)new IFNE(null) :
                                     (BranchInstruction)new IFEQ(null)));
        }
        else {
        _falseList.add(il.append(_op == Operators.EQ ?
                                     (BranchInstruction)new IF_ICMPNE(null) :
                                     (BranchInstruction)new IF_ICMPEQ(null)));
        }
    }
    else {
        translate(classGen, methodGen);
        desynthesize(classGen, methodGen);
    }
}
 
Example #14
Source File: EqualityExpr.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void translateDesynthesized(ClassGenerator classGen,
                                   MethodGenerator methodGen) {
    final Type tleft = _left.getType();
    final InstructionList il = methodGen.getInstructionList();

    if (tleft instanceof BooleanType) {
        _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)));
    }
    else if (tleft instanceof NumberType) {
        _left.translate(classGen, methodGen);
        _right.translate(classGen, methodGen);

        if (tleft instanceof RealType) {
            il.append(DCMPG);
    _falseList.add(il.append(_op == Operators.EQ ?
                                     (BranchInstruction)new IFNE(null) :
                                     (BranchInstruction)new IFEQ(null)));
        }
        else {
        _falseList.add(il.append(_op == Operators.EQ ?
                                     (BranchInstruction)new IF_ICMPNE(null) :
                                     (BranchInstruction)new IF_ICMPEQ(null)));
        }
    }
    else {
        translate(classGen, methodGen);
        desynthesize(classGen, methodGen);
    }
}
 
Example #15
Source File: EqualityExpr.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
public void translateDesynthesized(ClassGenerator classGen,
                                   MethodGenerator methodGen) {
    final Type tleft = _left.getType();
    final InstructionList il = methodGen.getInstructionList();

    if (tleft instanceof BooleanType) {
        _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)));
    }
    else if (tleft instanceof NumberType) {
        _left.translate(classGen, methodGen);
        _right.translate(classGen, methodGen);

        if (tleft instanceof RealType) {
            il.append(DCMPG);
    _falseList.add(il.append(_op == Operators.EQ ?
                                     (BranchInstruction)new IFNE(null) :
                                     (BranchInstruction)new IFEQ(null)));
        }
        else {
        _falseList.add(il.append(_op == Operators.EQ ?
                                     (BranchInstruction)new IF_ICMPNE(null) :
                                     (BranchInstruction)new IF_ICMPEQ(null)));
        }
    }
    else {
        translate(classGen, methodGen);
        desynthesize(classGen, methodGen);
    }
}
 
Example #16
Source File: RealType.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Translates a real into a non-synthesized boolean. It does not push a
 * 0 or a 1 but instead returns branchhandle list to be appended to the
 * false list. A NaN must be converted to "false".
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateToDesynthesized
 */
public FlowList translateToDesynthesized(ClassGenerator classGen,
                                         MethodGenerator methodGen,
                                         BooleanType type) {
    LocalVariableGen local;
    final FlowList flowlist = new FlowList();
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    // Store real into a local variable
    il.append(DUP2);
    local = methodGen.addLocalVariable("real_to_boolean_tmp",
                                       com.sun.org.apache.bcel.internal.generic.Type.DOUBLE,
                                       null, null);
    local.setStart(il.append(new DSTORE(local.getIndex())));

    // Compare it to 0.0
    il.append(DCONST_0);
    il.append(DCMPG);
    flowlist.add(il.append(new IFEQ(null)));

    //!!! call isNaN
    // Compare it to itself to see if NaN
    il.append(new DLOAD(local.getIndex()));
    local.setEnd(il.append(new DLOAD(local.getIndex())));
    il.append(DCMPG);
    flowlist.add(il.append(new IFNE(null)));        // NaN != NaN
    return flowlist;
}
 
Example #17
Source File: EqualityExpr.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public void translateDesynthesized(ClassGenerator classGen,
                                   MethodGenerator methodGen) {
    final Type tleft = _left.getType();
    final InstructionList il = methodGen.getInstructionList();

    if (tleft instanceof BooleanType) {
        _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)));
    }
    else if (tleft instanceof NumberType) {
        _left.translate(classGen, methodGen);
        _right.translate(classGen, methodGen);

        if (tleft instanceof RealType) {
            il.append(DCMPG);
    _falseList.add(il.append(_op == Operators.EQ ?
                                     (BranchInstruction)new IFNE(null) :
                                     (BranchInstruction)new IFEQ(null)));
        }
        else {
        _falseList.add(il.append(_op == Operators.EQ ?
                                     (BranchInstruction)new IF_ICMPNE(null) :
                                     (BranchInstruction)new IF_ICMPEQ(null)));
        }
    }
    else {
        translate(classGen, methodGen);
        desynthesize(classGen, methodGen);
    }
}
 
Example #18
Source File: EqualityExpr.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void translateDesynthesized(ClassGenerator classGen,
                                   MethodGenerator methodGen) {
    final Type tleft = _left.getType();
    final InstructionList il = methodGen.getInstructionList();

    if (tleft instanceof BooleanType) {
        _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)));
    }
    else if (tleft instanceof NumberType) {
        _left.translate(classGen, methodGen);
        _right.translate(classGen, methodGen);

        if (tleft instanceof RealType) {
            il.append(DCMPG);
    _falseList.add(il.append(_op == Operators.EQ ?
                                     (BranchInstruction)new IFNE(null) :
                                     (BranchInstruction)new IFEQ(null)));
        }
        else {
        _falseList.add(il.append(_op == Operators.EQ ?
                                     (BranchInstruction)new IF_ICMPNE(null) :
                                     (BranchInstruction)new IF_ICMPEQ(null)));
        }
    }
    else {
        translate(classGen, methodGen);
        desynthesize(classGen, methodGen);
    }
}
 
Example #19
Source File: RealType.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Translates a real into a non-synthesized boolean. It does not push a
 * 0 or a 1 but instead returns branchhandle list to be appended to the
 * false list. A NaN must be converted to "false".
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateToDesynthesized
 */
public FlowList translateToDesynthesized(ClassGenerator classGen,
                                         MethodGenerator methodGen,
                                         BooleanType type) {
    LocalVariableGen local;
    final FlowList flowlist = new FlowList();
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    // Store real into a local variable
    il.append(DUP2);
    local = methodGen.addLocalVariable("real_to_boolean_tmp",
                                       com.sun.org.apache.bcel.internal.generic.Type.DOUBLE,
                                       null, null);
    local.setStart(il.append(new DSTORE(local.getIndex())));

    // Compare it to 0.0
    il.append(DCONST_0);
    il.append(DCMPG);
    flowlist.add(il.append(new IFEQ(null)));

    //!!! call isNaN
    // Compare it to itself to see if NaN
    il.append(new DLOAD(local.getIndex()));
    local.setEnd(il.append(new DLOAD(local.getIndex())));
    il.append(DCMPG);
    flowlist.add(il.append(new IFNE(null)));        // NaN != NaN
    return flowlist;
}
 
Example #20
Source File: RealType.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Translates a real into a non-synthesized boolean. It does not push a
 * 0 or a 1 but instead returns branchhandle list to be appended to the
 * false list. A NaN must be converted to "false".
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateToDesynthesized
 */
public FlowList translateToDesynthesized(ClassGenerator classGen,
                                         MethodGenerator methodGen,
                                         BooleanType type) {
    LocalVariableGen local;
    final FlowList flowlist = new FlowList();
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    // Store real into a local variable
    il.append(DUP2);
    local = methodGen.addLocalVariable("real_to_boolean_tmp",
                                       com.sun.org.apache.bcel.internal.generic.Type.DOUBLE,
                                       null, null);
    local.setStart(il.append(new DSTORE(local.getIndex())));

    // Compare it to 0.0
    il.append(DCONST_0);
    il.append(DCMPG);
    flowlist.add(il.append(new IFEQ(null)));

    //!!! call isNaN
    // Compare it to itself to see if NaN
    il.append(new DLOAD(local.getIndex()));
    local.setEnd(il.append(new DLOAD(local.getIndex())));
    il.append(DCMPG);
    flowlist.add(il.append(new IFNE(null)));        // NaN != NaN
    return flowlist;
}
 
Example #21
Source File: EqualityExpr.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void translateDesynthesized(ClassGenerator classGen,
                                   MethodGenerator methodGen) {
    final Type tleft = _left.getType();
    final InstructionList il = methodGen.getInstructionList();

    if (tleft instanceof BooleanType) {
        _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)));
    }
    else if (tleft instanceof NumberType) {
        _left.translate(classGen, methodGen);
        _right.translate(classGen, methodGen);

        if (tleft instanceof RealType) {
            il.append(DCMPG);
    _falseList.add(il.append(_op == Operators.EQ ?
                                     (BranchInstruction)new IFNE(null) :
                                     (BranchInstruction)new IFEQ(null)));
        }
        else {
        _falseList.add(il.append(_op == Operators.EQ ?
                                     (BranchInstruction)new IF_ICMPNE(null) :
                                     (BranchInstruction)new IF_ICMPEQ(null)));
        }
    }
    else {
        translate(classGen, methodGen);
        desynthesize(classGen, methodGen);
    }
}
 
Example #22
Source File: RealType.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Translates a real into a non-synthesized boolean. It does not push a
 * 0 or a 1 but instead returns branchhandle list to be appended to the
 * false list. A NaN must be converted to "false".
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateToDesynthesized
 */
public FlowList translateToDesynthesized(ClassGenerator classGen,
                                         MethodGenerator methodGen,
                                         BooleanType type) {
    LocalVariableGen local;
    final FlowList flowlist = new FlowList();
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    // Store real into a local variable
    il.append(DUP2);
    local = methodGen.addLocalVariable("real_to_boolean_tmp",
                                       com.sun.org.apache.bcel.internal.generic.Type.DOUBLE,
                                       null, null);
    local.setStart(il.append(new DSTORE(local.getIndex())));

    // Compare it to 0.0
    il.append(DCONST_0);
    il.append(DCMPG);
    flowlist.add(il.append(new IFEQ(null)));

    //!!! call isNaN
    // Compare it to itself to see if NaN
    il.append(new DLOAD(local.getIndex()));
    local.setEnd(il.append(new DLOAD(local.getIndex())));
    il.append(DCMPG);
    flowlist.add(il.append(new IFNE(null)));        // NaN != NaN
    return flowlist;
}
 
Example #23
Source File: IdKeyPattern.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * This method is called when the constructor is compiled in
 * Stylesheet.compileConstructor() and not as the syntax tree is traversed.
 */
public void translate(ClassGenerator classGen,
                      MethodGenerator methodGen) {

    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    // Returns the KeyIndex object of a given name
    final int getKeyIndex = cpg.addMethodref(TRANSLET_CLASS,
                                             "getKeyIndex",
                                             "(Ljava/lang/String;)"+
                                             KEY_INDEX_SIG);

    // Initialises a KeyIndex to return nodes with specific values
    final int lookupId = cpg.addMethodref(KEY_INDEX_CLASS,
                                          "containsID",
                                          "(ILjava/lang/Object;)I");
    final int lookupKey = cpg.addMethodref(KEY_INDEX_CLASS,
                                           "containsKey",
                                           "(ILjava/lang/Object;)I");
    final int getNodeIdent = cpg.addInterfaceMethodref(DOM_INTF,
                                                       "getNodeIdent",
                                                       "(I)"+NODE_SIG);

    // Call getKeyIndex in AbstractTranslet with the name of the key
    // to get the index for this key (which is also a node iterator).
    il.append(classGen.loadTranslet());
    il.append(new PUSH(cpg,_index));
    il.append(new INVOKEVIRTUAL(getKeyIndex));

    // Now use the value in the second argument to determine what nodes
    // the iterator should return.
    il.append(SWAP);
    il.append(new PUSH(cpg,_value));
    if (this instanceof IdPattern)
    {
        il.append(new INVOKEVIRTUAL(lookupId));
    }
    else
    {
        il.append(new INVOKEVIRTUAL(lookupKey));
    }

    _trueList.add(il.append(new IFNE(null)));
    _falseList.add(il.append(new GOTO(null)));
}
 
Example #24
Source File: IdKeyPattern.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * This method is called when the constructor is compiled in
 * Stylesheet.compileConstructor() and not as the syntax tree is traversed.
 */
public void translate(ClassGenerator classGen,
                      MethodGenerator methodGen) {

    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    // Returns the KeyIndex object of a given name
    final int getKeyIndex = cpg.addMethodref(TRANSLET_CLASS,
                                             "getKeyIndex",
                                             "(Ljava/lang/String;)"+
                                             KEY_INDEX_SIG);

    // Initialises a KeyIndex to return nodes with specific values
    final int lookupId = cpg.addMethodref(KEY_INDEX_CLASS,
                                          "containsID",
                                          "(ILjava/lang/Object;)I");
    final int lookupKey = cpg.addMethodref(KEY_INDEX_CLASS,
                                           "containsKey",
                                           "(ILjava/lang/Object;)I");
    final int getNodeIdent = cpg.addInterfaceMethodref(DOM_INTF,
                                                       "getNodeIdent",
                                                       "(I)"+NODE_SIG);

    // Call getKeyIndex in AbstractTranslet with the name of the key
    // to get the index for this key (which is also a node iterator).
    il.append(classGen.loadTranslet());
    il.append(new PUSH(cpg,_index));
    il.append(new INVOKEVIRTUAL(getKeyIndex));

    // Now use the value in the second argument to determine what nodes
    // the iterator should return.
    il.append(SWAP);
    il.append(new PUSH(cpg,_value));
    if (this instanceof IdPattern)
    {
        il.append(new INVOKEVIRTUAL(lookupId));
    }
    else
    {
        il.append(new INVOKEVIRTUAL(lookupKey));
    }

    _trueList.add(il.append(new IFNE(null)));
    _falseList.add(il.append(new GOTO(null)));
}
 
Example #25
Source File: IdKeyPattern.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
/**
 * This method is called when the constructor is compiled in
 * Stylesheet.compileConstructor() and not as the syntax tree is traversed.
 */
public void translate(ClassGenerator classGen,
                      MethodGenerator methodGen) {

    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    // Returns the KeyIndex object of a given name
    final int getKeyIndex = cpg.addMethodref(TRANSLET_CLASS,
                                             "getKeyIndex",
                                             "(Ljava/lang/String;)"+
                                             KEY_INDEX_SIG);

    // Initialises a KeyIndex to return nodes with specific values
    final int lookupId = cpg.addMethodref(KEY_INDEX_CLASS,
                                          "containsID",
                                          "(ILjava/lang/Object;)I");
    final int lookupKey = cpg.addMethodref(KEY_INDEX_CLASS,
                                           "containsKey",
                                           "(ILjava/lang/Object;)I");
    final int getNodeIdent = cpg.addInterfaceMethodref(DOM_INTF,
                                                       "getNodeIdent",
                                                       "(I)"+NODE_SIG);

    // Call getKeyIndex in AbstractTranslet with the name of the key
    // to get the index for this key (which is also a node iterator).
    il.append(classGen.loadTranslet());
    il.append(new PUSH(cpg,_index));
    il.append(new INVOKEVIRTUAL(getKeyIndex));

    // Now use the value in the second argument to determine what nodes
    // the iterator should return.
    il.append(SWAP);
    il.append(new PUSH(cpg,_value));
    if (this instanceof IdPattern)
    {
        il.append(new INVOKEVIRTUAL(lookupId));
    }
    else
    {
        il.append(new INVOKEVIRTUAL(lookupKey));
    }

    _trueList.add(il.append(new IFNE(null)));
    _falseList.add(il.append(new GOTO(null)));
}
 
Example #26
Source File: IdKeyPattern.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * This method is called when the constructor is compiled in
 * Stylesheet.compileConstructor() and not as the syntax tree is traversed.
 */
public void translate(ClassGenerator classGen,
                      MethodGenerator methodGen) {

    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    // Returns the KeyIndex object of a given name
    final int getKeyIndex = cpg.addMethodref(TRANSLET_CLASS,
                                             "getKeyIndex",
                                             "(Ljava/lang/String;)"+
                                             KEY_INDEX_SIG);

    // Initialises a KeyIndex to return nodes with specific values
    final int lookupId = cpg.addMethodref(KEY_INDEX_CLASS,
                                          "containsID",
                                          "(ILjava/lang/Object;)I");
    final int lookupKey = cpg.addMethodref(KEY_INDEX_CLASS,
                                           "containsKey",
                                           "(ILjava/lang/Object;)I");
    final int getNodeIdent = cpg.addInterfaceMethodref(DOM_INTF,
                                                       "getNodeIdent",
                                                       "(I)"+NODE_SIG);

    // Call getKeyIndex in AbstractTranslet with the name of the key
    // to get the index for this key (which is also a node iterator).
    il.append(classGen.loadTranslet());
    il.append(new PUSH(cpg,_index));
    il.append(new INVOKEVIRTUAL(getKeyIndex));

    // Now use the value in the second argument to determine what nodes
    // the iterator should return.
    il.append(SWAP);
    il.append(new PUSH(cpg,_value));
    if (this instanceof IdPattern)
    {
        il.append(new INVOKEVIRTUAL(lookupId));
    }
    else
    {
        il.append(new INVOKEVIRTUAL(lookupKey));
    }

    _trueList.add(il.append(new IFNE(null)));
    _falseList.add(il.append(new GOTO(null)));
}
 
Example #27
Source File: IdKeyPattern.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * This method is called when the constructor is compiled in
 * Stylesheet.compileConstructor() and not as the syntax tree is traversed.
 */
public void translate(ClassGenerator classGen,
                      MethodGenerator methodGen) {

    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    // Returns the KeyIndex object of a given name
    final int getKeyIndex = cpg.addMethodref(TRANSLET_CLASS,
                                             "getKeyIndex",
                                             "(Ljava/lang/String;)"+
                                             KEY_INDEX_SIG);

    // Initialises a KeyIndex to return nodes with specific values
    final int lookupId = cpg.addMethodref(KEY_INDEX_CLASS,
                                          "containsID",
                                          "(ILjava/lang/Object;)I");
    final int lookupKey = cpg.addMethodref(KEY_INDEX_CLASS,
                                           "containsKey",
                                           "(ILjava/lang/Object;)I");
    final int getNodeIdent = cpg.addInterfaceMethodref(DOM_INTF,
                                                       "getNodeIdent",
                                                       "(I)"+NODE_SIG);

    // Call getKeyIndex in AbstractTranslet with the name of the key
    // to get the index for this key (which is also a node iterator).
    il.append(classGen.loadTranslet());
    il.append(new PUSH(cpg,_index));
    il.append(new INVOKEVIRTUAL(getKeyIndex));

    // Now use the value in the second argument to determine what nodes
    // the iterator should return.
    il.append(SWAP);
    il.append(new PUSH(cpg,_value));
    if (this instanceof IdPattern)
    {
        il.append(new INVOKEVIRTUAL(lookupId));
    }
    else
    {
        il.append(new INVOKEVIRTUAL(lookupKey));
    }

    _trueList.add(il.append(new IFNE(null)));
    _falseList.add(il.append(new GOTO(null)));
}
 
Example #28
Source File: IdKeyPattern.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * This method is called when the constructor is compiled in
 * Stylesheet.compileConstructor() and not as the syntax tree is traversed.
 */
public void translate(ClassGenerator classGen,
                      MethodGenerator methodGen) {

    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    // Returns the KeyIndex object of a given name
    final int getKeyIndex = cpg.addMethodref(TRANSLET_CLASS,
                                             "getKeyIndex",
                                             "(Ljava/lang/String;)"+
                                             KEY_INDEX_SIG);

    // Initialises a KeyIndex to return nodes with specific values
    final int lookupId = cpg.addMethodref(KEY_INDEX_CLASS,
                                          "containsID",
                                          "(ILjava/lang/Object;)I");
    final int lookupKey = cpg.addMethodref(KEY_INDEX_CLASS,
                                           "containsKey",
                                           "(ILjava/lang/Object;)I");
    final int getNodeIdent = cpg.addInterfaceMethodref(DOM_INTF,
                                                       "getNodeIdent",
                                                       "(I)"+NODE_SIG);

    // Call getKeyIndex in AbstractTranslet with the name of the key
    // to get the index for this key (which is also a node iterator).
    il.append(classGen.loadTranslet());
    il.append(new PUSH(cpg,_index));
    il.append(new INVOKEVIRTUAL(getKeyIndex));

    // Now use the value in the second argument to determine what nodes
    // the iterator should return.
    il.append(SWAP);
    il.append(new PUSH(cpg,_value));
    if (this instanceof IdPattern)
    {
        il.append(new INVOKEVIRTUAL(lookupId));
    }
    else
    {
        il.append(new INVOKEVIRTUAL(lookupKey));
    }

    _trueList.add(il.append(new IFNE(null)));
    _falseList.add(il.append(new GOTO(null)));
}
 
Example #29
Source File: IdKeyPattern.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * This method is called when the constructor is compiled in
 * Stylesheet.compileConstructor() and not as the syntax tree is traversed.
 */
public void translate(ClassGenerator classGen,
                      MethodGenerator methodGen) {

    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    // Returns the KeyIndex object of a given name
    final int getKeyIndex = cpg.addMethodref(TRANSLET_CLASS,
                                             "getKeyIndex",
                                             "(Ljava/lang/String;)"+
                                             KEY_INDEX_SIG);

    // Initialises a KeyIndex to return nodes with specific values
    final int lookupId = cpg.addMethodref(KEY_INDEX_CLASS,
                                          "containsID",
                                          "(ILjava/lang/Object;)I");
    final int lookupKey = cpg.addMethodref(KEY_INDEX_CLASS,
                                           "containsKey",
                                           "(ILjava/lang/Object;)I");
    final int getNodeIdent = cpg.addInterfaceMethodref(DOM_INTF,
                                                       "getNodeIdent",
                                                       "(I)"+NODE_SIG);

    // Call getKeyIndex in AbstractTranslet with the name of the key
    // to get the index for this key (which is also a node iterator).
    il.append(classGen.loadTranslet());
    il.append(new PUSH(cpg,_index));
    il.append(new INVOKEVIRTUAL(getKeyIndex));

    // Now use the value in the second argument to determine what nodes
    // the iterator should return.
    il.append(SWAP);
    il.append(new PUSH(cpg,_value));
    if (this instanceof IdPattern)
    {
        il.append(new INVOKEVIRTUAL(lookupId));
    }
    else
    {
        il.append(new INVOKEVIRTUAL(lookupKey));
    }

    _trueList.add(il.append(new IFNE(null)));
    _falseList.add(il.append(new GOTO(null)));
}
 
Example #30
Source File: IdKeyPattern.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * This method is called when the constructor is compiled in
 * Stylesheet.compileConstructor() and not as the syntax tree is traversed.
 */
public void translate(ClassGenerator classGen,
                      MethodGenerator methodGen) {

    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    // Returns the KeyIndex object of a given name
    final int getKeyIndex = cpg.addMethodref(TRANSLET_CLASS,
                                             "getKeyIndex",
                                             "(Ljava/lang/String;)"+
                                             KEY_INDEX_SIG);

    // Initialises a KeyIndex to return nodes with specific values
    final int lookupId = cpg.addMethodref(KEY_INDEX_CLASS,
                                          "containsID",
                                          "(ILjava/lang/Object;)I");
    final int lookupKey = cpg.addMethodref(KEY_INDEX_CLASS,
                                           "containsKey",
                                           "(ILjava/lang/Object;)I");
    final int getNodeIdent = cpg.addInterfaceMethodref(DOM_INTF,
                                                       "getNodeIdent",
                                                       "(I)"+NODE_SIG);

    // Call getKeyIndex in AbstractTranslet with the name of the key
    // to get the index for this key (which is also a node iterator).
    il.append(classGen.loadTranslet());
    il.append(new PUSH(cpg,_index));
    il.append(new INVOKEVIRTUAL(getKeyIndex));

    // Now use the value in the second argument to determine what nodes
    // the iterator should return.
    il.append(SWAP);
    il.append(new PUSH(cpg,_value));
    if (this instanceof IdPattern)
    {
        il.append(new INVOKEVIRTUAL(lookupId));
    }
    else
    {
        il.append(new INVOKEVIRTUAL(lookupKey));
    }

    _trueList.add(il.append(new IFNE(null)));
    _falseList.add(il.append(new GOTO(null)));
}