ruby-changes:42199
From: usa <ko1@a...>
Date: Fri, 25 Mar 2016 18:08:08 +0900 (JST)
Subject: [ruby-changes:42199] usa:r54273 (ruby_2_1): merge revision(s) 46373: [Backport #9905]
usa 2016-03-25 18:08:03 +0900 (Fri, 25 Mar 2016) New Revision: 54273 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54273 Log: merge revision(s) 46373: [Backport #9905] * cont.c (rb_fiber_struct): keep context.uc_stack.ss_sp and context.uc_stack.ss_size for later use. Patch by Rei Odaira. [ruby-core:62945] [Bug #9905] Modified directories: branches/ruby_2_1/ Modified files: branches/ruby_2_1/ChangeLog branches/ruby_2_1/cont.c branches/ruby_2_1/version.h Index: ruby_2_1/version.h =================================================================== --- ruby_2_1/version.h (revision 54272) +++ ruby_2_1/version.h (revision 54273) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1 #define RUBY_VERSION "2.1.9" #define RUBY_RELEASE_DATE "2016-03-25" -#define RUBY_PATCHLEVEL 470 +#define RUBY_PATCHLEVEL 471 #define RUBY_RELEASE_YEAR 2016 #define RUBY_RELEASE_MONTH 3 Index: ruby_2_1/cont.c =================================================================== --- ruby_2_1/cont.c (revision 54272) +++ ruby_2_1/cont.c (revision 54273) @@ -147,6 +147,12 @@ typedef struct rb_fiber_struct { https://github.com/ruby/ruby/blob/trunk/ruby_2_1/cont.c#L147 void *fib_handle; #else ucontext_t context; + /* Because context.uc_stack.ss_sp and context.uc_stack.ss_size + * are not necessarily valid after makecontext() or swapcontext(), + * they are saved in these variables for later use. + */ + void *ss_sp; + size_t ss_size; #endif #endif } rb_fiber_t; @@ -243,11 +249,11 @@ cont_free(void *ptr) https://github.com/ruby/ruby/blob/trunk/ruby_2_1/cont.c#L249 #else /* not WIN32 */ if (GET_THREAD()->fiber != cont->self) { rb_fiber_t *fib = (rb_fiber_t*)cont; - if (fib->context.uc_stack.ss_sp) { + if (fib->ss_sp) { if (cont->type == ROOT_FIBER_CONTEXT) { rb_bug("Illegal root fiber parameter"); } - munmap((void*)fib->context.uc_stack.ss_sp, fib->context.uc_stack.ss_size); + munmap((void*)fib->ss_sp, fib->ss_size); } } else { @@ -667,6 +673,8 @@ fiber_initialize_machine_stack_context(r https://github.com/ruby/ruby/blob/trunk/ruby_2_1/cont.c#L673 context->uc_link = NULL; context->uc_stack.ss_sp = ptr; context->uc_stack.ss_size = size; + fib->ss_sp = ptr; + fib->ss_size = size; makecontext(context, rb_fiber_start, 0); sth->machine.stack_start = (VALUE*)(ptr + STACK_DIR_UPPER(0, size)); sth->machine.stack_maxsize = size - RB_PAGE_SIZE; @@ -1257,8 +1265,9 @@ rb_fiber_terminate(rb_fiber_t *fib) https://github.com/ruby/ruby/blob/trunk/ruby_2_1/cont.c#L1265 fib->status = TERMINATED; #if FIBER_USE_NATIVE && !defined(_WIN32) /* Ruby must not switch to other thread until storing terminated_machine_stack */ - terminated_machine_stack.ptr = fib->context.uc_stack.ss_sp; - terminated_machine_stack.size = fib->context.uc_stack.ss_size / sizeof(VALUE); + 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; Index: ruby_2_1/ChangeLog =================================================================== --- ruby_2_1/ChangeLog (revision 54272) +++ ruby_2_1/ChangeLog (revision 54273) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1 +Fri Mar 25 18:07:48 2016 Yutaka Kanemoto <kanemoto@r...> + + * cont.c (rb_fiber_struct): keep context.uc_stack.ss_sp and context.uc_stack.ss_size + for later use. Patch by Rei Odaira. [ruby-core:62945] [Bug #9905] + Fri Mar 25 17:52:46 2016 Tanaka Akira <akr@f...> * test/openssl/utils.rb (start_server, server_loop): Use a Property changes on: ruby_2_1 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r46373 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/