if (RubyInstanceConfig.PEEPHOLE_OPTZ) { if (expr) { context.loadTrue(); context.pollThreadEvents(); } } else { context.loadTrue(); context.pollThreadEvents(); if (!expr) context.consumeCurrentValue(); }
if (RubyInstanceConfig.PEEPHOLE_OPTZ) { if (expr) { context.loadNil(); context.pollThreadEvents(); } } else { context.loadNil(); context.pollThreadEvents(); if (!expr) context.consumeCurrentValue(); }
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/compiler/ASTCompiler.java File path: /jruby-1.4.0/src/org/jruby/compiler/ASTCompiler.java
Method name: void compileTrue(Node, BodyCompiler, boolean) Method name: void compileNil(Node, BodyCompiler, boolean)
Number of AST nodes: 8 Number of AST nodes: 8
1
if (RubyInstanceConfig.PEEPHOLE_OPTZ) {
1
if (RubyInstanceConfig.PEEPHOLE_OPTZ) {
2
            if (expr) {
2
            if (expr) {
3
                context.loadTrue();
3
                context.loadNil();
4
                context.pollThreadEvents();
4
                context.pollThreadEvents();
5
            }
5
            }
6
        } else {
6
        } else {
7
            context.loadTrue();
7
            context.loadNil();
8
            context.pollThreadEvents();
8
            context.pollThreadEvents();
9
            if (!expr) context.consumeCurrentValue();
9
            if (!expr) context.consumeCurrentValue();
10
        }
10
        }
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.4
Clones locationClones are declared in the same class
Number of node comparisons29
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)2.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (RubyInstanceConfig.PEEPHOLE_OPTZ)
    1
    if (RubyInstanceConfig.PEEPHOLE_OPTZ)
    2
    if (expr)
    2
    if (expr)
    3
    context.loadTrue();
    3
    context.loadTrue();
    3
    context.loadNil();
    Differences
    Expression1Expression2Difference
    loadTrueloadNilMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression context.loadTrue() is a void method call, and thus it cannot be parameterized
    Expression context.loadNil() is a void method call, and thus it cannot be parameterized
    3
    context.loadNil();
    4
    context.pollThreadEvents();
    4
    context.pollThreadEvents();
    else
    else
    5
    context.loadTrue();
    5
    context.loadTrue();
    5
    context.loadNil();
    Differences
    Expression1Expression2Difference
    loadTrueloadNilMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression context.loadTrue() is a void method call, and thus it cannot be parameterized
    Expression context.loadNil() is a void method call, and thus it cannot be parameterized
    5
    context.loadNil();
    6
    context.pollThreadEvents();
    6
    context.pollThreadEvents();
    7
    if (!expr)
    7
    if (!expr)
    8
    context.consumeCurrentValue();
    8
    context.consumeCurrentValue();
    Precondition Violations (4)
    Row Violation
    1Expression context.loadTrue() is a void method call, and thus it cannot be parameterized
    2Expression context.loadNil() is a void method call, and thus it cannot be parameterized
    3Expression context.loadTrue() is a void method call, and thus it cannot be parameterized
    4Expression context.loadNil() is a void method call, and thus it cannot be parameterized