* cont.c (cont_save_thread): add new utility function.
rb_context_t::saved_thread.machine_stack_start and machine_stack_end should be cleared immediately after a snapshot of current thread is stored to saved_thread. this change aims to get rid of unnecessary GC mark at machine stack. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
68c3b15398
commit
3ec2b843c8
@ -1,3 +1,11 @@
|
|||||||
|
Tue Jun 14 21:26:01 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
|
||||||
|
|
||||||
|
* cont.c (cont_save_thread): add new utility function.
|
||||||
|
rb_context_t::saved_thread.machine_stack_start and
|
||||||
|
machine_stack_end should be cleared immediately after a snapshot of
|
||||||
|
current thread is stored to saved_thread.
|
||||||
|
this change aims to get rid of unnecessary GC mark at machine stack.
|
||||||
|
|
||||||
Tue Jun 14 19:50:49 2011 Tanaka Akira <akr@fsij.org>
|
Tue Jun 14 19:50:49 2011 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* test/ruby/test_autoload.rb: remove temporary directory.
|
* test/ruby/test_autoload.rb: remove temporary directory.
|
||||||
|
28
cont.c
28
cont.c
@ -366,11 +366,6 @@ cont_save_machine_stack(rb_thread_t *th, rb_context_t *cont)
|
|||||||
|
|
||||||
MEMCPY(cont->machine_register_stack, cont->machine_register_stack_src, VALUE, size);
|
MEMCPY(cont->machine_register_stack, cont->machine_register_stack_src, VALUE, size);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sth->machine_stack_start = sth->machine_stack_end = 0;
|
|
||||||
#ifdef __ia64
|
|
||||||
sth->machine_register_stack_start = sth->machine_register_stack_end = 0;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const rb_data_type_t cont_data_type = {
|
static const rb_data_type_t cont_data_type = {
|
||||||
@ -379,12 +374,26 @@ static const rb_data_type_t cont_data_type = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cont_init(rb_context_t *cont, rb_thread_t *th)
|
cont_save_thread(rb_context_t *cont, rb_thread_t *th)
|
||||||
{
|
{
|
||||||
/* save thread context */
|
/* save thread context */
|
||||||
cont->saved_thread = *th;
|
cont->saved_thread = *th;
|
||||||
|
/* saved_thread->machine_stack_(start|end) should be NULL */
|
||||||
|
/* because it may happen GC afterward */
|
||||||
|
cont->saved_thread.machine_stack_start = 0;
|
||||||
|
cont->saved_thread.machine_stack_end = 0;
|
||||||
|
#ifdef __ia64
|
||||||
|
cont->saved_thread.machine_register_stack_start = 0
|
||||||
|
cont->saved_thread.machine_register_stack_end = 0
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
cont_init(rb_context_t *cont, rb_thread_t *th)
|
||||||
|
{
|
||||||
|
/* save thread context */
|
||||||
|
cont_save_thread(cont, th);
|
||||||
cont->saved_thread.local_storage = 0;
|
cont->saved_thread.local_storage = 0;
|
||||||
cont->saved_thread.machine_stack_start = cont->saved_thread.machine_stack_end = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static rb_context_t *
|
static rb_context_t *
|
||||||
@ -1006,9 +1015,6 @@ fiber_init(VALUE fibval, VALUE proc)
|
|||||||
|
|
||||||
fiber_link_join(fib);
|
fiber_link_join(fib);
|
||||||
|
|
||||||
/*cont->machine_stack, th->machine_stack_start and th->machine_stack_end should be NULL*/
|
|
||||||
/*because it may happen GC at th->stack allocation*/
|
|
||||||
th->machine_stack_start = th->machine_stack_end = 0;
|
|
||||||
th->stack_size = FIBER_VM_STACK_SIZE;
|
th->stack_size = FIBER_VM_STACK_SIZE;
|
||||||
th->stack = ALLOC_N(VALUE, th->stack_size);
|
th->stack = ALLOC_N(VALUE, th->stack_size);
|
||||||
|
|
||||||
@ -1175,7 +1181,7 @@ fiber_store(rb_fiber_t *next_fib)
|
|||||||
|
|
||||||
if (th->fiber) {
|
if (th->fiber) {
|
||||||
GetFiberPtr(th->fiber, fib);
|
GetFiberPtr(th->fiber, fib);
|
||||||
fib->cont.saved_thread = *th;
|
cont_save_thread(&fib->cont, th);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* create current fiber */
|
/* create current fiber */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user