Label falseJmp = new Label(); // dup it since we need to return appropriately if it's false method.dup(); // call isTrue on the result isTrue(); method.ifne(falseJmp); // EQ == 0 (i.e. false) // pop the extra result and replace with the send part of the AND method.pop(); longBranch.branch(this); method.label(falseJmp);
Label falseJmp = new Label(); // dup it since we need to return appropriately if it's false method.dup(); // call isTrue on the result isTrue(); method.ifeq(falseJmp); // EQ == 0 (i.e. false) // pop the extra result and replace with the send part of the AND method.pop(); longBranch.branch(this); method.label(falseJmp);
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/compiler/impl/BaseBodyCompiler.java File path: /jruby-1.4.0/src/org/jruby/compiler/impl/BaseBodyCompiler.java
Method name: void performLogicalOr(BranchCallback) Method name: void performLogicalAnd(BranchCallback)
Number of AST nodes: 7 Number of AST nodes: 7
1
Label falseJmp = new Label();
1
Label falseJmp = new Label();
2
        // dup it since we need to return appropriately if it's false
2
        // dup it since we need to return appropriately if it's false
3
        method.dup();
3
        method.dup();
4
        // call isTrue on the result
4
        // call isTrue on the result
5
        isTrue();
5
        isTrue();
6
        method.ifne(falseJmp); // EQ == 0 (i.e. false)
6
        method.ifeq(falseJmp); // EQ == 0 (i.e. false)
7
        // pop the extra result and replace with the send part of the AND
7
        // pop the extra result and replace with the send part of the AND
8
        method.pop();
8
        method.pop();
9
        longBranch.branch(this);
9
        longBranch.branch(this);
10
        method.label(falseJmp);
10
        method.label(falseJmp);
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 comparisons37
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements7
    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
    1
    Label falseJmp = new Label();
    1
    Label falseJmp = new Label();
    2
    method.dup();
    2
    method.dup();
    3
    isTrue();
    3
    isTrue();
    4
    method.ifne(falseJmp);
    4
    method.ifne(falseJmp);
    4
    method.ifeq(falseJmp);
    Differences
    Expression1Expression2Difference
    ifneifeqMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression method.ifne(falseJmp) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression method.ifeq(falseJmp) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression method.ifne(falseJmp) is a void method call, and thus it cannot be parameterized
    Expression method.ifeq(falseJmp) is a void method call, and thus it cannot be parameterized
    4
    method.ifeq(falseJmp);
    5
    method.pop();
    5
    method.pop();
    6
    longBranch.branch(this);
    6
    longBranch.branch(this);
    7
    method.label(falseJmp);
    7
    method.label(falseJmp);
    Precondition Violations (4)
    Row Violation
    1Expression method.ifne(falseJmp) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression method.ifeq(falseJmp) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression method.ifne(falseJmp) is a void method call, and thus it cannot be parameterized
    4Expression method.ifeq(falseJmp) is a void method call, and thus it cannot be parameterized