ruby-changes:20884
From: kosaki <ko1@a...>
Date: Thu, 11 Aug 2011 21:28:53 +0900 (JST)
Subject: [ruby-changes:20884] kosaki:r32933 (ruby_1_9_3): * backport r32815 from trunk.
kosaki 2011-08-11 21:28:41 +0900 (Thu, 11 Aug 2011) New Revision: 32933 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=32933 Log: * backport r32815 from trunk. * gc.c (init_heap): allocate sigaltstack after heaps are allocated. [ruby-dev:44315] [Bug #5139] * vm.c (thread_free): use free because objspace is not ready. * vm.c (th_init): use malloc because objspace is not ready. Modified files: branches/ruby_1_9_3/ChangeLog branches/ruby_1_9_3/gc.c branches/ruby_1_9_3/vm.c Index: ruby_1_9_3/ChangeLog =================================================================== --- ruby_1_9_3/ChangeLog (revision 32932) +++ ruby_1_9_3/ChangeLog (revision 32933) @@ -1,3 +1,14 @@ +Tue Aug 2 22:04:46 2011 NARUSE, Yui <naruse@r...> + + * backport r32815 from trunk. + + * gc.c (init_heap): allocate sigaltstack after heaps are allocated. + [ruby-dev:44315] [Bug #5139] + + * vm.c (thread_free): use free because objspace is not ready. + + * vm.c (th_init): use malloc because objspace is not ready. + Thu Aug 11 19:04:38 2011 Hiroshi Nakamura <nahi@r...> * backport r32931 from trunk. Index: ruby_1_9_3/gc.c =================================================================== --- ruby_1_9_3/gc.c (revision 32932) +++ ruby_1_9_3/gc.c (revision 32933) @@ -1085,6 +1085,14 @@ init_heap(rb_objspace_t *objspace) { add_heap_slots(objspace, HEAP_MIN_SLOTS / HEAP_OBJ_LIMIT); +#ifdef USE_SIGALTSTACK + { + /* altstack of another threads are allocated in another place */ + rb_thread_t *th = GET_THREAD(); + free(th->altstack); /* free previously allocated area */ + th->altstack = xmalloc(ALT_STACK_SIZE); + } +#endif heaps_inc = 0; objspace->profile.invoke_time = getrusage_time(); Index: ruby_1_9_3/vm.c =================================================================== --- ruby_1_9_3/vm.c (revision 32932) +++ ruby_1_9_3/vm.c (revision 32933) @@ -1761,7 +1761,7 @@ else { #ifdef USE_SIGALTSTACK if (th->altstack) { - xfree(th->altstack); + free(th->altstack); } #endif ruby_xfree(ptr); @@ -1834,7 +1834,8 @@ /* allocate thread stack */ #ifdef USE_SIGALTSTACK - th->altstack = xmalloc(ALT_STACK_SIZE); + /* altstack of main thread is reallocated in another place */ + th->altstack = malloc(ALT_STACK_SIZE); #endif th->stack_size = RUBY_VM_THREAD_STACK_SIZE; th->stack = thread_recycle_stack(th->stack_size); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/