aboutsummaryrefslogtreecommitdiffstats
path: root/gc.h
diff options
context:
space:
mode:
authorSamuel Williams <samuel.williams@oriontransfer.co.nz>2019-06-03 21:35:03 +1200
committerSamuel Williams <samuel.williams@oriontransfer.co.nz>2019-07-12 11:56:51 +1200
commita2adcd40df96acd1218cc60dc1810e83dbc124d8 (patch)
treead4235c8ea1fee82012b2fc59ecebd0824c480b8 /gc.h
parent5c8061a9e2a34df975846d724273cb5be7d74a7c (diff)
downloadruby-a2adcd40df96acd1218cc60dc1810e83dbc124d8.tar.gz
Add note about `STACK_GROW_DIR_DETECTION`.
Diffstat (limited to 'gc.h')
-rw-r--r--gc.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/gc.h b/gc.h
index f3b433f0c4..07c08577e8 100644
--- a/gc.h
+++ b/gc.h
@@ -81,6 +81,14 @@ int ruby_get_stack_grow_direction(volatile VALUE *addr);
# define STACK_UPPER(x, a, b) (stack_growup_p(x) ? (a) : (b))
#endif
+/*
+ STACK_GROW_DIR_DETECTION is used with STACK_DIR_UPPER.
+
+ On most normal systems, stacks grow from high address to lower address. In
+ this case, STACK_DIR_UPPER(a, b) will return (b), but on exotic systems where
+ the stack grows UP (from low address to high address), it will return (a).
+*/
+
#if STACK_GROW_DIRECTION
#define STACK_GROW_DIR_DETECTION
#define STACK_DIR_UPPER(a,b) STACK_UPPER(0, (a), (b))