[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] alloca for tcc - first cut

From: Rob Landley
Subject: Re: [Tinycc-devel] alloca for tcc - first cut
Date: Tue, 8 May 2007 22:53:19 -0400
User-agent: KMail/1.9.1

On Tuesday 08 May 2007 2:17 am, David A. Wheeler wrote:
> I've attached a first cut implementation of alloca for tcc.  This one
> allocates cleanly straight off the stack - no monkeying with malloc() at
> all.  It currently doesn't actually call the bounds-checking functions,
> though I know in principle what it needs to call.  Runs on Linux; _may_ work
> on Windows, but I suspect that there's some oddities involving page access
> that would need to be accounted for.     

Last I checked, tcc could also produce arm output.  I take it this is going to 
need an arm version of the .S file?  (This goes in... libtcc?)

There's no included change to the makefile to make anything actually use this, 
I take it you just make a .o from the .S, #include the .h and give it a try?  
(I assume this isn't something I should attempt to merge just yet. :)

I'm not convinced increasing the size of the allocation is a plus, other than 
possibly rounding up for alignment reasons.  Otherwise, by that logic every 
char array we declare on the stack should have extra memory allocated.  I 
tend not to assume that people who use my code will be stupid (or more 
accurately, I assume there's nothing useful I can do about it if they are, 
and the best thing I can do is make the results of their stupidity show up as 
promptly and obviously as possible).

Could the extra memory for the bounds checker be guarded with an #ifdef of 
some kind, please?

The man page warns that the broken glibc headers unconditionally #define 
alloca() as __builtin_alloca().  We might as well use that name rather than 
trying to fight the FSF brain damage.

Other than that, it looks good. :)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]