<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'><div>alloca is very portable even if it is not in ANSI C or even Posix.</div><div><br></div><div><br></div><div> gcc has builtin support for it.</div><div><span style="font-size: 12pt; "> Win32 provides it, where it is called _alloca.</span></div><div><span style="font-size: 12pt; ">The NT/amd64 ABI specifically accounts for it -- functions that call</span></div><div><span style="font-size: 12pt; ">alloca must have a fixed "frame pointer" in a register other than rsp,</span></div><div><span style="font-size: 12pt; ">so that rsp can be changed by calling alloca.</span></div><div><span style="font-size: 12pt; "><br></span></div><div><span style="font-size: 12pt; "> clang/LLVM presumably provide it.</span></div><div><span style="font-size: 12pt; "> A lot of code depends on it and it is generally easy to provide.</span></div><div><span style="font-size: 12pt; "><br></span></div><div><span style="font-size: 12pt; ">OpenVMS apparently calls it __ALLOCA.</span></div><div><br></div><div><br></div><div><br></div><div>For more complete portability to the C backend we could</div><div>add an m3cg operation to allocate an array of jmpbufs</div><div>with a constant count.</div><div><br></div><div><br></div><div>It is certainly more portable than C99, and C99 VLAs are kind of more general than I need.</div><div>That is, I might pass a "variable" to alloca, but it is kind of a constant.</div><div><br></div><div><br></div><div>My last/current proposal though does do the allocation dynamically, which this</div><div>m3cg operation would not provide for.</div><div><br></div><div><br></div><div> - Jay</div><br><br><br><br><div>> Date: Sat, 18 Jul 2015 19:21:40 -0400<br>> From: hendrik@topoi.pooq.com<br>> To: m3devel@elegosoft.com<br>> Subject: Re: [M3devel] elimination of jmpbuf size from cm3 frontend?<br>>> <br>> Unless things have changed recently, alloca() is not standard.<br>> <br>> see the discussion and links in http://c-faq.com/malloc/alloca.html<br>> <br>> That page also contains the sentence<br>> <br>> 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.<br>> <br>> Not clear at aall if the VLA's can be used for this.<br>> <br><br></div> </div></body>
</html>