* 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:
parent
54b5ac5663
commit
d6f5da84e3
12
ChangeLog
12
ChangeLog
@ -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>
|
Mon Nov 9 11:28:29 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* configure.in (warnflags): add -Wno-long-long.
|
* configure.in (warnflags): add -Wno-long-long.
|
||||||
|
35
thread.c
35
thread.c
@ -97,13 +97,17 @@ static void set_unblock_function(rb_thread_t *th, rb_unblock_function_t *func, v
|
|||||||
struct rb_unblock_callback *old);
|
struct rb_unblock_callback *old);
|
||||||
static void reset_unblock_function(rb_thread_t *th, const 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);
|
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 { \
|
#define GVL_UNLOCK_BEGIN() do { \
|
||||||
rb_thread_t *_th_stored = GET_THREAD(); \
|
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)
|
native_mutex_unlock(&_th_stored->vm->global_vm_lock)
|
||||||
|
|
||||||
#define GVL_UNLOCK_END() \
|
#define GVL_UNLOCK_END() \
|
||||||
@ -960,7 +964,7 @@ rb_thread_schedule_rec(int sched_depth)
|
|||||||
|
|
||||||
thread_debug("rb_thread_schedule/switch start\n");
|
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_mutex_unlock(&th->vm->global_vm_lock);
|
||||||
{
|
{
|
||||||
native_thread_yield();
|
native_thread_yield();
|
||||||
@ -983,18 +987,16 @@ rb_thread_schedule(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* blocking region */
|
/* blocking region */
|
||||||
static inline void
|
#define blocking_region_begin(th, region, func, arg) \
|
||||||
blocking_region_begin(rb_thread_t *th, struct rb_blocking_region_buffer *region,
|
do { \
|
||||||
rb_unblock_function_t *func, void *arg)
|
(region)->prev_status = (th)->status; \
|
||||||
{
|
(th)->blocking_region_buffer = (region); \
|
||||||
region->prev_status = th->status;
|
set_unblock_function((th), (func), (arg), &(region)->oldubf); \
|
||||||
th->blocking_region_buffer = region;
|
(th)->status = THREAD_STOPPED; \
|
||||||
set_unblock_function(th, func, arg, ®ion->oldubf);
|
thread_debug("enter blocking region (%p)\n", (void *)(th)); \
|
||||||
th->status = THREAD_STOPPED;
|
RB_GC_SAVE_MACHINE_CONTEXT(th); \
|
||||||
thread_debug("enter blocking region (%p)\n", (void *)th);
|
native_mutex_unlock(&(th)->vm->global_vm_lock); \
|
||||||
rb_gc_save_machine_context(th);
|
} while (0)
|
||||||
native_mutex_unlock(&th->vm->global_vm_lock);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
blocking_region_end(rb_thread_t *th, struct rb_blocking_region_buffer *region)
|
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
|
void
|
||||||
rb_gc_save_machine_context(rb_thread_t *th)
|
rb_gc_save_machine_context(rb_thread_t *th)
|
||||||
{
|
{
|
||||||
SET_MACHINE_STACK_END(&th->machine_stack_end);
|
|
||||||
FLUSH_REGISTER_WINDOWS;
|
FLUSH_REGISTER_WINDOWS;
|
||||||
#ifdef __ia64
|
#ifdef __ia64
|
||||||
th->machine_register_stack_end = rb_ia64_bsp();
|
th->machine_register_stack_end = rb_ia64_bsp();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user