Re: Stack based machines

Philip Koopman <>
25 Mar 2000 02:43:33 -0500

          From comp.compilers

Related articles
[2 earlier articles]
Re: Stack based machines (2000-03-25)
Re: Stack based machines (Pieter Koopman) (2000-03-25)
Re: Stack based machines (2000-03-25)
Re: Stack based machines (2000-03-25)
Re: Stack based machines (2000-03-25)
Re: Stack based machines (Deepak Janardhanan) (2000-03-25)
Re: Stack based machines (Philip Koopman) (2000-03-25)
Re: Stack based machines (Keith Wootten) (2000-03-28)
Re: Stack based machines (Bernd Paysan) (2000-03-28)
Re: Stack based machines (Deepak Janardhanan) (2000-03-28)
| List of all articles for this month |

From: Philip Koopman <>
Newsgroups: comp.compilers,comp.arch
Date: 25 Mar 2000 02:43:33 -0500
Organization: Carnegie Mellon University, ECE & ICES
References: 00-03-101 00-03-124
Keywords: architecture, performance

[The comp.compilers moderator wrote]:
>[There have been lots of stack architectures that kept the top of the
>stack in registers, but it's my impression that performance is worse
>than real registers. Registers hold common subexpression values and
>hot loop variables as well as expression temporaries, and stack
>caching doesn't easily get either of those. -John]

Stacks work pretty well if someone takes the trouble to write a
stack-scheduling compiler. The problem has always been that
register-based machines with whizzy compilers were compared with
idiot-simple stack code -- not a fair comparison. Similarly, most of
the old "stacks are worse than registers/memory" arguments were based
on small code snippets that didn't exploit reuse of on-stack
variables, or didn't use realistic instruction sets that permitted
nondestructive accesses to the top couple stack elements. The stack
machines I worked on a decade ago were optimized for cost/performance,
not just raw performance. (But they did pretty well at raw
performance too.)

I published a paper on a first cut at such an optimizing stack
compiler back in 1994; I've since moved on to other pursuits. See: It's
suitable for stack architectures that keep the top 2 or 3 values in
registers, which is commonly the case.

-- Phil

Phil Koopman -- --

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.