diff options
author | Samuel Williams <samuel.williams@oriontransfer.co.nz> | 2019-06-20 15:30:29 +1200 |
---|---|---|
committer | Samuel Williams <samuel.williams@oriontransfer.co.nz> | 2019-06-20 15:30:29 +1200 |
commit | c26c51449461e3c8ee9bb4e1800933fb3d3caf67 (patch) | |
tree | ec9566fe256fc77cbaf4d1cf685fccafb8fadd0a /thread.c | |
parent | 7d9d1ed463323fe28f24d0b94212c2cb7ad109bd (diff) | |
download | bundler-c26c51449461e3c8ee9bb4e1800933fb3d3caf67.tar.gz |
Revert failed attempt at fixing invalid usage of vm_stack.
Diffstat (limited to 'thread.c')
-rw-r--r-- | thread.c | 17 |
1 files changed, 4 insertions, 13 deletions
@@ -596,11 +596,7 @@ thread_cleanup_func_before_exec(void *th_ptr) { rb_thread_t *th = th_ptr; th->status = THREAD_KILLED; - // The thread stack doesn't exist in the forked process: th->ec->machine.stack_start = th->ec->machine.stack_end = NULL; - - // The vm_stack is `alloca`ed on the thread stack, so it's gone too: - rb_ec_clear_vm_stack(th->ec); } static void @@ -717,19 +713,19 @@ thread_start_func_2(rb_thread_t *th, VALUE *stack_start) rb_bug("thread_start_func_2 must not be used for main thread"); } - thread_debug("thread start: %p\n", (void *)th); - VM_ASSERT((size * sizeof(VALUE)) <= th->ec->machine.stack_maxsize); - vm_stack = alloca(size * sizeof(VALUE)); VM_ASSERT(vm_stack); gvl_acquire(th->vm, th); rb_ec_initialize_vm_stack(th->ec, vm_stack, size); + + ruby_thread_set_native(th); + th->ec->machine.stack_start = STACK_DIR_UPPER(vm_stack + size, vm_stack); th->ec->machine.stack_maxsize -= size * sizeof(VALUE); - ruby_thread_set_native(th); + thread_debug("thread start: %p\n", (void *)th); { thread_debug("thread start (get lock): %p\n", (void *)th); @@ -810,11 +806,7 @@ thread_start_func_2(rb_thread_t *th, VALUE *stack_start) rb_fiber_close(th->ec->fiber_ptr); } - thread_cleanup_func(th, FALSE); - VM_ASSERT(th->ec->vm_stack == NULL); - VM_ASSERT(th->ec->cfp == NULL); - gvl_release(th->vm); return 0; @@ -2261,7 +2253,6 @@ rb_threadptr_execute_interrupts(rb_thread_t *th, int blocking_timing) if (th->status == THREAD_RUNNABLE) th->running_time_us += TIME_QUANTUM_USEC; - VM_ASSERT(th->ec->cfp); EXEC_EVENT_HOOK(th->ec, RUBY_INTERNAL_EVENT_SWITCH, th->ec->cfp->self, 0, 0, 0, Qundef); |