[tremor] solution to alloca() on platfomrs that dont support it

bobbydigi at btinternet.com bobbydigi at btinternet.com
Tue Oct 15 02:21:06 PDT 2002



Hi,

from reading this, 
 http://compilers.iecc.com/comparch/article/91-12-079

, Doug Gwyn's version will severly effect the performance of tremor as it doesnt allocate from the stack and will incur large memory penaltys, "Cleanup (freeing) can be delayed long enough that the memory
demands are huge, as large as all storage ever alloca()'d." eek!

While I can definatly see the case for a performance boost using this method, I think on platforms that dont have alloca() it's going to be problematic (i've used a lot of dsp sdk's that have very limited library support) and many people will probably end up either hacking the source to use malloc() or writing their own versions.

I suggest then that either a standard implementation of an alloca-type function is developed for tremor, or that as suggested in the above article, the bullet is bitten and the al_enter(), al_free(), and
al_exit() calls are used to delimit regions of usage.

this would allow us to define these functions as inlines doing nothing on platforms that had alloca and leave the current behaviour unchanged, but also allow us to either write an efficient alloca replacement as part of tremor (if this is desirable) or to leave these as callbacks for the implementor to fill in. we could also #define out the al_enter(),  al_exit() and al_free() calls if we're paranoid about overhead from empty inlined functions (although that's admittedly horrible)

if this all sounds like mad rambling then just tell me, but i think that as there seems to be no standard definition of alloca() and as it's also platform and compiler dependent, we should consider alternatives.

rob

ps. sorry about not staring a new thread Segher, i'd installed a new mail client and was having probelms ;)

>  from:    Segher Boessenkool <segher at koffie.nl>
>  date:    Tue, 15 Oct 2002 01:14:43
>  to:      tremor at xiph.org
>  subject: Re: [tremor] good version of alloca()
> 
> robert anderberg wrote:
> > 
> > hi,
> > 
> > can anyone point me at a decent version of alloca() as i dont have it on my dev system (ARM SDT).
> 
> 
> Try Doug Gwyn's portable alloca.  And please start a new thread if asking something
> wholly unrelated, don't just reply to another message.  Thank you.
> 
> 
> Segher
> --- >8 ----
> List archives:  http://www.xiph.org/archives/
> Ogg project homepage: http://www.xiph.org/ogg/
> To unsubscribe from this list, send a message to 'tremor-request at xiph.org'
> containing only the word 'unsubscribe' in the body.  No subject is needed.
> Unsubscribe messages sent to the list will be ignored/filtered.

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'tremor-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the Tremor mailing list