8000 Update `stack_start` and `stack_maxsize` according to stack direction. · ruby/ruby@e40f745 · GitHub
[go: up one dir, main page]

Skip to content

Commit e40f745

Browse files
committed
Update stack_start and stack_maxsize according to stack direction.
1 parent a096d94 commit e40f745

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

thread.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,7 @@ rb_vm_push_frame(rb_execution_context_t *sec,
715715
static int
716716
thread_start_func_2(rb_thread_t *th, VALUE *stack_start, VALUE *register_stack_start)
717717
{
718+
STACK_GROW_DIR_DETECTION;
718719
enum ruby_tag_type state;
719720
rb_thread_list_t *join_list;
720721
rb_thread_t *main_th;
@@ -740,8 +741,8 @@ thread_start_func_2(rb_thread_t *th, VALUE *stack_start, VALUE *register_stack_s
740741

741742
ruby_thread_set_native(th);
742743

743-
th->ec->machine.stack_start = vm_stack;
744-
th->ec->machine.stack_maxsize = th->ec->machine.stack_end - th->ec->machine.stack_start;
744+
th->ec->machine.stack_start = STACK_DIR_UPPER(vm_stack + size, vm_stack);
745+
th->ec->machine.stack_maxsize -= size * sizeof(VALUE);
745746
#ifdef __ia64
746747
th->ec->machine.register_stack_start = register_stack_start;
747748
#endif

0 commit comments

Comments
 (0)
0