File path: /jruby-1.4.0/src/org/jruby/compiler/impl/InheritedCacheCompiler.java | File path: /jruby-1.4.0/src/org/jruby/compiler/impl/InheritedCacheCompiler.java | |||
Method name: void cacheClosure(BaseBodyCompiler, String, int, StaticScope, boolean, NodeType, ASTInspector)
|
Method name: void cacheClosure19(BaseBodyCompiler, String, int, StaticScope, boolean, NodeType, ASTInspector)
|
|||
Number of AST nodes: 15 | Number of AST nodes: 15 | |||
1 | StringBuffer scopeNames = new StringBuffer();↵ | 1 | StringBuffer scopeNames = new StringBuffer();↵ | |
2 | for (int i = 0; i < scope.getVariables().length; i++) {↵ | 2 | for (int i = 0; i < scope.getVariables().length; i++) {↵ | |
3 | if (i != 0) scopeNames.append(';');↵ | 3 | if (i != 0) scopeNames.append(';');↵ | |
4 | scopeNames.append(scope.getVariables()[i]);↵ | 4 | scopeNames.append(scope.getVariables()[i]);↵ | |
5 | }↵ | 5 | }↵ | |
6 | // build descriptor string↵ | 6 | // build descriptor string↵ | |
7 | String descriptor =↵ | 7 | String descriptor =↵ | |
8 | closureMethod + ',' +↵ | 8 | closureMethod + ',' +↵ | |
9 | arity + ',' +↵ | 9 | arity + ',' +↵ | |
10 | scopeNames + ',' +↵ | 10 | scopeNames + ',' +↵ | |
11 | hasMultipleArgsHead + ',' +↵ | 11 | hasMultipleArgsHead + ',' +↵ | |
12 | BlockBody.asArgumentType(argsNodeId) + ',' +↵ | 12 | BlockBody.asArgumentType(argsNodeId) + ',' +↵ | |
13 | !(inspector.hasClosure() || inspector.hasScopeAwareMethods());↵ | 13 | !(inspector.hasClosure() || inspector.hasScopeAwareMethods());↵ | |
14 | method.loadThis();↵ | 14 | method.loadThis();↵ | |
15 | method.loadThreadContext();↵ | 15 | method.loadThreadContext();↵ | |
16 | if (inheritedBlockBodyCount < AbstractScript.NUMBERED_BLOCKBODY_COUNT) {↵ | 16 | if (inheritedBlockBodyCount < AbstractScript.NUMBERED_BLOCKBODY_COUNT) {↵ | |
17 | method.method.ldc(descriptor);↵ | 17 | method.method.ldc(descriptor);↵ | |
18 | method.method.invokevirtual(scriptCompiler.getClassname(), "getBlockBody" + inheritedBlockBodyCount, sig(BlockBody.class, ThreadContext.class, String.class));↵ | 18 | method.method.invokevirtual(scriptCompiler.getClassname(), "getBlockBody19" + inheritedBlockBodyCount, sig(BlockBody.class, ThreadContext.class, String.class));↵ | |
19 | } else {↵ | 19 | } else {↵ | |
20 | method.method.pushInt(inheritedBlockBodyCount);↵ | 20 | method.method.pushInt(inheritedBlockBodyCount);↵ | |
21 | method.method.ldc(descriptor);↵ | 21 | method.method.ldc(descriptor);↵ | |
22 | method.method.invokevirtual(scriptCompiler.getClassname(), "getBlockBody", sig(BlockBody.class, ThreadContext.class, int.class, String.class));↵ | 22 | method.method.invokevirtual(scriptCompiler.getClassname(), "getBlockBody19", sig(BlockBody.class, ThreadContext.class, int.class, String.class));↵ | |
23 | }↵ | 23 | }↵ | |
24 | inheritedBlockBodyCount++; | 24 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.5 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 56 |
Number of mapped statements | 15 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 6.0 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | StringBuffer scopeNames = new StringBuffer(); | 1 | StringBuffer scopeNames = new StringBuffer(); | |||||||||||
2 | for (int i = 0; i < scope.getVariables().length; i++) | 2 | for (int i = 0; i < scope.getVariables().length; i++) | |||||||||||
3 | if (i != 0) | 3 | if (i != 0) | |||||||||||
4 | scopeNames.append(';'); | 4 | scopeNames.append(';'); | |||||||||||
5 | scopeNames.append(scope.getVariables()[i]); | 5 | scopeNames.append(scope.getVariables()[i]); | |||||||||||
6 | String descriptor = closureMethod + ',' + arity + ',' + scopeNames + ',' + hasMultipleArgsHead + ',' + BlockBody.asArgumentType(argsNodeId) + ',' + !(inspector.hasClosure() || inspector.hasScopeAwareMethods()); | 6 | String descriptor = closureMethod + ',' + arity + ',' + scopeNames + ',' + hasMultipleArgsHead + ',' + BlockBody.asArgumentType(argsNodeId) + ',' + !(inspector.hasClosure() || inspector.hasScopeAwareMethods()); | |||||||||||
7 | method.loadThis(); | 7 | method.loadThis(); | |||||||||||
8 | method.loadThreadContext(); | 8 | method.loadThreadContext(); | |||||||||||
9 | if (inheritedBlockBodyCount < AbstractScript.NUMBERED_BLOCKBODY_COUNT) | 9 | if (inheritedBlockBodyCount < AbstractScript.NUMBERED_BLOCKBODY_COUNT) | |||||||||||
10 | method.method.ldc(descriptor); | 10 | method.method.ldc(descriptor); | |||||||||||
11 | method.method.invokevirtual(scriptCompiler.getClassname(), "getBlockBody" + inheritedBlockBodyCount, sig(BlockBody.class, ThreadContext.class, String.class)); |
| 11 | method.method.invokevirtual(scriptCompiler.getClassname(), "getBlockBody19" + inheritedBlockBodyCount, sig(BlockBody.class, ThreadContext.class, String.class)); | ||||||||||
else | else | |||||||||||||
12 | method.method.pushInt(inheritedBlockBodyCount); | 12 | method.method.pushInt(inheritedBlockBodyCount); | |||||||||||
13 | method.method.ldc(descriptor); | 13 | method.method.ldc(descriptor); | |||||||||||
14 | method.method.invokevirtual(scriptCompiler.getClassname(), "getBlockBody", sig(BlockBody.class, ThreadContext.class, int.class, String.class)); |
| 14 | method.method.invokevirtual(scriptCompiler.getClassname(), "getBlockBody19", sig(BlockBody.class, ThreadContext.class, int.class, String.class)); | ||||||||||
15 | inheritedBlockBodyCount++; | 15 | inheritedBlockBodyCount++; |
Row | Violation |
---|