Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

pdd03_calling_conventions.pod questions

1 view
Skip to first unread message

Vladimir Lipskiy

unread,
Aug 3, 2003, 9:23:32 PM8/3/03
to perl6-internals
Q1: Suppose I have the following call into a sub named "foo":

foo($var1, $var2, $var3);

What should I set in I1? Is it 3?

And here:

foo($var1, @arr2, %hash3);

Is it still 3, since these aren't gonna be flattened?

Q2: I'm calling without prototyping

foo($var1, $var2, $var3, ... , $var23);

Here, what should I place in I2? Is it 11 (as we have P5-P15) or
23 (considering the P3 register)?

Thanks (~: <---- he's a boxer, that's why he has a borken nose

Leopold Toetsch

unread,
Aug 4, 2003, 4:26:59 AM8/4/03
to Vladimir Lipskiy, perl6-i...@perl.org
Vladimir Lipskiy <fors...@kaluga.ru> wrote:
> Q1: Suppose I have the following call into a sub named "foo":

First of all, are you targeting PASM or PIR? For the latter, its done
automatically.

> foo($var1, $var2, $var3);
> foo($var1, @arr2, %hash3);

> Is it still 3, since these aren't gonna be flattened?

Both have 3 params. If these are PMCs, they go in P5..P7, so *I2* would
be 3.

> Q2: I'm calling without prototyping

> foo($var1, $var2, $var3, ... , $var23);

> Here, what should I place in I2? Is it 11 (as we have P5-P15) or
> 23 (considering the P3 register)?

I would expect I2=11, I1=12

leo

Vladimir Lipskiy

unread,
Aug 4, 2003, 7:38:09 AM8/4/03
to perl6-internals
> First of all, are you targeting PASM or PIR? For the latter, its done
> automatically.

I mean PASM

> > Q2: I'm calling without prototyping
>
> > foo($var1, $var2, $var3, ... , $var23);
>
> > Here, what should I place in I2? Is it 11 (as we have P5-P15) or
> > 23 (considering the P3 register)?
>
> I would expect I2=11, I1=12

D'oh, I suspected it should be I2=11, I1=23. It seems to me that
I finally got what was considered to be the parameter list. So, when
you say PARAMETER LIST, you have in mind all the I5-I15, N5-N15,
S5-S15, P3, P5-P15 registers, don't you? That is, I should place in I1
the number of these registers I filled.

Dan Sugalski

unread,
Aug 4, 2003, 10:26:55 AM8/4/03
to Vladimir Lipskiy, perl6-internals
At 4:23 AM +0300 8/4/03, Vladimir Lipskiy wrote:
>Q1: Suppose I have the following call into a sub named "foo":
>
>foo($var1, $var2, $var3);
>
>What should I set in I1? Is it 3?

Nope. I2 should be 3, and I1 0. (Assuming you put those three
parameters in the first three PMC registers, which is what you should
do even in the unprototyped case)

>And here:
>
>foo($var1, @arr2, %hash3);
>
>Is it still 3, since these aren't gonna be flattened?

I2 is still 3 and I1 0.

>Q2: I'm calling without prototyping
>
>foo($var1, $var2, $var3, ... , $var23);
>
>Here, what should I place in I2? Is it 11 (as we have P5-P15) or
>23 (considering the P3 register)?

I2 should be 11, and I1 should be 12.
--
Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski even samurai
d...@sidhe.org have teddy bears and even
teddy bears get drunk

Leopold Toetsch

unread,
Aug 4, 2003, 11:49:32 AM8/4/03
to Vladimir Lipskiy, perl6-i...@perl.org
Vladimir Lipskiy <fors...@kaluga.ru> wrote:
>> > foo($var1, $var2, $var3, ... , $var23);
>>
>> I would expect I2=11, I1=12

> D'oh, I suspected it should be I2=11, I1=23.

No. You have the first 11 parameters in P5..P15 (I2=11). Then you have 12
more, which go into the overflow array P3 (I1=12)

> ... It seems to me that


> I finally got what was considered to be the parameter list. So, when
> you say PARAMETER LIST, you have in mind all the I5-I15, N5-N15,
> S5-S15, P3, P5-P15 registers, don't you?

The parameter list are all the function parameters. When you have an
unprototyped sub, I5.., S5,.. N5... are unused.

> ... That is, I should place in I1


> the number of these registers I filled.

I1 ... Number of items in the overflow/parameter array P3.

leo

Vladimir Lipskiy

unread,
Aug 4, 2003, 4:05:16 PM8/4/03
to Dan Sugalski, l...@toetsch.at, perl6-internals
I don't think I was reading pdd03_calling_conventions.pod
in a slipshod manner and I swear that this place in the pod

>=item I1
>
>The number of items pushed onto the parameter list.

is the personification of confusion.

> I1 ... Number of items in the overflow/parameter array P3.

Hell yeah. That's what should be there instead of PARAMETER LIST,
IMHO.

Thanks Leo, Dan for commenting on this thread.

(~:


Dan Sugalski

unread,
Aug 4, 2003, 3:17:25 PM8/4/03
to Vladimir Lipskiy, l...@toetsch.at, perl6-internals
At 11:05 PM +0300 8/4/03, Vladimir Lipskiy wrote:
>I don't think I was reading pdd03_calling_conventions.pod
>in a slipshod manner and I swear that this place in the pod
>
>>=item I1
>>
>>The number of items pushed onto the parameter list.
>
>is the personification of confusion.

Then I'll go clarify that. :)

0 new messages