summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-06-28 03:29:00 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-06-28 03:29:00 +0000
commite5a9dcb9d8863fc2ad44c4f85a10a95329e3c154 (patch)
treee3fcc29316c79f8df372319c472d4875271d0f8e /eval.c
parent057dcc0495e9f6e85c322bf294dd03dde3899de7 (diff)
* configure.in (rb_cv_stack_grow_dir): check stack growing direction.
* eval.c (rb_thread_restore_context): prior configuration macro. * gc.c (ruby_stack_length): always return the address of lower edge. * gc.c (rb_gc_mark_locations): remove margin. [ruby-dev:20462] * gc.c (rb_gc, Init_stack): prior configuration macro. * gc.c (Init_stack): add safety margin. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4012 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/eval.c b/eval.c
index 0468d37..272d2f7 100644
--- a/eval.c
+++ b/eval.c
@@ -8112,8 +8112,7 @@ rb_thread_save_context(th)
len = ruby_stack_length(&pos);
th->stk_len = 0;
- th->stk_pos = (rb_gc_stack_start<pos)?rb_gc_stack_start
- :rb_gc_stack_start - len;
+ th->stk_pos = pos;
if (len > th->stk_max) {
REALLOC_N(th->stk_ptr, VALUE, len);
th->stk_max = len;
@@ -8211,6 +8210,11 @@ rb_thread_restore_context(th, exit)
if (!th->stk_ptr) rb_bug("unsaved context");
+#if STACK_GROW_DIRECTION < 0
+ if (&v > th->stk_pos) stack_extend(th, exit);
+#elif STACK_GROW_DIRECTION > 0
+ if (&v < th->stk_pos + th->stk_len) stack_extend(th, exit);
+#else
if (&v < rb_gc_stack_start) {
/* Stack grows downward */
if (&v > th->stk_pos) stack_extend(th, exit);
@@ -8219,6 +8223,7 @@ rb_thread_restore_context(th, exit)
/* Stack grows upward */
if (&v < th->stk_pos + th->stk_len) stack_extend(th, exit);
}
+#endif
rb_trap_immediate = 0; /* inhibit interrupts from here */
ruby_frame = th->frame;