loadRuntime(); invokeRuby("getGlobalVariables", sig(GlobalVariables.class)); method.ldc(name); method.invokevirtual(p(GlobalVariables.class), "isDefined", sig(boolean.class, params(String.class))); Label falseLabel = new Label(); Label exitLabel = new Label(); method.ifeq(falseLabel); // EQ == 0 (i.e. false) trueBranch.branch(this); method.go_to(exitLabel); method.label(falseLabel); falseBranch.branch(this); method.label(exitLabel);
loadSelf(); invokeIRubyObject("getInstanceVariables", sig(InstanceVariables.class)); method.ldc(name); //method.invokeinterface(p(IRubyObject.class), "getInstanceVariable", sig(IRubyObject.class, params(String.class))); method.invokeinterface(p(InstanceVariables.class), "fastHasInstanceVariable", sig(boolean.class, params(String.class))); Label trueLabel = new Label(); Label exitLabel = new Label(); //method.ifnonnull(trueLabel); method.ifne(trueLabel); falseBranch.branch(this); method.go_to(exitLabel); method.label(trueLabel); trueBranch.branch(this); method.label(exitLabel);
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 isGlobalDefined(String, BranchCallback, BranchCallback) Method name: void isInstanceVariableDefined(String, BranchCallback, BranchCallback)
Number of AST nodes: 12 Number of AST nodes: 12
1
loadRuntime();
1
loadSelf();
2
        invokeRuby("getGlobalVariables", sig(GlobalVariables.class));
2
        invokeIRubyObject("getInstanceVariables", sig(InstanceVariables.class));
3
        method.ldc(name);
3
        method.ldc(name);
