receiverCallback.call(methodCompiler); method.dup(); methodCompiler.loadThreadContext(); methodCompiler.loadSelf(); methodCompiler.getScriptCompiler().getCacheCompiler().cacheCallSite(methodCompiler, attrName, CallType.FUNCTIONAL); methodCompiler.invokeUtilityMethod("preOpAsgnWithOrAnd", sig(IRubyObject.class, IRubyObject.class, ThreadContext.class, IRubyObject.class, CallSite.class)); Label done = new Label(); Label isTrue = new Label(); method.dup(); methodCompiler.invokeIRubyObject("isTrue", sig(boolean.class)); method.ifne(isTrue); method.pop(); // pop extra attr value argsCallback.call(methodCompiler); methodCompiler.loadThreadContext(); methodCompiler.loadSelf(); methodCompiler.getScriptCompiler().getCacheCompiler().cacheCallSite(methodCompiler, attrAsgnName, CallType.NORMAL); methodCompiler.invokeUtilityMethod("postOpAsgnWithOrAnd", sig(IRubyObject.class, IRubyObject.class, IRubyObject.class, ThreadContext.class, IRubyObject.class, CallSite.class)); method.go_to(done); method.label(isTrue); method.swap(); method.pop(); method.label(done);
receiverCallback.call(methodCompiler); method.dup(); methodCompiler.loadThreadContext(); methodCompiler.loadSelf(); methodCompiler.getScriptCompiler().getCacheCompiler().cacheCallSite(methodCompiler, attrName, CallType.FUNCTIONAL); methodCompiler.invokeUtilityMethod("preOpAsgnWithOrAnd", sig(IRubyObject.class, IRubyObject.class, ThreadContext.class, IRubyObject.class, CallSite.class)); Label done = new Label(); Label isFalse = new Label(); method.dup(); methodCompiler.invokeIRubyObject("isTrue", sig(boolean.class)); method.ifeq(isFalse); method.pop(); // pop extra attr value argsCallback.call(methodCompiler); methodCompiler.loadThreadContext(); methodCompiler.loadSelf(); methodCompiler.getScriptCompiler().getCacheCompiler().cacheCallSite(methodCompiler, attrAsgnName, CallType.NORMAL); methodCompiler.invokeUtilityMethod("postOpAsgnWithOrAnd", sig(IRubyObject.class, IRubyObject.class, IRubyObject.class, ThreadContext.class, IRubyObject.class, CallSite.class)); method.go_to(done); method.label(isFalse); method.swap(); method.pop(); method.label(done);
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/compiler/impl/StandardInvocationCompiler.java File path: /jruby-1.4.0/src/org/jruby/compiler/impl/StandardInvocationCompiler.java
Method name: void invokeOpAsgnWithOr(String, String, CompilerCallback, ArgumentsCallback) Method name: void invokeOpAsgnWithAnd(String, String, CompilerCallback, ArgumentsCallback)
Number of AST nodes: 22 Number of AST nodes: 22
1
receiverCallback.call(methodCompiler);
1
receiverCallback.call(methodCompiler);
2
        method.dup();
2
        method.dup();
3
        methodCompiler.loadThreadContext();
3
        methodCompiler.loadThreadContext();
4
        methodCompiler.loadSelf();
4
        methodCompiler.loadSelf();
5
        methodCompiler.getScriptCompiler().getCacheCompiler().cacheCallSite(methodCompiler, attrName, CallType.FUNCTIONAL);
5
        methodCompiler.getScriptCompiler().getCacheCompiler().cacheCallSite(methodCompiler, attrName, CallType.FUNCTIONAL);
6
        
6
        
7
        methodCompiler.invokeUtilityMethod("preOpAsgnWithOrAnd", sig(IRubyObject.class, IRubyObject.class, ThreadContext.class, IRubyObject.class, CallSite.class));
7
        methodCompiler.invokeUtilityMethod("preOpAsgnWithOrAnd", sig(IRubyObject.class, IRubyObject.class, ThreadContext.class, IRubyObject.class, CallSite.class));
8
        
8
        
9
        Label done = new Label();
9
        Label done = new Label();
10
        Label isTrue = new Label();
10
        Label isFalse = new Label();
11
        
11
        
12
        method.dup();
12
        method.dup();
13
        methodCompiler.invokeIRubyObject("isTrue", sig(boolean.class));
13
        methodCompiler.invokeIRubyObject("isTrue", sig(boolean.class));
14
        method.ifne(isTrue);
14
        method.ifeq(isFalse);
15
        
15
        
16
        method.pop(); // pop extra attr value
16
        method.pop(); // pop extra attr value
17
        argsCallback.call(methodCompiler);
17
        argsCallback.call(methodCompiler);
18
        methodCompiler.loadThreadContext();
18
        methodCompiler.loadThreadContext();
19
        methodCompiler.loadSelf();
19
        methodCompiler.loadSelf();
20
        methodCompiler.getScriptCompiler().getCacheCompiler().cacheCallSite(methodCompiler, attrAsgnName, CallType.NORMAL);
