1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32815 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2011-08-02 13:08:45 +00:00
parent 2cf05e5879
commit 027a15e958
3 changed files with 20 additions and 2 deletions

View file

@ -1,3 +1,12 @@
Tue Aug 2 22:04:46 2011 NARUSE, Yui <naruse@ruby-lang.org>
* 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.
Tue Aug 2 20:10:16 2011 Shota Fukumori <sorah@tubusu.net> Tue Aug 2 20:10:16 2011 Shota Fukumori <sorah@tubusu.net>
* test/testunit/test_parallel.rb: pass "--ruby" option to * test/testunit/test_parallel.rb: pass "--ruby" option to

8
gc.c
View file

@ -1085,6 +1085,14 @@ static void
init_heap(rb_objspace_t *objspace) init_heap(rb_objspace_t *objspace)
{ {
add_heap_slots(objspace, HEAP_MIN_SLOTS / HEAP_OBJ_LIMIT); 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; heaps_inc = 0;
objspace->profile.invoke_time = getrusage_time(); objspace->profile.invoke_time = getrusage_time();

5
vm.c
View file

@ -1755,7 +1755,7 @@ thread_free(void *ptr)
else { else {
#ifdef USE_SIGALTSTACK #ifdef USE_SIGALTSTACK
if (th->altstack) { if (th->altstack) {
xfree(th->altstack); free(th->altstack);
} }
#endif #endif
ruby_xfree(ptr); ruby_xfree(ptr);
@ -1828,7 +1828,8 @@ th_init(rb_thread_t *th, VALUE self)
/* allocate thread stack */ /* allocate thread stack */
#ifdef USE_SIGALTSTACK #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 #endif
th->stack_size = RUBY_VM_THREAD_STACK_SIZE; th->stack_size = RUBY_VM_THREAD_STACK_SIZE;
th->stack = thread_recycle_stack(th->stack_size); th->stack = thread_recycle_stack(th->stack_size);