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

pop instruction

6 views
Skip to first unread message

K Stol

unread,
May 1, 2003, 4:44:11 PM5/1/03
to perl6-i...@perl.org
Hi,

Just an idea, but maybe it's nothing, oh well :)

What about an instruction to pop a number of items off the runtime stack, just to throw these values away.
This comes in handy if a function takes a certain amount of parameters, let's say n, but is called with more than
n parameters. If this happens a lot, then all kind of garbage is left on the stack. (well, at least, when the function is called with arguments on the stack, not in registers)

So because we know the number of arguments (which is in some register, acording to parrot calling conv.),
we can pop off the unused args.

like I said, maybe it's nothing, but just an idea. Hope to hear reactions.

Klaas-Jan.

Dan Sugalski

unread,
May 2, 2003, 2:38:37 PM5/2/03
to K Stol, perl6-i...@perl.org

It's a good idea. I'm about to completely give up using the runtime
stack for parameter passing and go with an overflow parameter array
instead, but that's beside the point.

Popping X items off the user or integer stacks, and popping X frames
off of each of the register stacks, makes sense. As does pushing a
mark on the control stack that notes the current stack points such
that a pop of that mark restores the other stacks to the point at the
mark, closing off any of the stack frames and starting a new frame,
and making sure that there's space for X entries in the current frame
of any stack (and starting a new frame if there isn't). And a quick
push and pop for those cases where code has made sure that there
really is enough space to push or pop without the possibility of
crossing stack frames.

If anyone wants to take this as a small worklist (and I'm not
singling you out, Klaas-Jan, you just wrote the mail message that
triggered the list :) go for it.
--
Dan

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

0 new messages