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

ruby-changes:13899

From: akr <ko1@a...>
Date: Mon, 9 Nov 2009 20:18:35 +0900 (JST)
Subject: [ruby-changes:13899] Ruby:r25701 (trunk): * thread.c (rb_gc_save_machine_context): don't save the stack pointer

akr	2009-11-09 20:18:17 +0900 (Mon, 09 Nov 2009)

  New Revision: 25701

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

  Log:
    * thread.c (rb_gc_save_machine_context): don't save the stack pointer
      in this function.
      (RB_GC_SAVE_MACHINE_CONTEXT): call rb_gc_save_machine_context and
      save the stack pointer at caller side.
      (rb_thread_schedule_rec): use RB_GC_SAVE_MACHINE_CONTEXT instead of
      rb_gc_save_machine_context.
      (blocking_region_begin): changed to a macro.  use
      RB_GC_SAVE_MACHINE_CONTEXT instead of rb_gc_save_machine_context.
      [ruby-dev:39659]

  Modified files:
    trunk/ChangeLog
    trunk/thread.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 25700)
+++ ChangeLog	(revision 25701)
@@ -1,3 +1,15 @@
+Mon Nov  9 20:15:16 2009  Tanaka Akira  <akr@f...>
+
+	* thread.c (rb_gc_save_machine_context): don't save the stack pointer
+	  in this function.
+	  (RB_GC_SAVE_MACHINE_CONTEXT): call rb_gc_save_machine_context and
+	  save the stack pointer at caller side.
+	  (rb_thread_schedule_rec): use RB_GC_SAVE_MACHINE_CONTEXT instead of
+	  rb_gc_save_machine_context.
+	  (blocking_region_begin): changed to a macro.  use
+	  RB_GC_SAVE_MACHINE_CONTEXT instead of rb_gc_save_machine_context.
+	  [ruby-dev:39659]
+
 Mon Nov  9 11:28:29 2009  Nobuyoshi Nakada  <nobu@r...>
 
 	* configure.in (warnflags): add -Wno-long-long.
Index: thread.c
===================================================================
--- thread.c	(revision 25700)
+++ thread.c	(revision 25701)
@@ -97,13 +97,17 @@
 				 struct rb_unblock_callback *old);
 static void reset_unblock_function(rb_thread_t *th, const struct rb_unblock_callback *old);
 
-static inline void blocking_region_begin(rb_thread_t *th, struct rb_blocking_region_buffer *region,
-					 rb_unblock_function_t *func, void *arg);
 static inline void blocking_region_end(rb_thread_t *th, struct rb_blocking_region_buffer *region);
 
+#define RB_GC_SAVE_MACHINE_CONTEXT(th) \
+  do { \
+    rb_gc_save_machine_context(th); \
+    SET_MACHINE_STACK_END(&(th)->machine_stack_end); \
+  } while (0)
+
 #define GVL_UNLOCK_BEGIN() do { \
   rb_thread_t *_th_stored = GET_THREAD(); \
-  rb_gc_save_machine_context(_th_stored); \
+  RB_GC_SAVE_MACHINE_CONTEXT(_th_stored); \
   native_mutex_unlock(&_th_stored->vm->global_vm_lock)
 
 #define GVL_UNLOCK_END() \
@@ -960,7 +964,7 @@
 
 	thread_debug("rb_thread_schedule/switch start\n");
 
-	rb_gc_save_machine_context(th);
+	RB_GC_SAVE_MACHINE_CONTEXT(th);
 	native_mutex_unlock(&th->vm->global_vm_lock);
 	{
 	    native_thread_yield();
@@ -983,18 +987,16 @@
 }
 
 /* blocking region */
-static inline void
-blocking_region_begin(rb_thread_t *th, struct rb_blocking_region_buffer *region,
-		      rb_unblock_function_t *func, void *arg)
-{
-    region->prev_status = th->status;
-    th->blocking_region_buffer = region;
-    set_unblock_function(th, func, arg, &region->oldubf);
-    th->status = THREAD_STOPPED;
-    thread_debug("enter blocking region (%p)\n", (void *)th);
-    rb_gc_save_machine_context(th);
-    native_mutex_unlock(&th->vm->global_vm_lock);
-}
+#define blocking_region_begin(th, region, func, arg) \
+  do { \
+    (region)->prev_status = (th)->status; \
+    (th)->blocking_region_buffer = (region); \
+    set_unblock_function((th), (func), (arg), &(region)->oldubf); \
+    (th)->status = THREAD_STOPPED; \
+    thread_debug("enter blocking region (%p)\n", (void *)(th)); \
+    RB_GC_SAVE_MACHINE_CONTEXT(th); \
+    native_mutex_unlock(&(th)->vm->global_vm_lock); \
+  } while (0)
 
 static inline void
 blocking_region_end(rb_thread_t *th, struct rb_blocking_region_buffer *region)
@@ -2599,7 +2601,6 @@
 void
 rb_gc_save_machine_context(rb_thread_t *th)
 {
-    SET_MACHINE_STACK_END(&th->machine_stack_end);
     FLUSH_REGISTER_WINDOWS;
 #ifdef __ia64
     th->machine_register_stack_end = rb_ia64_bsp();

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

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