5 #if defined(__x86_64__) && !defined(_ILP32) && defined(__GNUC__) && !defined(__native_client__) 6 #define SET_MACHINE_STACK_END(p) __asm__ __volatile__ ("movq\t%%rsp, %0" : "=r" (*(p))) 7 #elif defined(__i386) && defined(__GNUC__) && !defined(__native_client__) 8 #define SET_MACHINE_STACK_END(p) __asm__ __volatile__ ("movl\t%%esp, %0" : "=r" (*(p))) 11 #define SET_MACHINE_STACK_END(p) rb_gc_set_stack_end(p) 12 #define USE_CONSERVATIVE_STACK_END 17 #ifndef RUBY_MARK_FREE_DEBUG 18 #define RUBY_MARK_FREE_DEBUG 0 21 #if RUBY_MARK_FREE_DEBUG 25 rb_gc_debug_indent(
void)
27 printf(
"%*s", ruby_gc_debug_indent,
"");
31 rb_gc_debug_body(
const char *mode,
const char *msg,
int st,
void *ptr)
34 ruby_gc_debug_indent--;
37 printf(
"%s: %s %s (%p)\n", mode, st ?
"->" :
"<-", msg, ptr);
40 ruby_gc_debug_indent++;
46 #define RUBY_MARK_ENTER(msg) rb_gc_debug_body("mark", (msg), 1, ptr) 47 #define RUBY_MARK_LEAVE(msg) rb_gc_debug_body("mark", (msg), 0, ptr) 48 #define RUBY_FREE_ENTER(msg) rb_gc_debug_body("free", (msg), 1, ptr) 49 #define RUBY_FREE_LEAVE(msg) rb_gc_debug_body("free", (msg), 0, ptr) 50 #define RUBY_GC_INFO rb_gc_debug_indent(); printf 53 #define RUBY_MARK_ENTER(msg) 54 #define RUBY_MARK_LEAVE(msg) 55 #define RUBY_FREE_ENTER(msg) 56 #define RUBY_FREE_LEAVE(msg) 57 #define RUBY_GC_INFO if(0)printf 60 #define RUBY_MARK_UNLESS_NULL(ptr) do { \ 61 VALUE markobj = (ptr); \ 62 if (RTEST(markobj)) {rb_gc_mark(markobj);} \ 64 #define RUBY_FREE_UNLESS_NULL(ptr) if(ptr){ruby_xfree(ptr);(ptr)=NULL;} 66 #if STACK_GROW_DIRECTION > 0 67 # define STACK_UPPER(x, a, b) (a) 68 #elif STACK_GROW_DIRECTION < 0 69 # define STACK_UPPER(x, a, b) (b) 73 # define stack_growup_p(x) ( \ 74 (ruby_stack_grow_direction ? \ 75 ruby_stack_grow_direction : \ 76 ruby_get_stack_grow_direction(x)) > 0) 77 # define STACK_UPPER(x, a, b) (stack_growup_p(x) ? (a) : (b)) 80 #if STACK_GROW_DIRECTION 81 #define STACK_GROW_DIR_DETECTION 82 #define STACK_DIR_UPPER(a,b) STACK_UPPER(0, (a), (b)) 84 #define STACK_GROW_DIR_DETECTION VALUE stack_grow_dir_detection 85 #define STACK_DIR_UPPER(a,b) STACK_UPPER(&stack_grow_dir_detection, (a), (b)) 87 #define IS_STACK_DIR_UPPER() STACK_DIR_UPPER(1,0) 108 int (*callback)(
void *start,
void *end,
size_t stride,
void *data),
112 int (*callback)(
void *,
void *,
size_t,
void *),
void rb_objspace_each_objects_without_setup(int(*callback)(void *, void *, size_t, void *), void *data)
int ruby_get_stack_grow_direction(volatile VALUE *addr)
void rb_obj_info_dump(VALUE obj)
NOINLINE(void rb_gc_set_stack_end(VALUE **stack_end_p))
int rb_objspace_garbage_object_p(VALUE obj)
void rb_objspace_reachable_objects_from_root(void(func)(const char *category, VALUE, void *), void *data)
const char * rb_obj_info(VALUE obj)
RUBY_EXTERN int ruby_stack_grow_direction
#define RUBY_SYMBOL_EXPORT_END
int rb_threadptr_during_gc(struct rb_thread_struct *th)
#define RUBY_SYMBOL_EXPORT_BEGIN
const char * rb_raw_obj_info(char *buff, const int buff_size, VALUE obj)
void rb_gc_set_stack_end(VALUE **stack_end_p)
RUBY_SYMBOL_EXPORT_BEGIN size_t rb_objspace_data_type_memsize(VALUE obj)
void rb_objspace_each_objects(int(*callback)(void *start, void *end, size_t stride, void *data), void *data)
int rb_objspace_internal_object_p(VALUE obj)
int rb_objspace_markable_object_p(VALUE obj)
void rb_objspace_reachable_objects_from(VALUE obj, void(func)(VALUE, void *), void *data)
int rb_objspace_marked_object_p(VALUE obj)