Skip to content

Commit

Permalink
Remove unused field no_args in InterpretedMethod. New n_args_* impls.…
Browse files Browse the repository at this point in the history
… Change arity method calls in erbs to make generated code look slightly more human

git-svn-id: http://svn.codehaus.org/jruby/trunk/jruby@9494 961051c9-f516-0410-bf72-c9f7e237a7b7
  • Loading branch information
enebo committed Mar 29, 2009
1 parent 23446a0 commit 402b061
Show file tree
Hide file tree
Showing 17 changed files with 443 additions and 444 deletions.
4 changes: 2 additions & 2 deletions src/org/jruby/ast/ArgsNode.arities.erb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
public void prepare(ThreadContext context, Ruby runtime, IRubyObject self <%= n_args_in(arity) %>, Block block) {
public void prepare(ThreadContext context, Ruby runtime, IRubyObject self<%= n_args_in(arity) %>, Block block) {
DynamicScope scope = context.getCurrentScope();

if (isSimple) {
scope.setArgValues(<%= n_args_out_bare(arity) %>);
} else {
prepare(context, runtime, self <%= n_args_ary(arity) %>, block);
prepare(context, runtime, self<%= n_args_ary(arity) %>, block);
}
if (getBlock() != null) processBlockArg(scope, runtime, block);
}
62 changes: 31 additions & 31 deletions src/org/jruby/ast/ArgsNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -271,113 +271,113 @@ private void masgnAwareArgAssign(ThreadContext context, Ruby runtime, IRubyObjec
}
}

