On 07/01/2011 15:45, Andrew Whitworth wrote:
I'm really coming to the conclusion that the problem with fill_params
isn't just that it's too large and ugly, but that it's tasked with too
much stuff. Our PCC algorithm, and the promises that we make about all
the different types and configurations of parameters and arguments is
just too complicated.
I suspect - like the Rakudo binder - it tends to boil down to a loop of
some kind over the signature object (only Rakudo's signature objects are
much richer). The Rakudo one does leave the flattening side of things to
be handled by the CallContext PMC, but then I guess the Parrot one does
too. I wouldn't describe the result I got as beautiful, but I got a lot
of relief by breaking a bunch of the logic into a "bind one param"
worker function that gets called when the overall binding logic has a
parameter to bind and a place to stick it.
For instance:
1) If we add a new PIR op get_signature. Then we can tell IMCC to use
the new op instead of get_params in this situation:
.sub foo
.param pmc sig :call_sig
In these cases, we can call the new op instead of get_params, never
call fill_params, and cut ~10 lines of code out of it. For functions
that use this feature, or HLLs that do their own argument processing
and sig unpacking, this could be a major win.
Rakudo may get a win from this, though I'd suspect it'll be a very small
one - I know where a bunch of the cost is with Rakudo's signature
binding (the type checking), and until that bit gets fixed up anything
like this will be dwarfed by it.
If it's just a new op under the hood then this can be user-transparent
too. On the other hand, a common calling convention implementation was
once a goal. On the third hand, in 6model on .Net I'm already looking at
the profiles and seeing that in a few very common cases it'd be nice to
have a very simple specialized binder or just pull stuff straight out of
the call sig after a fast check on its shape (something for an optimizer
to decide, I guess) rather than paying the whole cost of running the binder.
/jnthn
_______________________________________________
http://lists.parrot.org/mailman/listinfo/parrot-dev