5 #if defined(__i386) && defined(__GNUC__)
6 #define SET_MACHINE_STACK_END(p) __asm__("mov %%esp, %0" : "=r" (*p))
8 NOINLINE(void rb_gc_set_stack_end(VALUE
**stack_end_p
));
9 #define SET_MACHINE_STACK_END(p) rb_gc_set_stack_end(p)
10 #define USE_CONSERVATIVE_STACK_END
15 #ifndef RUBY_MARK_FREE_DEBUG
16 #define RUBY_MARK_FREE_DEBUG 0
19 #if RUBY_MARK_FREE_DEBUG
20 extern int ruby_gc_debug_indent
;
23 rb_gc_debug_indent(void)
25 printf("%*s", ruby_gc_debug_indent
, "");
29 rb_gc_debug_body(char *mode
, char *msg
, int st
, void *ptr
)
32 ruby_gc_debug_indent
--;
35 printf("%s: %s %s (%p)\n", mode
, st
? "->" : "<-", msg
, ptr
);
38 ruby_gc_debug_indent
++;
44 #define RUBY_MARK_ENTER(msg) rb_gc_debug_body("mark", msg, 1, ptr)
45 #define RUBY_MARK_LEAVE(msg) rb_gc_debug_body("mark", msg, 0, ptr)
46 #define RUBY_FREE_ENTER(msg) rb_gc_debug_body("free", msg, 1, ptr)
47 #define RUBY_FREE_LEAVE(msg) rb_gc_debug_body("free", msg, 0, ptr)
48 #define RUBY_GC_INFO rb_gc_debug_indent(); printf
51 #define RUBY_MARK_ENTER(msg)
52 #define RUBY_MARK_LEAVE(msg)
53 #define RUBY_FREE_ENTER(msg)
54 #define RUBY_FREE_LEAVE(msg)
55 #define RUBY_GC_INFO if(0)printf
58 #define RUBY_MARK_UNLESS_NULL(ptr) if(RTEST(ptr)){rb_gc_mark(ptr);}
59 #define RUBY_FREE_UNLESS_NULL(ptr) if(ptr){ruby_xfree(ptr);}
61 #if STACK_GROW_DIRECTION > 0
62 # define STACK_UPPER(x, a, b) a
63 #elif STACK_GROW_DIRECTION < 0
64 # define STACK_UPPER(x, a, b) b
66 RUBY_EXTERN
int ruby_stack_grow_direction
;
67 int ruby_get_stack_grow_direction(VALUE
*addr
);
68 # define stack_growup_p(x) ( \
69 (ruby_stack_grow_direction ? \
70 ruby_stack_grow_direction : \
71 ruby_get_stack_grow_direction(x)) > 0)
72 # define STACK_UPPER(x, a, b) (stack_growup_p(x) ? a : b)
75 #endif /* RUBY_GC_H */