diff options
author | Araq <rumpf_a@web.de> | 2011-12-22 15:04:00 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2011-12-22 15:04:00 +0100 |
commit | cd83cc81aa58922e0a8370ae5928d5b5aaa16f84 (patch) | |
tree | e3abff5b7a2cd46977e8435a4ebbfdde0c19ba07 /lib/nimbase.h | |
parent | f19c1c0f6e93a561dc13ef57d136957edeba9ed4 (diff) | |
download | Nim-cd83cc81aa58922e0a8370ae5928d5b5aaa16f84.tar.gz |
code gen can generate code to keep alive stack roots
Diffstat (limited to 'lib/nimbase.h')
-rwxr-xr-x | lib/nimbase.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/nimbase.h b/lib/nimbase.h index bc8c3c28c..e2afed8f9 100755 --- a/lib/nimbase.h +++ b/lib/nimbase.h @@ -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 |