home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / sys / dec / 7050 < prev    next >
Encoding:
Text File  |  1993-01-21  |  1.7 KB  |  40 lines

  1. Newsgroups: comp.sys.dec
  2. Path: sparky!uunet!gatech!destroyer!gumby!yale!mintaka.lcs.mit.edu!mintaka!jtw
  3. From: jtw@lcs.mit.edu (John Wroclawski)
  4. Subject: Re: Need alloca which allocates storage IN the stack frame (Ultrix)
  5. In-Reply-To: timv@ccad.uiowa.edu's message of 21 Jan 93 16:30:51 GMT
  6. Message-ID: <JTW.93Jan21175827@pmws.lcs.mit.edu>
  7. Sender: news@mintaka.lcs.mit.edu
  8. Organization: MIT Home for Wayward Triumphs
  9. References: <9915020@zl2tnm.gen.nz> <1993Jan21.163051.6773@ccad.uiowa.edu>
  10. Date: Thu, 21 Jan 1993 22:58:27 GMT
  11. Lines: 27
  12.  
  13.  
  14.    From: timv@ccad.uiowa.edu (Timothy VanFosson)
  15.  
  16.    Thanks for the response, but (as you point out) I neglected to mention
  17.    that this is for a DECStation 5000/200.  Thanks also to those who
  18.    have suggested GNU Emacs/GCC alloca(), but it works (doesn't work :-)
  19.    in the same manner as the DEC alloca() -- the storage allocated is
  20.    not IN the stack.  I had already tried it before I posted.
  21.  
  22.    I am still looking for an (assembly) version of alloca() which
  23.    does manipulate the stack to allocate storage.
  24.  
  25. The problem here is that since the Mips calling standard does not
  26. require the use of a frame pointer (and in fact an FP is almost never
  27. used in optimized code), implementing an in-stack alloca requires some
  28. help from the compiler (because you must move the stack pointer, but
  29. the SP is used to reference local variables.
  30.  
  31. The decstation version of GCC provides this support. So does the
  32. standard Ultrix C compiler, but you must include <alloca.h> or 
  33. "#define alloca __builtin_alloca" in any file that needs it. However,
  34. as I recall the version built in to the standard compiler has some
  35. limitations, which are documented in <alloca.h> and perhaps elsewhere.
  36.  
  37. John Wroclawski
  38. MIT Lab for Computer Science
  39. jtw@lcs.mit.edu
  40.