[M3devel] elimination of jmpbuf size from cm3 frontend?

Jay K jay.krell at cornell.edu
Sun Jul 19 10:23:46 CEST 2015


alloca is very portable even if it is not in ANSI C or even Posix.

 gcc has builtin support for it. Win32 provides it, where it is called _alloca.The NT/amd64 ABI specifically accounts for it -- functions that callalloca must have a fixed "frame pointer" in a register other than rsp,so that rsp can be changed by calling alloca.
 clang/LLVM presumably provide it. A lot of code depends on it and it is generally easy to provide.
OpenVMS apparently calls it __ALLOCA.


For more complete portability to the C backend we couldadd an m3cg operation to allocate an array of jmpbufswith a constant count.

It is certainly more portable than C99, and C99 VLAs are kind of more general than I need.That is, I might pass a "variable" to alloca, but it is kind of a constant.

My last/current proposal though does do the allocation dynamically, which thism3cg operation would not provide for.

 - Jay



> Date: Sat, 18 Jul 2015 19:21:40 -0400
> From: hendrik at topoi.pooq.com
> To: m3devel at elegosoft.com
> Subject: Re: [M3devel] elimination of jmpbuf size from cm3 frontend?
>> 
> Unless things have changed  recently, alloca() is not standard.
> 
> see the discussion and links in http://c-faq.com/malloc/alloca.html
> 
> That page also contains the sentence
> 
> Now that C99 supports variable-length arrays (VLA's), they can be used to more cleanly accomplish most of the tasks which alloca used to be put to.
> 
> Not clear at aall if the VLA's can be used for this.
> 

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20150719/c9f7ac81/attachment-0002.html>


More information about the M3devel mailing list