code gen can generate code to keep alive stack roots

This commit is contained in:
Araq 2011-12-22 15:04:00 +01:00
commit cd83cc81aa
12 changed files with 125 additions and 44 deletions

View file

@ -16,6 +16,7 @@ __GNUC__
__DMC__
__POCC__
__TINYC__
__clang__
*/
@ -437,4 +438,11 @@ __declspec(naked) int __fastcall NimXadd(volatile int* pNum, int val) {
# define unlikely(x) (x)
#endif
#if defined(__GNUC__) || defined(__clang__)
static inline void GCGuard (void *ptr) { asm volatile ("" :: "X" (ptr)); }
# define GC_GUARD __attribute__ ((cleanup(GCGuard)))
#else
# define GC_GUARD
#endif
#endif