4
        method.invokevirtual(p(GlobalVariables.class), "isDefined
4
        //method.invokeinterface(p(IRubyObject.class), "getInstanceVariable", sig(IRubyObject.class, params(String.class)));
5
", sig(boolean.class, params(String.class)));
5
        method.invokeinterface(p(InstanceVariables.class), "fastHasInstanceVariable", sig(boolean.class, params(String.class)));
6
        Label falseLabel = new Label();
6
        Label trueLabel = new Label();
7
        Label exitLabel = new Label();
7
        Label exitLabel = new Label();
8
        method.ifeq(falseLabel); // EQ == 0 (i.e. false)
8
        //method.ifnonnull(trueLabel);
9
        method.ifne(trueLabel);
9
        trueBranch.branch(this);
10
        falseBranch.branch(this);
10
        method.go_to(exitLabel);
11
        method.go_to(exitLabel);
11
        method.label(falseLabel);
12
        method.label(trueLabel);
12
        falseBranch.branch(this);
13
        trueBranch.branch(this);
13
        method.label(exitLabel);
14
        method.label(exitLabel);
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 comparisons103
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements12
    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
    loadRuntime();
    1
    loadRuntime();
    1
    loadSelf();
    Differences
    Expression1Expression2Difference
    loadRuntimeloadSelfMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression loadRuntime() is a void method call, and thus it cannot be parameterized
    Expression loadSelf() is a void method call, and thus it cannot be parameterized
    1
    loadSelf();
    2
    invokeRuby("getGlobalVariables", sig(GlobalVariables.class));
    2
    invokeRuby("getGlobalVariables", sig(GlobalVariables.class));
    2
    invokeIRubyObject("getInstanceVariables", sig(InstanceVariables.class));
    Differences
    Expression1Expression2Difference
    invokeRubyinvokeIRubyObjectMETHOD_INVOCATION_NAME_MISMATCH
    "getGlobalVariables""getInstanceVariables"LITERAL_VALUE_MISMATCH
    Preondition Violations
    Expression invokeRuby("getGlobalVariables",sig(GlobalVariables.class)) is a void method call, and thus it cannot be parameterized
    Expression invokeIRubyObject("getInstanceVariables",sig(InstanceVariables.class)) is a void method call, and thus it cannot be parameterized
    2
    invokeIRubyObject("getInstanceVariables", sig(InstanceVariables.class));
    3
    method.ldc(name);
    3
    method.ldc(name);
    4
    method.invokevirtual(p(GlobalVariables.class), "isDefined", sig(boolean.class, params(String.class)));
    4
    method.invokevirtual(p(GlobalVariables.class), "isDefined", sig(boolean.class, params(String.class)));
    4
    method.invokeinterface(p(InstanceVariables.class), "fastHasInstanceVariable", sig(boolean.class, params(String.class)));
    Differences
    Expression1Expression2Difference
    invokevirtualinvokeinterfaceMETHOD_INVOCATION_NAME_MISMATCH
    "isDefined""fastHasInstanceVariable"LITERAL_VALUE_MISMATCH
    Preondition Violations
    Expression method.invokevirtual(p(GlobalVariables.class),"isDefined",sig(boolean.class,params(String.class))) is a void method call, and thus it cannot be parameterized
    Expression method.invokeinterface(p(InstanceVariables.class),"fastHasInstanceVariable",sig(boolean.class,params(String.class))) is a void method call, and thus it cannot be parameterized
    4
    method.invokeinterface(p(InstanceVariables.class), "fastHasInstanceVariable", sig(boolean.class, params(String.class)));
    5
    Label falseLabel = new Label();
    5
    Label falseLabel = new Label();
    5
    Label trueLabel = new Label();
    Differences
    Expression1Expression2Difference
    falseLabeltrueLabelVARIABLE_NAME_MISMATCH
    5
    Label trueLabel = new Label();
    6
    Label exitLabel = new Label();
    6
    Label exitLabel = new Label();
    7
    method.ifeq(falseLabel);
    7
    method.ifeq(falseLabel);
    7
    method.ifne(trueLabel);
    Differences
    Expression1Expression2Difference
    ifeqifneMETHOD_INVOCATION_NAME_MISMATCH
    falseLabeltrueLabelVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression method.ifeq(falseLabel) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression method.ifne(trueLabel) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression method.ifeq(falseLabel) is a void method call, and thus it cannot be parameterized
    Expression method.ifne(trueLabel) is a void method call, and thus it cannot be parameterized
    7
    method.ifne(trueLabel);
    8
    trueBranch.branch(this);
    11
    trueBranch.branch(this);
    9
    method.go_to(exitLabel);
    9
    method.go_to(exitLabel);
    10
    method.label(falseLabel);
    10
    method.label(falseLabel);
    10
    method.label(trueLabel);
    Differences
    Expression1Expression2Difference
    falseLabeltrueLabelVARIABLE_NAME_MISMATCH
    10
    method.label(trueLabel);
    11
    falseBranch.branch(this);
    8
    falseBranch.branch(this);
    12
    method.label(exitLabel);
    12
    method.label(exitLabel);
    Precondition Violations (10)
    Row Violation
    1Expression loadRuntime() is a void method call, and thus it cannot be parameterized
    2Expression loadSelf() is a void method call, and thus it cannot be parameterized
    3Expression invokeRuby("getGlobalVariables",sig(GlobalVariables.class)) is a void method call, and thus it cannot be parameterized
    4Expression invokeIRubyObject("getInstanceVariables",sig(InstanceVariables.class)) is a void method call, and thus it cannot be parameterized
    5Expression method.invokevirtual(p(GlobalVariables.class),"isDefined",sig(boolean.class,params(String.class))) is a void method call, and thus it cannot be parameterized
    6Expression method.invokeinterface(p(InstanceVariables.class),"fastHasInstanceVariable",sig(boolean.class,params(String.class))) is a void method call, and thus it cannot be parameterized
    7Expression method.ifeq(falseLabel) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression method.ifne(trueLabel) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression method.ifeq(falseLabel) is a void method call, and thus it cannot be parameterized
    10Expression method.ifne(trueLabel) is a void method call, and thus it cannot be parameterized