develooper Front page | perl.perl6.internals | Postings from March 2006

Re: User stack: Worthwhile?

Thread Previous | Thread Next
From:
Patrick R. Michaud
Date:
March 2, 2006 11:19
Subject:
Re: User stack: Worthwhile?
Message ID:
20060302191934.GW30560@host.pmichaud.com
On Mon, Feb 27, 2006 at 09:46:42AM -0800, Chip Salzenberg wrote:
> On Fri, Feb 24, 2006 at 12:57:24AM +0100, Leopold Toetsch wrote:
> > On Feb 24, 2006, at 0:23, Patrick R. Michaud wrote:
> > >>[...]
> > >I've just committed an update (r11722) that eliminates PGE's
> > >use of save/restore opcodes in the code it generates -- indeed,
> > >PGE no longer has any save or restore opcodes and thus doesn't
> > >need the user stack at all.
> > 
> > That's indeed an (indirect) answer to the 'do we really need it' part ;)
> 
> Is there any other client of the user stack that can't be easily replaced by
> some kind of *Array?  It'd be nice to lop off such a low-value feature.

As Will Coleda mentioned, the only real advantage of the user stack
over an *Array seems to be that each subroutine wanting to manipulate the
stack doesn't have to first look up a global symbol in order to do it.

Intuitively, it would seem that a user stack, with its specialized parrot 
opcodes, ought to be significantly faster than simply using another 
array-ish object as a stack.  It was this sort of (incorrect) thinking 
that led me to use it over an array in the first place.  Since that
is apparently not the case, I don't see any real use for keeping the
user stack.

(In PGE's case, using an array instead of the userstack is also
superior for a number of other reasons, mostly having to do with
being able to manipulate large parts of the stack in a single
operation.)

Pm

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About