[前][次][番号順一覧][スレッド一覧]

ruby-changes:20767

From: naruse <ko1@a...>
Date: Tue, 2 Aug 2011 22:08:58 +0900 (JST)
Subject: [ruby-changes:20767] naruse:r32815 (trunk): * gc.c (init_heap): allocate sigaltstack after heaps are allocated.

naruse	2011-08-02 22:08:45 +0900 (Tue, 02 Aug 2011)

  New Revision: 32815

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=32815

  Log:
    * 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:
    trunk/ChangeLog
    trunk/gc.c
    trunk/vm.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 32814)
+++ ChangeLog	(revision 32815)
@@ -1,3 +1,12 @@
+Tue Aug  2 22:04:46 2011  NARUSE, Yui  <naruse@r...>
+
+	* 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@t...>
 
 	* test/testunit/test_parallel.rb: pass "--ruby" option to
Index: gc.c
===================================================================
--- gc.c	(revision 32814)
+++ gc.c	(revision 32815)
@@ -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: vm.c
===================================================================
--- vm.c	(revision 32814)
+++ vm.c	(revision 32815)
@@ -1755,7 +1755,7 @@
 	else {
 #ifdef USE_SIGALTSTACK
 	    if (th->altstack) {
-		xfree(th->altstack);
+		free(th->altstack);
 	    }
 #endif
 	    ruby_xfree(ptr);
@@ -1828,7 +1828,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/

[前][次][番号順一覧][スレッド一覧]