🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.dec
Article #4360

Re: Need alloca which allocates storage IN the stack frame (Ultrix)

#4360
From: John Wroclawski
Date: Thu, 21 Jan 1993 22:58
27 lines
1815 bytes
   From: timv@ccad.uiowa.edu (Timothy VanFosson)

   Thanks for the response, but (as you point out) I neglected to mention
   that this is for a DECStation 5000/200.  Thanks also to those who
   have suggested GNU Emacs/GCC alloca(), but it works (doesn't work :-)
   in the same manner as the DEC alloca() -- the storage allocated is
   not IN the stack.  I had already tried it before I posted.

   I am still looking for an (assembly) version of alloca() which
   does manipulate the stack to allocate storage.

The problem here is that since the Mips calling standard does not
require the use of a frame pointer (and in fact an FP is almost never
used in optimized code), implementing an in-stack alloca requires some
help from the compiler (because you must move the stack pointer, but
the SP is used to reference local variables.

The decstation version of GCC provides this support. So does the
standard Ultrix C compiler, but you must include <alloca.h> or 
"#define alloca __builtin_alloca" in any file that needs it. However,
as I recall the version built in to the standard compiler has some
limitations, which are documented in <alloca.h> and perhaps elsewhere.

John Wroclawski
MIT Lab for Computer Science
jtw@lcs.mit.edu
Technical Details
Message-ID: <JTW.93Jan21175827@pmws.lcs.mit.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!gatech!destroyer!gumby!yale!mintaka.lcs.mit.edu!mintaka!jtw
References: <9915020@zl2tnm.gen.nz> <1993Jan21.163051.6773@ccad.uiowa.edu>

Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.dec
Path: arc1-ca.pugleaf.net!sparky!uunet!gatech!destroyer!gumby!yale!mintaka.lcs.mit.edu!mintaka!jtw
From: jtw@lcs.mit.edu (John Wroclawski)
Subject: Re: Need alloca which allocates storage IN the stack frame (Ultrix)
In-Reply-To: timv@ccad.uiowa.edu's message of 21 Jan 93 16:30:51 GMT
Message-ID: <JTW.93Jan21175827@pmws.lcs.mit.edu>
Sender: news@mintaka.lcs.mit.edu
Organization: MIT Home for Wayward Triumphs
References: <9915020@zl2tnm.gen.nz> <1993Jan21.163051.6773@ccad.uiowa.edu>
Date: Thu, 21 Jan 1993 22:58:27 GMT
Lines: 27