File path: /jruby-1.4.0/src/org/jruby/compiler/impl/RootScopedBodyCompiler.java | File path: /jruby-1.4.0/src/org/jruby/compiler/impl/MethodBodyCompiler.java | |||
Method name: void endBody()
|
Method name: void endBody()
|
|||
Number of AST nodes: 21 | Number of AST nodes: 21 | |||
1 | if (specificArity) {↵ | 1 | if (specificArity) {↵ | |
2 | ↵ | |||
2 | method = new SkinnyMethodAdapter(↵ | 3 | method = new SkinnyMethodAdapter(↵ | |
3 | script.getClassVisitor().visitMethod(ACC_PUBLIC | ACC_STATIC, methodName,↵ | 4 | script.getClassVisitor().visitMethod(↵ | |
5 | ACC_PUBLIC | ACC_STATIC,↵ | |||
6 | methodName,↵ | |||
4 | StandardASMCompiler.getStaticMethodSignature(script.getClassname(), 4), null,↵ | 7 | StandardASMCompiler.getStaticMethodSignature(script.getClassname(), 4),↵ | |
8 | null,↵ | |||
5 | null));↵ | 9 | null));↵ | |
6 | method.start();↵ | 10 | method.start();↵ | |
7 | // check arity in the variable-arity version↵ | 11 | // check arity in the variable-arity version↵ | |
8 | method.aload(1);↵ | 12 | method.aload(1);↵ | |
9 | method.invokevirtual(p(ThreadContext.class), "getRuntime", sig(Ruby.class));↵ | 13 | method.invokevirtual(p(ThreadContext.class), "getRuntime", sig(Ruby.class));↵ | |
10 | method.aload(3);↵ | 14 | method.aload(3);↵ | |
11 | method.pushInt(scope.getRequiredArgs());↵ | 15 | method.pushInt(scope.getRequiredArgs());↵ | |
12 | method.pushInt(scope.getRequiredArgs());↵ | 16 | method.pushInt(scope.getRequiredArgs());↵ | |
13 | method.invokestatic(p(Arity.class), "checkArgumentCount", sig(int.class, Ruby.class, IRubyObject[].class, int.class, int.class));↵ | 17 | method.invokestatic(p(Arity.class), "checkArgumentCount", sig(int.class, Ruby.class, IRubyObject[].class, int.class, int.class));↵ | |
14 | method.pop();↵ | 18 | method.pop();↵ | |
15 | loadThis();↵ | 19 | loadThis();↵ | |
16 | loadThreadContext();↵ | 20 | loadThreadContext();↵ | |
17 | loadSelf();↵ | 21 | loadSelf();↵ | |
18 | // FIXME: missing arity check↵ | 22 | // FIXME: missing arity check↵ | |
19 | for (int i = 0; i < scope.getRequiredArgs(); i++) {↵ | 23 | for (int i = 0; i < scope.getRequiredArgs(); i++) {↵ | |
20 | method.aload(StandardASMCompiler.ARGS_INDEX);↵ | 24 | method.aload(StandardASMCompiler.ARGS_INDEX);↵ | |
21 | method.ldc(i);↵ | 25 | method.ldc(i);↵ | |
22 | method.arrayload();↵ | 26 | method.arrayload();↵ | |
23 | }↵ | 27 | }↵ | |
24 | method.aload(StandardASMCompiler.ARGS_INDEX + 1);↵ | 28 | method.aload(StandardASMCompiler.ARGS_INDEX + 1);↵ | |
25 | // load block from [] version of method↵ | 29 | // load block from [] version of method↵ | |
26 | method.invokestatic(script.getClassname(), methodName, getSignature());↵ | 30 | method.invokestatic(script.getClassname(), methodName, getSignature());↵ | |
27 | method.areturn();↵ | 31 | method.areturn();↵ | |
28 | method.end();↵ | 32 | method.end();↵ | |
29 | } | 33 |
| |
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.7 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 305 |
Number of mapped statements | 21 |
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) | 163.3 |
Clone type | Type 1 |
ID | Statement | ID | Statement | |
---|---|---|---|---|
5 | if (specificArity) | 11 | if (specificArity) | |
6 | method = new SkinnyMethodAdapter(script.getClassVisitor().visitMethod(ACC_PUBLIC | ACC_STATIC, methodName, StandardASMCompiler.getStaticMethodSignature(script.getClassname(), 4), null, null)); | 12 | method = new SkinnyMethodAdapter(script.getClassVisitor().visitMethod(ACC_PUBLIC | ACC_STATIC, methodName, StandardASMCompiler.getStaticMethodSignature(script.getClassname(), 4), null, null)); | |
7 | method.start(); | 13 | method.start(); | |
8 | method.aload(1); | 14 | method.aload(1); | |
9 | method.invokevirtual(p(ThreadContext.class), "getRuntime", sig(Ruby.class)); | 15 | method.invokevirtual(p(ThreadContext.class), "getRuntime", sig(Ruby.class)); | |
10 | method.aload(3); | 16 | method.aload(3); | |
11 | method.pushInt(scope.getRequiredArgs()); | 18 | method.pushInt(scope.getRequiredArgs()); | |
12 | method.pushInt(scope.getRequiredArgs()); | 17 | method.pushInt(scope.getRequiredArgs()); | |
13 | method.invokestatic(p(Arity.class), "checkArgumentCount", sig(int.class, Ruby.class, IRubyObject[].class, int.class, int.class)); | 19 | method.invokestatic(p(Arity.class), "checkArgumentCount", sig(int.class, Ruby.class, IRubyObject[].class, int.class, int.class)); | |
14 | method.pop(); | 20 | method.pop(); | |
15 | loadThis(); | 21 | loadThis(); | |
16 | loadThreadContext(); | 22 | loadThreadContext(); | |
17 | loadSelf(); | 23 | loadSelf(); | |
18 | for (int i = 0; i < scope.getRequiredArgs(); i++) | 24 | for (int i = 0; i < scope.getRequiredArgs(); i++) | |
19 | method.aload(StandardASMCompiler.ARGS_INDEX); | 25 | method.aload(StandardASMCompiler.ARGS_INDEX); | |
20 | method.ldc(i); | 26 | method.ldc(i); | |
21 | method.arrayload(); | 27 | method.arrayload(); | |
22 | method.aload(StandardASMCompiler.ARGS_INDEX + 1); | 28 | method.aload(StandardASMCompiler.ARGS_INDEX + 1); | |
23 | method.invokestatic(script.getClassname(), methodName, getSignature()); | 29 | method.invokestatic(script.getClassname(), methodName, getSignature()); | |
24 | method.areturn(); | 30 | method.areturn(); | |
25 | method.end(); | 31 | method.end(); |
Row | Violation |
---|