[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Tinycc-devel] inlined alloca()
From: |
Zdenek Pavlas |
Subject: |
[Tinycc-devel] inlined alloca() |
Date: |
Thu, 17 May 2007 18:38:48 +0200 |
User-agent: |
Thunderbird 1.5.0.10 (X11/20070301) |
Hello everybody!
I've seen the recently submitted alloca() code and wondered: Why not use
tcc's inline asm?
- much simpler and probably slightly faster.
- bound checking is still probably broken (no __bound_delete_region
called). I'd rather drop it completely for now.
- alloca(4096+) may have issues on PE target.
What do you think?
--
Zdenek Pavlas
#ifndef ALLOCA_H
#define ALLOCA_H
#ifndef __i386__
# error Sorry, i386 only
#endif
#ifdef __BOUNDS_CHECKING_ON
# define __alloca_pad 1
#else
# define __alloca_pad 0
# define __bound_new_region(ptr, size)
#endif
#define alloca(size) ({ \
void * ptr; \
__asm__("sub %1, %%esp\nmov %%esp, %0" \
: "=g"(ptr) : "g"(((size) + __alloca_pad + 3) & -4)); \
__bound_new_region(ptr, size); \
ptr; })
#endif
- [Tinycc-devel] inlined alloca(),
Zdenek Pavlas <=