Project

General

Profile

Bug #4855 ยป fiber_machine_stack_clear.patch

nagachika (Tomoyuki Chikanaga), 06/08/2011 11:58 PM

View differences:

cont.c
366 366

  
367 367
    MEMCPY(cont->machine_register_stack, cont->machine_register_stack_src, VALUE, size);
368 368
#endif
369

  
370
    sth->machine_stack_start = sth->machine_stack_end = 0;
371
#ifdef __ia64
372
    sth->machine_register_stack_start = sth->machine_register_stack_end = 0;
373
#endif
374 369
}
375 370

  
376 371
static const rb_data_type_t cont_data_type = {
......
379 374
};
380 375

  
381 376
static void
382
cont_init(rb_context_t *cont, rb_thread_t *th)
377
cont_save_thread(rb_context_t *cont, rb_thread_t *th)
383 378
{
384 379
    /* save thread context */
385 380
    cont->saved_thread = *th;
381
    /* saved_thread->machine_stack_(start|end) should be NULL */
382
    /* because it may happen GC afterward */
383
    cont->saved_thread.machine_stack_start = 0;
384
    cont->saved_thread.machine_stack_end = 0;
385
#ifdef __ia64
386
    cont->saved_thread.machine_register_stack_start = 0
387
    cont->saved_thread.machine_register_stack_end = 0
388
#endif
389
}
390

  
391
static void
392
cont_init(rb_context_t *cont, rb_thread_t *th)
393
{
394
    /* save thread context */
395
    cont_save_thread(cont, th);
386 396
    cont->saved_thread.local_storage = 0;
387
    cont->saved_thread.machine_stack_start = cont->saved_thread.machine_stack_end = 0;
388 397
}
389 398

  
390 399
static rb_context_t *
......
1006 1015

  
1007 1016
    fiber_link_join(fib);
1008 1017

  
1009
    /*cont->machine_stack, th->machine_stack_start and th->machine_stack_end should be NULL*/
1010
    /*because it may happen GC at th->stack allocation*/
1011
    th->machine_stack_start = th->machine_stack_end = 0;
1012 1018
    th->stack_size = FIBER_VM_STACK_SIZE;
1013 1019
    th->stack = ALLOC_N(VALUE, th->stack_size);
1014 1020

  
......
1175 1181

  
1176 1182
    if (th->fiber) {
1177 1183
	GetFiberPtr(th->fiber, fib);
1178
	fib->cont.saved_thread = *th;
1184
	cont_save_thread(&fib->cont, th);
1179 1185
    }
1180 1186
    else {
1181 1187
	/* create current fiber */