From: Bakul Shah <bakul@bitblocks.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] assembly syntax in plan 9
Date: Mon, 16 Jan 2012 15:18:58 -0800 [thread overview]
Message-ID: <20120116231858.5B7891CC32@mail.bitblocks.com> (raw)
In-Reply-To: Your message of "Mon, 16 Jan 2012 15:11:24 EST." <4F14846C.4040706@gmail.com>
On Mon, 16 Jan 2012 15:11:24 EST "Joel C. Salomon" <joelcsalomon@gmail.com> wrote:
> On 01/16/2012 02:03 PM, Bakul Shah wrote:
> > On Jan 16, 2012, at 10:51 AM, Greg Comeau <comeauat9fans@gmail.com> wrote:
> >> What we do in problematic cases with Comeau is to generate code to
> >> arrange for the allocation of the VLA on the heap. I'm not saying
> >> this is perfect, but at least it gets the feature implementable and up
> >> and running as "a portable implementation" versus perhaps not being
> >> able to implement it at all on some platforms.
> >
> > How do you deal with longjmp?
>
> I recall reading the source for a (mostly-) portable alloca() that
> checked where on the call-stack is was invoked from and released memory
> for any alloca() invocation from lower on the stack. (The allocations
> themselves were on the heap.)
You are probably referring to Doug Gwyn's portable alloca().
It relies on a static var to keep track of malloced alloca
blocks. At first I thought it won't work in presence of
threads but I guess if you used thread local storage for this,
alloca() might be made to work but it is pretty bletcherous!
Here's what Gwyn had to say about alloca() later.... [From
https://www.securecoding.cert.org/confluence/display/seccode/08.+Memory+Management+(MEM)
Douglas A. Gwyn
Never use alloca. (See my comments in the Gnu source for
alloca.) Under C99, you can use VLAs. Cince they require
a FIFO lifetime model, neither is as general as dynamic
allocation.
Funny that he recommends using VLAs instead of alloca()!
next prev parent reply other threads:[~2012-01-16 23:18 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-16 12:30 Alexander Kapshuk
2012-01-16 13:08 ` Charles Forsyth
2012-01-16 13:27 ` Alexander Kapshuk
2012-01-16 15:41 ` Bakul Shah
2012-01-16 18:51 ` Comeau At9Fans
2012-01-16 19:03 ` Bakul Shah
2012-01-16 19:39 ` Charles Forsyth
2012-01-17 19:27 ` Comeau At9Fans
[not found] ` <CAOw7k5iYxoVUHYYxf1Dg9ESWwTon_aGFxhNkuyUGbkXwiKO9DA@mail.gmail.c>
2012-01-16 19:49 ` erik quanstrom
2012-01-17 19:29 ` Comeau At9Fans
2012-01-16 20:11 ` Joel C. Salomon
2012-01-16 23:18 ` Bakul Shah [this message]
2012-01-17 19:31 ` Comeau At9Fans
2012-01-17 19:21 ` Comeau At9Fans
2012-01-18 17:48 ` Bakul Shah
2012-01-18 18:32 ` Comeau At9Fans
2012-01-16 16:07 ` Joel C. Salomon
2012-01-16 16:27 ` erik quanstrom
2012-01-16 16:40 ` Charles Forsyth
2012-01-16 16:54 ` Bakul Shah
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120116231858.5B7891CC32@mail.bitblocks.com \
--to=bakul@bitblocks.com \
--cc=9fans@9fans.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).