On 7/17/06, Ola Bini <[EMAIL PROTECTED]> wrote:
An interesting side note is that args are just local vars in Java...0 is self for non-static methods, 1, 2, 3 would be the first, second, and third args, and anything beyond that is a "normal" local variable. There's no reason we couldn't do the same by specifying a specific format for the stack frame:
0 = self (and in Ruby there's always a self)
1 = block arg (nil if nothing, maybe true if available for yield, and a proc if using &block arg)
2 thru n = normal args
n + 1 = rest arg
Then all a method needs to know is how many args it expects, and whether it expects a rest arg or not to size the array. Having the block field on the frame might also eliminate the Iter nonsense in JRuby currently.
Charles O Nutter wrote:
> On 7/17/06, *Ola Bini* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:
>
> I think the single-array-per-call would work just fine...but we have
> some other considerations too like handling argument lists, passed
> blocks and block args, and ensuring constant lookup time for
> blocks-within-blocks-within-methods. At any rate, smack me around if I
> start to fall into pre-optimization mode. One array per call probably
> isn't gonna kill us.
Ah, and that's the fine point about having a stack of frame. If you make
certain that the stack is indexable from the in i O(1) time, we have
constant lookup for any nesting possible. Argument lists should be
handled in the same way, actually, as the last frame pushed, since
blocks need to have access to these too.
An interesting side note is that args are just local vars in Java...0 is self for non-static methods, 1, 2, 3 would be the first, second, and third args, and anything beyond that is a "normal" local variable. There's no reason we couldn't do the same by specifying a specific format for the stack frame:
0 = self (and in Ruby there's always a self)
1 = block arg (nil if nothing, maybe true if available for yield, and a proc if using &block arg)
2 thru n = normal args
n + 1 = rest arg
Then all a method needs to know is how many args it expects, and whether it expects a rest arg or not to size the array. Having the block field on the frame might also eliminate the Iter nonsense in JRuby currently.
--
Charles Oliver Nutter @ headius.blogspot.com
JRuby Developer @ www.jruby.org
Application Architect @ www.ventera.com
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________ Jruby-devel mailing list Jruby-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jruby-devel