summaryrefslogtreecommitdiff
path: root/gc.h
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-14 02:59:19 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-14 02:59:19 +0000
commitfc3c60f6081d85f6274986a7a08b59db1515fcb5 (patch)
tree5b7e96855783c55294b0a9824a598b9b269a991d /gc.h
parent436b02b3322d6809c2bf4cbadbe8b324a53e07e4 (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.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/gc.h b/gc.h
index fe2e07ded0..29fd6b407c 100644
--- a/gc.h
+++ b/gc.h
@@ -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 */