diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-06-14 02:59:19 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-06-14 02:59:19 +0000 |
commit | fc3c60f6081d85f6274986a7a08b59db1515fcb5 (patch) | |
tree | 5b7e96855783c55294b0a9824a598b9b269a991d /gc.h | |
parent | 436b02b3322d6809c2bf4cbadbe8b324a53e07e4 (diff) |
* gc.h (STACK_UPPER): moved from gc.c
* thread.c, thread_{pthread,win32}.c (ruby_init_stack,
ruby_thread_init_stack): moved stack initialization from gc.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.h')
-rw-r--r-- | gc.h | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -57,5 +57,19 @@ rb_gc_debug_body(char *mode, char *msg, int st, void *ptr) #define RUBY_MARK_UNLESS_NULL(ptr) if(RTEST(ptr)){rb_gc_mark(ptr);} #define RUBY_FREE_UNLESS_NULL(ptr) if(ptr){ruby_xfree(ptr);} -#endif /* RUBY_GC_H */ +#if STACK_GROW_DIRECTION > 0 +# define STACK_UPPER(x, a, b) a +#elif STACK_GROW_DIRECTION < 0 +# define STACK_UPPER(x, a, b) b +#else +RUBY_EXTERN int ruby_stack_grow_direction; +int ruby_get_stack_grow_direction(VALUE *addr); +# define stack_growup_p(x) ( \ + (ruby_stack_grow_direction ? \ + ruby_stack_grow_direction : \ + ruby_get_stack_grow_direction(x)) > 0) +# define STACK_UPPER(x, a, b) (stack_growup_p(x) ? a : b) +#endif + +#endif /* RUBY_GC_H */ |