if (state == 1) { // true number of bytes to be added (or removed) from this // instruction = (future number of padding bytes - current number // of padding byte) - previously over estimated variation = // = ((3 - newOffset%4) - (3 - u%4)) - u%4 // = (-newOffset%4 + u%4) - u%4 // = -(newOffset & 3) newOffset = getNewOffset(allIndexes, allSizes, 0, u); insert = -(newOffset & 3); } else if (!resize[u]) { // over estimation of the number of bytes to be added to this // instruction = 3 - current number of padding bytes = 3 - (3 - // u%4) = u%4 = u & 3 insert = u & 3; resize[u] = true; } // skips instruction u = u + 4 - (u & 3);
if (state == 1) { // like TABL_INSN newOffset = getNewOffset(allIndexes, allSizes, 0, u); insert = -(newOffset & 3); } else if (!resize[u]) { // like TABL_INSN insert = u & 3; resize[u] = true; } // skips instruction u = u + 4 - (u & 3);
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/org/objectweb/asm/CodeWriter.java File path: /jEdit-4.2/src/org/objectweb/asm/CodeWriter.java
Method name: int[] resizeInstructions(int[], int[], int) Method name: int[] resizeInstructions(int[], int[], int)
Number of AST nodes: 7 Number of AST nodes: 7
1
if (state == 1) {
1
if (state == 1) {
2
              // true number of bytes to be added (or removed) from this
2
              // 
3
              // instruction = (future number of padding bytes - current number
4
              // of padding byte) - previously over estimated variation =
5
              // = ((3 - newOffset%4) - (3 - u%4)) - u%4
6
              // = (-newOffset%4 + u%4) - u%4
7
              // = -(newOffset & 3)
8
              newOffset = getNewOffset(allIndexes, allSizes, 0, u);
9
              insert = -(newOffset & 3);
10
            } else if (!resize[u]) {
11
              // over estimation of the number of bytes to be added to this
12
              // instruction = 3 - current number of padding bytes = 3 - (3 -
13
              // u%4) = u%4 = u & 3
3
like TABL_INSN
4
              newOffset = getNewOffset(allIndexes, allSizes, 0, u);
5
              insert = -(newOffset & 3);
6
            } else if (!resize[u]) {
7
              // like TABL_INSN
14
              insert = u & 3;
8
              insert = u & 3;
15
              resize[u] = true;
9
              resize[u] = true;
16
            }
10
            }
17
            // skips instruction
11
            // skips instruction
18
            u = u + 4 - (u & 3);
12
            u = u + 4 - (u & 3);
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 in the same method
Number of node comparisons34
  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)4.2
    Clone typeType 1
    Mapped Statements
    ID Statement ID Statement
    41
    if (state == 1)
    51
    if (state == 1)
    42
    newOffset = getNewOffset(allIndexes, allSizes, 0, u);
    52
    newOffset = getNewOffset(allIndexes, allSizes, 0, u);
    43
    insert = -(newOffset & 3);
    53
    insert = -(newOffset & 3);
    44
    else if (!resize[u])
    54
    else if (!resize[u])
    45
    insert = u & 3;
    55
    insert = u & 3;
    46
    resize[u] = true;
    56
    resize[u] = true;
    47
    u = u + 4 - (u & 3);
    57
    u = u + 4 - (u & 3);
    Precondition Violations (1)
    Row Violation
    1Clone fragment #1 returns variables resize, u, insert , while Clone fragment #2 returns variables resize, u, insert