On Sep-22, Leopold Toetsch wrote:
> Steve Fink <[EMAIL PROTECTED]> wrote:
> >> Then we need code from HLL to see, how efficient (or not) parameter
> >> passing does look like.
>
> > I've been trying to implement A6 for languages/perl6. My first cut was
> > to have all calls, prototyped or not, take three parameters:
>
> suboptimal for sure
>
> >> Then we can think of some higher level ops to {de,}construct argument
> >> arrays.
>
> > Well, I'd also like to know what the IMCC syntax will look like for
> > dynamically-sized lists of arguments and parameters,
>
> Just use a PerlArray:
>
> .sym PerlArray params
> params = new PerlArray
> push params, arg1
> push params, arg2
> ...
> .arg params
> .pcc_call ...
Umm... didn't you just call this approach suboptimal?
Just to be sure we're talking about the same thing:
sub f ($a, $b, $c) { ... }
$x = phase_of_moon('waxing') ? \&f : \&CORE::print;
$x->(3, [EMAIL PROTECTED], [EMAIL PROTECTED]);
i.e., I'm calling f() without a prototype.
A builtin that took three parameters would expect them in P5, P6, and
P7. But how do I do that in IMCC for $x->(3, [EMAIL PROTECTED], [EMAIL PROTECTED])? I
am
suggesting
.arg 3
.args _AV_x
.args _AV_y
with some deep magic going on under the hood to get them into the
correct registers, most probably by means of a new, specialized op
because the current way of doing it is ugly and slow.
You seem to be suggesting something like:
.sym PerlArray params
params = new PerlArray
push params, 3
append params, _AV_x
append params, _AV_y
.arg params
...which doesn't fulfill the requirement of working with a builtin
that expects its three arguments in P5, P6, and P7.