diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-05-07 06:59:55 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-05-07 06:59:55 +0000 |
commit | 8da1219d459a5d42c2814a1c50c451e3a2f5b63f (patch) | |
tree | 18c2bdbf896a19bd19ab1327271434c2c4b84bb1 | |
parent | fb2acec9439a023396cca3245d4dabb12a78f1da (diff) | |
download | ruby-8da1219d459a5d42c2814a1c50c451e3a2f5b63f.tar.gz |
cont.c: machine stack cache condition
* cont.c (fiber_store, rb_fiber_terminate): separate the condition
to cache machine stacks, which is not directly restricted to the
platforms, and may be used on Windows too in the future.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63344 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | cont.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -1600,12 +1600,10 @@ fiber_store(rb_fiber_t *next_fib, rb_thread_t *th) #if FIBER_USE_NATIVE fiber_setcontext(next_fib, fib); /* restored */ -#ifndef _WIN32 +#ifdef MAX_MACHINE_STACK_CACHE if (terminated_machine_stack.ptr) { if (machine_stack_cache_index < MAX_MACHINE_STACK_CACHE) { - machine_stack_cache[machine_stack_cache_index].ptr = terminated_machine_stack.ptr; - machine_stack_cache[machine_stack_cache_index].size = terminated_machine_stack.size; - machine_stack_cache_index++; + machine_stack_cache[machine_stack_cache_index++] = terminated_machine_stack; } else { if (terminated_machine_stack.ptr != fib->cont.machine.stack) { @@ -1743,11 +1741,13 @@ rb_fiber_terminate(rb_fiber_t *fib, int need_interrupt) rb_fiber_close(fib); #if FIBER_USE_NATIVE && !defined(_WIN32) + fib->context.uc_stack.ss_sp = NULL; +#endif +#ifdef MAX_MACHINE_STACK_CACHE /* Ruby must not switch to other thread until storing terminated_machine_stack */ terminated_machine_stack.ptr = fib->ss_sp; terminated_machine_stack.size = fib->ss_size / sizeof(VALUE); fib->ss_sp = NULL; - fib->context.uc_stack.ss_sp = NULL; fib->cont.machine.stack = NULL; fib->cont.machine.stack_size = 0; #endif |