20
        methodCompiler.getScriptCompiler().getCacheCompiler().cacheCallSite(methodCompiler, attrAsgnName, CallType.NORMAL);
21
        
21
        
22
        methodCompiler.invokeUtilityMethod("postOpAsgnWithOrAnd",
22
        methodCompiler.invokeUtilityMethod("postOpAsgnWithOrAnd",
23
                sig(IRubyObject.class, IRubyObject.class, IRubyObject.class, ThreadContext.class, IRubyObject.class, CallSite.class));
23
                sig(IRubyObject.class, IRubyObject.class, IRubyObject.class, ThreadContext.class, IRubyObject.class, CallSite.class));
24
        method.go_to(done);
24
        method.go_to(done);
25
        
25
        
26
        method.label(isTrue);
26
        method.label(isFalse);
27
        method.swap();
27
        method.swap();
28
        method.pop();
28
        method.pop();
29
        
29
        
30
        method.label(done);
30
        method.label(done);
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 comparisons163
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements22
    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
    receiverCallback.call(methodCompiler);
    1
    receiverCallback.call(methodCompiler);
    2
    method.dup();
    2
    method.dup();
    3
    methodCompiler.loadThreadContext();
    3
    methodCompiler.loadThreadContext();
    4
    methodCompiler.loadSelf();
    4
    methodCompiler.loadSelf();
    5
    methodCompiler.getScriptCompiler().getCacheCompiler().cacheCallSite(methodCompiler, attrName, CallType.FUNCTIONAL);
    5
    methodCompiler.getScriptCompiler().getCacheCompiler().cacheCallSite(methodCompiler, attrName, CallType.FUNCTIONAL);
    6
    methodCompiler.invokeUtilityMethod("preOpAsgnWithOrAnd", sig(IRubyObject.class, IRubyObject.class, ThreadContext.class, IRubyObject.class, CallSite.class));
    6
    methodCompiler.invokeUtilityMethod("preOpAsgnWithOrAnd", sig(IRubyObject.class, IRubyObject.class, ThreadContext.class, IRubyObject.class, CallSite.class));
    7
    Label done = new Label();
    7
    Label done = new Label();
    8
    Label isTrue = new Label();
    8
    Label isTrue = new Label();
    8
    Label isFalse = new Label();
    Differences
    Expression1Expression2Difference
    isTrueisFalseVARIABLE_NAME_MISMATCH
    8
    Label isFalse = new Label();
    9
    method.dup();
    9
    method.dup();
    10
    methodCompiler.invokeIRubyObject("isTrue", sig(boolean.class));
    10
    methodCompiler.invokeIRubyObject("isTrue", sig(boolean.class));
    11
    method.ifne(isTrue);
    11
    method.ifne(isTrue);
    11
    method.ifeq(isFalse);
    Differences
    Expression1Expression2Difference
    ifneifeqMETHOD_INVOCATION_NAME_MISMATCH
    isTrueisFalseVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression method.ifne(isTrue) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression method.ifeq(isFalse) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression method.ifne(isTrue) is a void method call, and thus it cannot be parameterized
    Expression method.ifeq(isFalse) is a void method call, and thus it cannot be parameterized
    11
    method.ifeq(isFalse);
    12
    method.pop();
    12
    method.pop();
    13
    argsCallback.call(methodCompiler);
    13
    argsCallback.call(methodCompiler);
    14
    methodCompiler.loadThreadContext();
    14
    methodCompiler.loadThreadContext();
    15
    methodCompiler.loadSelf();
    15
    methodCompiler.loadSelf();
    16
    methodCompiler.getScriptCompiler().getCacheCompiler().cacheCallSite(methodCompiler, attrAsgnName, CallType.NORMAL);
    16
    methodCompiler.getScriptCompiler().getCacheCompiler().cacheCallSite(methodCompiler, attrAsgnName, CallType.NORMAL);
    17
    methodCompiler.invokeUtilityMethod("postOpAsgnWithOrAnd", sig(IRubyObject.class, IRubyObject.class, IRubyObject.class, ThreadContext.class, IRubyObject.class, CallSite.class));
    17
    methodCompiler.invokeUtilityMethod("postOpAsgnWithOrAnd", sig(IRubyObject.class, IRubyObject.class, IRubyObject.class, ThreadContext.class, IRubyObject.class, CallSite.class));
    18
    method.go_to(done);
    18
    method.go_to(done);
    19
    method.label(isTrue);
    19
    method.label(isTrue);
    19
    method.label(isFalse);
    Differences
    Expression1Expression2Difference
    isTrueisFalseVARIABLE_NAME_MISMATCH
    19
    method.label(isFalse);
    20
    method.swap();
    20
    method.swap();
    21
    method.pop();
    21
    method.pop();
    22
    method.label(done);
    22
    method.label(done);
    Precondition Violations (4)
    Row Violation
    1Expression method.ifne(isTrue) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression method.ifeq(isFalse) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression method.ifne(isTrue) is a void method call, and thus it cannot be parameterized
    4Expression method.ifeq(isFalse) is a void method call, and thus it cannot be parameterized