if (start < preCount || argsCallback != null) { int tempLocal = getVariableCompiler().grabTempLocal(); getVariableCompiler().setTempLocal(tempLocal); for (; start < preCount; start++) { getVariableCompiler().getTempLocal(tempLocal); switch (start) { case 0: invokeUtilityMethod("arrayEntryOrNilZero", sig(IRubyObject.class, RubyArray.class)); break; case 1: invokeUtilityMethod("arrayEntryOrNilOne", sig(IRubyObject.class, RubyArray.class)); break; case 2: invokeUtilityMethod("arrayEntryOrNilTwo", sig(IRubyObject.class, RubyArray.class)); break; default: method.pushInt(start); invokeUtilityMethod("arrayEntryOrNil", sig(IRubyObject.class, RubyArray.class, int.class)); break; } callback.nextValue(this, preSource, start); } if (argsCallback != null) { getVariableCompiler().getTempLocal(tempLocal); loadRuntime(); method.pushInt(start); invokeUtilityMethod("subarrayOrEmpty", sig(RubyArray.class, RubyArray.class, Ruby.class, int.class)); argsCallback.call(this); } if (postCount > 0) { throw new NotCompilableException("1.9 mode can't handle post variables in masgn yet"); } getVariableCompiler().getTempLocal(tempLocal); getVariableCompiler().releaseTempLocal(); }
if (start < count || argsCallback != null) { int tempLocal = getVariableCompiler().grabTempLocal(); getVariableCompiler().setTempLocal(tempLocal); for (; start < count; start++) { getVariableCompiler().getTempLocal(tempLocal); switch (start) { case 0: invokeUtilityMethod("arrayEntryOrNilZero", sig(IRubyObject.class, RubyArray.class)); break; case 1: invokeUtilityMethod("arrayEntryOrNilOne", sig(IRubyObject.class, RubyArray.class)); break; case 2: invokeUtilityMethod("arrayEntryOrNilTwo", sig(IRubyObject.class, RubyArray.class)); break; default: method.pushInt(start); invokeUtilityMethod("arrayEntryOrNil", sig(IRubyObject.class, RubyArray.class, int.class)); break; } callback.nextValue(this, source, start); } if (argsCallback != null) { getVariableCompiler().getTempLocal(tempLocal); loadRuntime(); method.pushInt(start); invokeUtilityMethod("subarrayOrEmpty", sig(RubyArray.class, RubyArray.class, Ruby.class, int.class)); argsCallback.call(this); } getVariableCompiler().getTempLocal(tempLocal); getVariableCompiler().releaseTempLocal(); }
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 forEachInValueArray(int, int, Object, int, Object, ArrayCallback, CompilerCallback) Method name: void forEachInValueArray(int, int, Object, ArrayCallback, CompilerCallback)
Number of AST nodes: 30 Number of AST nodes: 28
1
if (start < preCount || argsCallback != null) {
1
if (start < count || argsCallback != null) {
2
            int tempLocal = getVariableCompiler().grabTempLocal();
2
            int tempLocal = getVariableCompiler().grabTempLocal();
3
            getVariableCompiler().setTempLocal(tempLocal);
3
            getVariableCompiler().setTempLocal(tempLocal);
4
            
4
            for (; start < preCount; start++) {
5
            for (; start < count; start++) {
5
                getVariableCompiler().getTempLocal(tempLocal);
6
                getVariableCompiler().getTempLocal(tempLocal);
6
                switch (start) {
7
                switch (start) {
7
                case 0:
8
                case 0:
8
                    invokeUtilityMethod("arrayEntryOrNilZero", sig(IRubyObject.class, RubyArray.class));
9
                    invokeUtilityMethod("arrayEntryOrNilZero", sig(IRubyObject.class, RubyArray.class));
9
                    break;
10
                    break;
10
                case 1:
11
                case 1:
11
                    invokeUtilityMethod("arrayEntryOrNilOne", sig(IRubyObject.class, RubyArray.class));
12
                    invokeUtilityMethod("arrayEntryOrNilOne", sig(IRubyObject.class, RubyArray.class));
12
                    break;
13
                    break;
13
                case 2:
14
                case 2:
14
                    invokeUtilityMethod("arrayEntryOrNilTwo", sig(IRubyObject.class, RubyArray.class));
15
                    invokeUtilityMethod("arrayEntryOrNilTwo", sig(IRubyObject.class, RubyArray.class));
15
                    break;
16
                    break;
16
                default:
17
                default:
17
                    method.pushInt(start);
18
                    method.pushInt(start);
18
                    invokeUtilityMethod("arrayEntryOrNil", sig(IRubyObject.class, RubyArray.class, int.class));
19
                    invokeUtilityMethod("arrayEntryOrNil", sig(IRubyObject.class, RubyArray.class, int.class));
19
                    break;
20
                    break;
20
                }
21
                }
21
                callback.nextValue(this, preSource, start);
22
                callback.nextValue(this, source, start);
22
            }
23
            }
23
            if (argsCallback != null) {
24
            if (argsCallback != null) {
24
                getVariableCompiler().getTempLocal(tempLocal);
25
                getVariableCompiler().getTempLocal(tempLocal);
25
                loadRuntime();
26
                loadRuntime();
26
                method.pushInt(start);
27
                method.pushInt(start);
27
                invokeUtilityMethod("subarrayOrEmpty", sig(RubyArray.class, RubyArray.class, Ruby.class, int.class));
28
                invokeUtilityMethod("subarrayOrEmpty", sig(RubyArray.class, RubyArray.class, Ruby.class, int.class));
28
                argsCallback.call(this);
29
                argsCallback.call(this);
29
            }
30
            }
30
            if (postCount > 0) {
31
                throw new NotCompilableException("1.9 mode can't handle post variables in masgn yet");
32
            }
33
            getVariableCompiler().getTempLocal(tempLocal);
31
            getVariableCompiler().getTempLocal(tempLocal);
34
            getVariableCompiler().releaseTempLocal();
32
            getVariableCompiler().releaseTempLocal();
35
        }
33
        }
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)1.8
Clones locationClones are declared in the same class
Number of node comparisons178
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements28
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)29.5
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    if (start < preCount || argsCallback != null)
    1
    if (start < preCount || argsCallback != null)
    1
    if (start < count || argsCallback != null)
    Differences
    Expression1Expression2Difference
    preCountcountVARIABLE_NAME_MISMATCH
    1
    if (start < count || argsCallback != null)
    2
    int tempLocal = getVariableCompiler().grabTempLocal();
    2
    int tempLocal = getVariableCompiler().grabTempLocal();
    3
    getVariableCompiler().setTempLocal(tempLocal);
    3
    getVariableCompiler().setTempLocal(tempLocal);
    4
    for (; start < preCount; start++)
    4
    for (; start < preCount; start++)
    4
    for (; start < count; start++)
    Differences
    Expression1Expression2Difference
    preCountcountVARIABLE_NAME_MISMATCH
    4
    for (; start < count; start++)
    5
    getVariableCompiler().getTempLocal(tempLocal);
    5
    getVariableCompiler().getTempLocal(tempLocal);
    6
    switch (start)
    6
    switch (start)
    7
    case 0:
    7
    case 0:
    8
    invokeUtilityMethod("arrayEntryOrNilZero", sig(IRubyObject.class, RubyArray.class));
    8
    invokeUtilityMethod("arrayEntryOrNilZero", sig(IRubyObject.class, RubyArray.class));
    9
    break;
    9
    break;
    10
    case 1:
    10
    case 1:
    11
    invokeUtilityMethod("arrayEntryOrNilOne", sig(IRubyObject.class, RubyArray.class));
    11
    invokeUtilityMethod("arrayEntryOrNilOne", sig(IRubyObject.class, RubyArray.class));
    12
    break;
    12
    break;
    13
    case 2:
    13
    case 2:
    14
    invokeUtilityMethod("arrayEntryOrNilTwo", sig(IRubyObject.class, RubyArray.class));
    14
    invokeUtilityMethod("arrayEntryOrNilTwo", sig(IRubyObject.class, RubyArray.class));
    15
    break;
    15
    break;
    16
    default:
    16
    default:
    17
    method.pushInt(start);
    17
    method.pushInt(start);
    18
    invokeUtilityMethod("arrayEntryOrNil", sig(IRubyObject.class, RubyArray.class, int.class));
    18
    invokeUtilityMethod("arrayEntryOrNil", sig(IRubyObject.class, RubyArray.class, int.class));
    19
    break;
    19
    break;
    20
    callback.nextValue(this, preSource, start);
    20
    callback.nextValue(this, preSource, start);
    20
    callback.nextValue(this, source, start);
    Differences
    Expression1Expression2Difference
    preSourcesourceVARIABLE_NAME_MISMATCH
    20
    callback.nextValue(this, source, start);
    21
    if (argsCallback != null)
    21
    if (argsCallback != null)
    22
    getVariableCompiler().getTempLocal(tempLocal);
    22
    getVariableCompiler().getTempLocal(tempLocal);
    23
    loadRuntime();
    23
    loadRuntime();
    24
    method.pushInt(start);
    24
    method.pushInt(start);
    25
    invokeUtilityMethod("subarrayOrEmpty", sig(RubyArray.class, RubyArray.class, Ruby.class, int.class));
    25
    invokeUtilityMethod("subarrayOrEmpty", sig(RubyArray.class, RubyArray.class, Ruby.class, int.class));
    26
    argsCallback.call(this);
    26
    argsCallback.call(this);
    27
    if (postCount > 0)
                                              
    28
    throw new NotCompilableException("1.9 mode can't handle post variables in masgn yet");
    28
    throw new NotCompilableException("1.9 mode can't handle post variables in masgn yet");
    Preondition Violations
    Unmatched throw new NotCompilableException("1.9 mode can't handle post variables in masgn yet");
                                                                                                                                                                                        
    29
    getVariableCompiler().getTempLocal(tempLocal);
    27
    getVariableCompiler().getTempLocal(tempLocal);
    30
    getVariableCompiler().releaseTempLocal();
    28
    getVariableCompiler().releaseTempLocal();
    Precondition Violations (1)
    Row Violation
    1Unmatched throw new NotCompilableException("1.9 mode can't handle post variables in masgn yet");