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

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


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25701 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2009-11-09 11:18:17 +00:00
parent 54b5ac5663
commit d6f5da84e3
2 changed files with 30 additions and 17 deletions

View file

@ -1,3 +1,15 @@
Mon Nov 9 20:15:16 2009 Tanaka Akira <akr@fsij.org>
* 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@ruby-lang.org>
* configure.in (warnflags): add -Wno-long-long.

View file

@ -97,13 +97,17 @@ static void set_unblock_function(rb_thread_t *th, rb_unblock_function_t *func, v
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 @@ rb_thread_schedule_rec(int sched_depth)
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 @@ rb_thread_schedule(void)
}
/* 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 @@ rb_gc_set_stack_end(VALUE **stack_end_p)
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();