[comp.sys.m88k] alloca

ken@dali.cc.gatech.edu (Ken Seefried iii) (02/19/91)

-----

Might anyone have a working alloca() for a Tektronix XD88/10 running
UTekV 3.2e?  Many thanks...

--

	ken seefried iii	"Specialization is for insects."
	ken@dali.cc.gatech.edu	   - Robert A. Heinlein (1916-1988)

tom@ssd.csd.harris.com (Tom Horsley) (02/19/91)

ken> Might anyone have a working alloca() for a Tektronix XD88/10 running
ken> UTekV 3.2e?  Many thanks...

It is close to (or maybe actually) impossible to implement a true alloca()
without compiler support. If the compiler you are using does not have such
support, then your only hope is probably to use the portable alloca() that
comes with gnuemacs and is available at random archive sites (no, I don't
know a specific one off the top of my head, sorry).

The Gnu C compiler *does* have support for a builtin alloca() function, as
do several other 88k compilers, but lots of 88k compilers don't have any
support.

Technically, the problem is that most compilers only use one register (r31)
as both a stack and frame pointer. This works fine when the stack frame is
fixed size. If you want a variable sized frame (which is essentially what
alloca() is supposed to provide), you need your compiler to generate code
that uses r30 as a frame pointer and r31 as a stack pointer. On top of that,
due to the obscure way arguments are passed on the 88k the implementation of
alloca() also needs to know the largest sized argument list passed anywhere
in the function.
--
======================================================================
domain: tahorsley@csd.harris.com       USMail: Tom Horsley
  uucp: ...!uunet!hcx1!tahorsley               511 Kingbird Circle
                                               Delray Beach, FL  33444
+==== Censorship is the only form of Obscenity ======================+
|     (Wait, I forgot government tobacco subsidies...)               |
+====================================================================+