Got rid of ASM for runtime pre_gc, post_gc and stack scan

This commit is contained in:
Egor Sheremetov 2023-09-29 19:40:01 +02:00
parent 8b073cbd48
commit b5a0b81d11
5 changed files with 35 additions and 156 deletions

View file

@ -30,23 +30,18 @@ void __post_gc_subst () { }
#endif
/* end */
extern size_t __gc_stack_top, __gc_stack_bottom;
#define PRE_GC() \
bool flag = true; \
if (__gc_stack_top == 0) { flag = false; } \
__pre_gc(); \
bool flag = false; \
flag = __gc_stack_top == 0; \
if (flag) { __gc_stack_top = (size_t)__builtin_frame_address(0); } \
assert(__gc_stack_top != 0); \
assert(__builtin_frame_address(0) <= (void *)__gc_stack_top);
#define POST_GC() \
assert(__builtin_frame_address(0) <= (void *)__gc_stack_top); \
__post_gc(); \
\
if (!flag && __gc_stack_top != 0) { \
fprintf(stderr, "Moving stack???\n"); \
assert(false); \
}
extern size_t __gc_stack_top, __gc_stack_bottom;
if (flag) { __gc_stack_top = 0; }
static void vfailure (char *s, va_list args) {
fprintf(stderr, "*** FAILURE: ");