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 mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/tinycc-devel