public void prepare(ThreadContext context, Ruby runtime, IRubyObject self , Block block) {
public void prepare(ThreadContext context, Ruby runtime, IRubyObject self, Block block) {
DynamicScope scope = context.getCurrentScope();

if (isSimple) {
scope.setArgValues();
} else {
prepare(context, runtime, self , IRubyObject.NULL_ARRAY, block);
prepare(context, runtime, self, IRubyObject.NULL_ARRAY, block);
}
if (getBlock() != null) processBlockArg(scope, runtime, block);
}
public void prepare(ThreadContext context, Ruby runtime, IRubyObject self , IRubyObject arg0, Block block) {
public void prepare(ThreadContext context, Ruby runtime, IRubyObject self, IRubyObject arg0, Block block) {
DynamicScope scope = context.getCurrentScope();

if (isSimple) {
scope.setArgValues(arg0);
} else {
prepare(context, runtime, self , new IRubyObject[] {arg0}, block);
prepare(context, runtime, self, new IRubyObject[] {arg0}, block);
}
if (getBlock() != null) processBlockArg(scope, runtime, block);
}
public void prepare(ThreadContext context, Ruby runtime, IRubyObject self , IRubyObject arg0,IRubyObject arg1, Block block) {
public void prepare(ThreadContext context, Ruby runtime, IRubyObject self, IRubyObject arg0, IRubyObject arg1, Block block) {
DynamicScope scope = context.getCurrentScope();

if (isSimple) {
scope.setArgValues(arg0,arg1);
scope.setArgValues(arg0, arg1);
} else {
prepare(context, runtime, self , new IRubyObject[] {arg0,arg1}, block);
prepare(context, runtime, self, new IRubyObject[] {arg0, arg1}, block);
}
if (getBlock() != null) processBlockArg(scope, runtime, block);
}
public void prepare(ThreadContext context, Ruby runtime, IRubyObject self , IRubyObject arg0,IRubyObject arg1,IRubyObject arg2, Block block) {
public void prepare(ThreadContext context, Ruby runtime, IRubyObject self, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Block block) {
DynamicScope scope = context.getCurrentScope();

if (isSimple) {
scope.setArgValues(arg0,arg1,arg2);
scope.setArgValues(arg0, arg1, arg2);
} else {
prepare(context, runtime, self , new IRubyObject[] {arg0,arg1,arg2}, block);
prepare(context, runtime, self, new IRubyObject[] {arg0, arg1, arg2}, block);
}
if (getBlock() != null) processBlockArg(scope, runtime, block);
}
public void prepare(ThreadContext context, Ruby runtime, IRubyObject self , IRubyObject arg0,IRubyObject arg1,IRubyObject arg2,IRubyObject arg3, Block block) {
public void prepare(ThreadContext context, Ruby runtime, IRubyObject self, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, Block block) {
DynamicScope scope = context.getCurrentScope();

if (isSimple) {
scope.setArgValues(arg0,arg1,arg2,arg3);
scope.setArgValues(arg0, arg1, arg2, arg3);
} else {
prepare(context, runtime, self , new IRubyObject[] {arg0,arg1,arg2,arg3}, block);
prepare(context, runtime, self, new IRubyObject[] {arg0, arg1, arg2, arg3}, block);
}
if (getBlock() != null) processBlockArg(scope, runtime, block);
}
public void prepare(ThreadContext context, Ruby runtime, IRubyObject self , IRubyObject arg0,IRubyObject arg1,IRubyObject arg2,IRubyObject arg3,IRubyObject arg4, Block block) {
public void prepare(ThreadContext context, Ruby runtime, IRubyObject self, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, IRubyObject arg4, Block block) {
DynamicScope scope = context.getCurrentScope();

if (isSimple) {
scope.setArgValues(arg0,arg1,arg2,arg3,arg4);
scope.setArgValues(arg0, arg1, arg2, arg3, arg4);
} else {
prepare(context, runtime, self , new IRubyObject[] {arg0,arg1,arg2,arg3,arg4}, block);
prepare(context, runtime, self, new IRubyObject[] {arg0, arg1, arg2, arg3, arg4}, block);
}
if (getBlock() != null) processBlockArg(scope, runtime, block);
}
public void prepare(ThreadContext context, Ruby runtime, IRubyObject self , IRubyObject arg0,IRubyObject arg1,IRubyObject arg2,IRubyObject arg3,IRubyObject arg4,IRubyObject arg5, Block block) {
public void prepare(ThreadContext context, Ruby runtime, IRubyObject self, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, IRubyObject arg4, IRubyObject arg5, Block block) {
DynamicScope scope = context.getCurrentScope();

if (isSimple) {
scope.setArgValues(arg0,arg1,arg2,arg3,arg4,arg5);
scope.setArgValues(arg0, arg1, arg2, arg3, arg4, arg5);
} else {
prepare(context, runtime, self , new IRubyObject[] {arg0,arg1,arg2,arg3,arg4,arg5}, block);
prepare(context, runtime, self, new IRubyObject[] {arg0, arg1, arg2, arg3, arg4, arg5}, block);
}
if (getBlock() != null) processBlockArg(scope, runtime, block);
}
public void prepare(ThreadContext context, Ruby runtime, IRubyObject self , IRubyObject arg0,IRubyObject arg1,IRubyObject arg2,IRubyObject arg3,IRubyObject arg4,IRubyObject arg5,IRubyObject arg6, Block block) {
public void prepare(ThreadContext context, Ruby runtime, IRubyObject self, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, IRubyObject arg4, IRubyObject arg5, IRubyObject arg6, Block block) {
DynamicScope scope = context.getCurrentScope();

if (isSimple) {
scope.setArgValues(arg0,arg1,arg2,arg3,arg4,arg5,arg6);
scope.setArgValues(arg0, arg1, arg2, arg3, arg4, arg5, arg6);
} else {
prepare(context, runtime, self , new IRubyObject[] {arg0,arg1,arg2,arg3,arg4,arg5,arg6}, block);
prepare(context, runtime, self, new IRubyObject[] {arg0, arg1, arg2, arg3, arg4, arg5, arg6}, block);
}
if (getBlock() != null) processBlockArg(scope, runtime, block);
}
public void prepare(ThreadContext context, Ruby runtime, IRubyObject self , IRubyObject arg0,IRubyObject arg1,IRubyObject arg2,IRubyObject arg3,IRubyObject arg4,IRubyObject arg5,IRubyObject arg6,IRubyObject arg7, Block block) {
public void prepare(ThreadContext context, Ruby runtime, IRubyObject self, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, IRubyObject arg4, IRubyObject arg5, IRubyObject arg6, IRubyObject arg7, Block block) {
DynamicScope scope = context.getCurrentScope();

if (isSimple) {
scope.setArgValues(arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7);
scope.setArgValues(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
} else {
prepare(context, runtime, self , new IRubyObject[] {arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7}, block);
prepare(context, runtime, self, new IRubyObject[] {arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7}, block);
}
if (getBlock() != null) processBlockArg(scope, runtime, block);
}
public void prepare(ThreadContext context, Ruby runtime, IRubyObject self , IRubyObject arg0,IRubyObject arg1,IRubyObject arg2,IRubyObject arg3,IRubyObject arg4,IRubyObject arg5,IRubyObject arg6,IRubyObject arg7,IRubyObject arg8, Block block) {
public void prepare(ThreadContext context, Ruby runtime, IRubyObject self, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, IRubyObject arg4, IRubyObject arg5, IRubyObject arg6, IRubyObject arg7, IRubyObject arg8, Block block) {
DynamicScope scope = context.getCurrentScope();

if (isSimple) {
scope.setArgValues(arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8);
scope.setArgValues(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
} else {
prepare(context, runtime, self , new IRubyObject[] {arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8}, block);
prepare(context, runtime, self, new IRubyObject[] {arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8}, block);
}
if (getBlock() != null) processBlockArg(scope, runtime, block);
}
public void prepare(ThreadContext context, Ruby runtime, IRubyObject self , IRubyObject arg0,IRubyObject arg1,IRubyObject arg2,IRubyObject arg3,IRubyObject arg4,IRubyObject arg5,IRubyObject arg6,IRubyObject arg7,IRubyObject arg8,IRubyObject arg9, Block block) {
public void prepare(ThreadContext context, Ruby runtime, IRubyObject self, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, IRubyObject arg4, IRubyObject arg5, IRubyObject arg6, IRubyObject arg7, IRubyObject arg8, IRubyObject arg9, Block block) {
DynamicScope scope = context.getCurrentScope();

if (isSimple) {
scope.setArgValues(arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9);
scope.setArgValues(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
} else {
prepare(context, runtime, self , new IRubyObject[] {arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9}, block);
prepare(context, runtime, self, new IRubyObject[] {arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9}, block);
}
if (getBlock() != null) processBlockArg(scope, runtime, block);
}
Expand Down
12 changes: 6 additions & 6 deletions src/org/jruby/internal/runtime/methods/DefaultMethod.arities.erb
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
@Override
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name <%= n_args_in(arity) %>) {
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name<%= n_args_in(arity) %>) {
if (callCount >= 0) {
return tryJitReturnMethod(context, name).call(context, self, clazz, name <%= n_args_out(arity) %>);
return tryJitReturnMethod(context, name).call(context, self, clazz, name<%= n_args_out(arity) %>);
}

return actualMethod.call(context, self, clazz, name <%= n_args_out(arity) %>);
}
@Override
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name <%= n_args_in(arity) %>, Block block) {
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name<%= n_args_in(arity) %>, Block block) {
if (callCount >= 0) {
return tryJitReturnMethod(context, name).call(context, self, clazz, name <%= n_args_out(arity) %>, block);
return tryJitReturnMethod(context, name).call(context, self, clazz, name<%= n_args_out(arity) %>, block);
}

return actualMethod.call(context, self, clazz, name <%= n_args_out(arity) %>, block);
}
return actualMethod.call(context, self, clazz, name<%= n_args_out(arity) %>, block);
}
Loading

0 comments on commit 402b061

Please sign in to comment.