Sean O'Rourke wrote:

> From: Sean O'Rourke [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, August 21, 2003 1:56 PM
> To: Tom Locke
> Cc: [EMAIL PROTECTED]
> Subject: Re: Registers vs. Stack
> 
> 
> "Tom Locke" <[EMAIL PROTECTED]> writes:
> > p.s. (and at the risk of being controversial :) Why did Miguel de
> > Icaza say Parrot was "based on religion"? Was it realted to this
> > issue? Why is he wrong?
> 
> IIRC it is -- his take is that stack VM code provides useful
> information about variable lifetimes, which can help the JIT produce
> good code.  If everything's jitted, then his contention is that
> bytecode opcount doesn't matter that much.
> 
> I'm not going to stick my neck out and offer a technical opinion, but
> I'll just note that religion has been the driving force behind some
> great things in the past -- witness Europe's cathedrals ;).  Oh,
> wait... we're supposed to be "the bazaar".

More specifically, if IMCC spills a register into the frame or a lexical
pad or who-knows-where, it's hard for the JIT compiler to "unspill" that
value. Not having a register file in the bytecode leaves register spill
up to the JIT compiler, which knows more about the native platform.

For instance, IA-64 (Itanium) has a native register file large enough to
dedicate one native register to each parrot string register, integer
register, and PMC register--and still have plenty left over. It'd be
hard for the hypothetical IA-64 JIT to fully utilize that register file.
(OTOH, it would be hard to write even a C function which is complex
enough to fully utilize that particular register file without giving the
optimizer a seizure.)

By contrast, x86 has nowhere near enough native GP registers for the 96
total IRs, SRs, and PRs--the x86 JIT is likely spilling registers left
and right. (OTOH, C code is spilling left and right, too.)

The ideal stack-based JIT might be able to more easily emit better code
for both architectures.

Stack-based operators are an unnatural paradigm for most assembly-level
programmers, though. Easier to give a register a name than to remember
how deep on the stack such-and-such value is. What else to recommend
them? Well--parrot's pretty married to them by now, for one.

--
 
Gordon Henriksen
IT Manager
ICLUBcentral Inc.
[EMAIL PROTECTED]


Reply via email to