Variable ret = m.getNewVariable(); Label l = m.getNewLabel(); Operand v1 = build(orNode.getFirstNode(), m); m.addInstr(new COPY_Instr(ret, BooleanLiteral.TRUE)); m.addInstr(new BEQ_Instr(v1, BooleanLiteral.TRUE, l)); Operand v2 = build(orNode.getSecondNode(), m); m.addInstr(new COPY_Instr(ret, v2)); m.addInstr(new LABEL_Instr(l)); return ret;
Variable ret = m.getNewVariable(); Label l = m.getNewLabel(); Operand v1 = build(andNode.getFirstNode(), m); m.addInstr(new COPY_Instr(ret, BooleanLiteral.FALSE)); m.addInstr(new BEQ_Instr(v1, BooleanLiteral.FALSE, l)); Operand v2 = build(andNode.getSecondNode(), m); m.addInstr(new COPY_Instr(ret, v2)); m.addInstr(new LABEL_Instr(l)); return ret;
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/compiler/ir/IR_Builder.java File path: /jruby-1.4.0/src/org/jruby/compiler/ir/IR_Builder.java
Method name: Operand buildOr(OrNode, IR_Scope) Method name: Operand buildAnd(AndNode, IR_Scope)
Number of AST nodes: 9 Number of AST nodes: 9
1
Variable ret = m.getNewVariable();
1
Variable ret = m.getNewVariable();
2
            Label    l   = m.getNewLabel();
2
            Label    l   = m.getNewLabel();
3
            Operand  v1  = build(orNode.getFirstNode(), m);
3
            Operand  v1  = build(andNode.getFirstNode(), m);
4
            m.addInstr(new COPY_Instr(ret, BooleanLiteral.TRUE));
4
            m.addInstr(new COPY_Instr(ret, BooleanLiteral.FALSE));
5
            m.addInstr(new BEQ_Instr(v1, BooleanLiteral.TRUE, l));
5
            m.addInstr(new BEQ_Instr(v1, BooleanLiteral.FALSE, l));
6
            Operand  v2  = build(orNode.getSecondNode(), m);
6
            Operand  v2  = build(andNode.getSecondNode(), m);
7
            m.addInstr(new COPY_Instr(ret, v2));
7
            m.addInstr(new COPY_Instr(ret, v2));
8
            m.addInstr(new LABEL_Instr(l));
8
            m.addInstr(new LABEL_Instr(l));
9
            return ret;
9
            return ret;
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones locationClones are declared in the same class
Number of node comparisons81
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements9
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    7
    Variable ret = m.getNewVariable();
    7
    Variable ret = m.getNewVariable();
    8
    Label l = m.getNewLabel();
    8
    Label l = m.getNewLabel();
    9
    Operand v1 = build(orNode.getFirstNode(), m);
    9
    Operand v1 = build(orNode.getFirstNode(), m);
    9
    Operand v1 = build(andNode.getFirstNode(), m);
    Differences
    Expression1Expression2Difference
    orNodeandNodeVARIABLE_NAME_MISMATCH
    org.jruby.ast.OrNodeorg.jruby.ast.AndNodeSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression orNode cannot be unified with expression andNode , because common superclass org.jruby.ast.Node does not declare member(s) public org.jruby.ast.Node getFirstNode()
    9
    Operand v1 = build(andNode.getFirstNode(), m);
    10
    m.addInstr(new COPY_Instr(ret, BooleanLiteral.TRUE));
    10
    m.addInstr(new COPY_Instr(ret, BooleanLiteral.TRUE));
    10
    m.addInstr(new COPY_Instr(ret, BooleanLiteral.FALSE));
    Differences
    Expression1Expression2Difference
    TRUEFALSEVARIABLE_NAME_MISMATCH
    10
    m.addInstr(new COPY_Instr(ret, BooleanLiteral.FALSE));
    11
    m.addInstr(new BEQ_Instr(v1, BooleanLiteral.TRUE, l));
    11
    m.addInstr(new BEQ_Instr(v1, BooleanLiteral.TRUE, l));
    11
    m.addInstr(new BEQ_Instr(v1, BooleanLiteral.FALSE, l));
    Differences
    Expression1Expression2Difference
    TRUEFALSEVARIABLE_NAME_MISMATCH
    11
    m.addInstr(new BEQ_Instr(v1, BooleanLiteral.FALSE, l));
    12
    Operand v2 = build(orNode.getSecondNode(), m);
    12
    Operand v2 = build(orNode.getSecondNode(), m);
    12
    Operand v2 = build(andNode.getSecondNode(), m);
    Differences
    Expression1Expression2Difference
    orNodeandNodeVARIABLE_NAME_MISMATCH
    org.jruby.ast.OrNodeorg.jruby.ast.AndNodeSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression orNode cannot be unified with expression andNode , because common superclass org.jruby.ast.Node does not declare member(s) public org.jruby.ast.Node getSecondNode()
    12
    Operand v2 = build(andNode.getSecondNode(), m);
    13
    m.addInstr(new COPY_Instr(ret, v2));
    13
    m.addInstr(new COPY_Instr(ret, v2));
    14
    m.addInstr(new LABEL_Instr(l));
    14
    m.addInstr(new LABEL_Instr(l));
    15
    return ret;
    15
    return ret;
    Precondition Violations (2)
    Row Violation
    1Expression orNode cannot be unified with expression andNode , because common superclass org.jruby.ast.Node does not declare member(s) public org.jruby.ast.Node getFirstNode()
    2Expression orNode cannot be unified with expression andNode , because common superclass org.jruby.ast.Node does not declare member(s) public org.jruby.ast.Node getSecondNode()