Newsgroups: comp.lang.scheme
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!MathWorks.Com!yeshua.marcam.com!usc!sdd.hp.com!apollo.hp.com!netnews
From: sommerfeld@apollo.hp.com (Bill Sommerfeld)
Subject: Re: Baker's "Cheney on the M.T.A." CPS->C translation
Sender: usenet@apollo.hp.com (Usenet News)
Message-ID: <CxtoDL.MnL@apollo.hp.com>
Date: Mon, 17 Oct 1994 15:00:57 GMT
References: <1994Oct7.023308.5041@ida.liu.se> <hbakerCxCzC4.EIB@netcom.com> <1994Oct14.230215.6345@ida.liu.se>
Nntp-Posting-Host: snarfblatt.ch.apollo.hp.com
Organization: Hewlett Packard, Chelmsford Site
Lines: 38

In article <1994Oct14.230215.6345@ida.liu.se>,
Mikael Pettersson <mikpe@ida.liu.se> wrote:
>In article <hbakerCxCzC4.EIB@netcom.com> hbaker@netcom.com (Henry G. Baker) writes:
>Stack frames have the following sizes (all sizes are in bytes):
>machine/compiler	no local vars	32 bytes of local storage
>SPARC (SunPro cc)	96		128
>SPARC (gcc)		112		144
>PowerPC (Moto. cc)	64		96
>HP-PA (HP cc)		64		128
>HP-PA (gcc)		128		192
>Alpha (DEC cc)		16		96
>MIPS (DEC cc)		24		56
>
>Software conventions cause C stacks have an appallingly high `idle' cost.
>(In `address space', not cycles.) There are slots for links to previous
>frames, callee-saved registers, return addresses, and `mystery' slots
>with no apparent use. But they all tend to be there, regardless of whether
>the active function needs them or not. (Few of these slots are ever
>_written_ to, of course.)

The cited reason for the 64-byte minimum stack frame size on PA is so
that stack frames can be aligned on maximal cache line boundaries, so
that instructions which use "cache hints" can be used safely by the
compiler.  I'd imagine the same may be true for some of the other RISC
architectures.

This is, of course, no excuse for large fixed-layout stack frame
headers with many rarely-used slots, but blaming this on "C" is just
plain wrong.  Rather, it appears to be an attempt to have one single
stack frame format across multiple languages, so the same compiler
backend can be used for multiple languages.  Several of the "mystery
slots" in the PA calling convention are for use by other languages and
are of no use to C; others are an artifact of an overly-complex
shared-library linkage mechanism.

					- Bill


