VariableTableEntry[] table = vTableSize + 1 > vTableThreshold ? rehash() : vTable;
int index;
int hash = internedName.hashCode();
VariableTableEntry e;
for (e = table[index = hash & (table.length - 1)]; e != null; e = e.next) {
if (internedName == e.name) {
e.value = value;
return value;
}
}
e = new VariableTableEntry(hash, internedName, value, table[index]);
table[index] = e;
vTableSize++;
vTable = table; // write-volatile
return value;
VariableTableEntry[] table = vTableSize + 1 > vTableThreshold ? rehash() : vTable;
int index;
int hash = name.hashCode();
VariableTableEntry e;
for (e = table[index = hash & (table.length - 1)]; e != null; e = e.next) {
if (hash == e.hash && name.equals(e.name)) {
e.value = value;
return value;
}
}
e = new VariableTableEntry(hash, name.intern(), value, table[index]);
table[index] = e;
vTableSize++;
vTable = table; // write-volatile
return value;
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/runtime/builtin/InstanceVariableTable.java
|
|
File path: /jruby-1.4.0/src/org/jruby/runtime/builtin/InstanceVariableTable.java
|
Method name: Object fastHashStore(String, Object)
|
|
Method name: Object hashStore(String, Object)
|
Number of AST nodes: 13
|
|
Number of AST nodes: 13
|
|
1 | VariableTableEntry[] table = vTableSize + 1 > vTableThreshold ? rehash() : vTable;↵ | | 1 | VariableTableEntry[] table = vTableSize + 1 > vTableThreshold ? rehash() : vTable;↵
|
|
2 | int index;↵ | | 2 | int index;↵
|
3 | int hash = internedName.hashCode();↵ | | 3 | int hash = name.hashCode();↵
|
4 | VariableTableEntry e;↵ | | 4 | VariableTableEntry e;↵
|
5 | for (e = table[index = hash & (table.length - 1)]; e != null; e = e.next) {↵ | | 5 | for (e = table[index = hash & (table.length - 1)]; e != null; e = e.next) {↵
|
6 | if (internedName == e.name) {↵ | | 6 | if (hash == e.hash && name.equals(e.name)) {↵
|
7 | e.value = value;↵ | | 7 | e.value = value;↵
|
8 | return value;↵ | | 8 | return value;↵
|
9 | }↵ | | 9 | }↵
|
10 | }↵ | | 10 | }↵
|
11 | e = new VariableTableEntry(hash, internedName, value, table[index]);↵ | | 11 | e = new VariableTableEntry(hash, name.intern(), value, table[index]);↵
|
12 | table[index] = e;↵ | | 12 | table[index] = e;↵
|
13 | vTableSize++;↵ | | 13 | vTableSize++;↵
|
14 | vTable = table; // write-volatile↵ | | 14 | vTable = table; // write-volatile↵
|
15 | return value; | | 15 | return value;
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 0 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.2 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 1 |