Project

General

Profile

Bug #13412 » cfp_before_setjmp.patch

wanabe (_ wanabe), 04/16/2017 11:45 PM

View differences:

eval_intern.h
rb_threadptr_tag_state(rb_thread_t *th)
{
int state = th->state;
th->cfp_before_setjmp = NULL;
th->state = 0;
return state;
}
thread.c
ruby_thread_stack_overflow(rb_thread_t *th)
{
th->raised_flag = 0;
if (th->cfp_before_setjmp) {
th->cfp = th->cfp_before_setjmp;
th->cfp_before_setjmp = NULL;
}
#ifdef USE_SIGALTSTACK
if (!rb_threadptr_during_gc(th)) {
rb_exc_raise(sysstack_error);
vm.c
th->stack = thread_recycle_stack(th->stack_size);
th->cfp = (void *)(th->stack + th->stack_size);
th->cfp_before_setjmp = NULL;
vm_push_frame(th, 0 /* dummy iseq */, VM_FRAME_MAGIC_DUMMY | VM_ENV_FLAG_LOCAL | VM_FRAME_FLAG_FINISH | VM_FRAME_FLAG_CFRAME /* dummy frame */,
Qnil /* dummy self */, VM_BLOCK_HANDLER_NONE /* dummy block ptr */,
vm_core.h
#endif
unsigned long running_time_us;
VALUE name;
rb_control_frame_t *cfp_before_setjmp;
} rb_thread_t;
typedef enum {
vm_insnhelper.c
/* check stack overflow */
CHECK_VM_STACK_OVERFLOW0(cfp, sp, local_size + stack_max);
th->cfp_before_setjmp = th->cfp;
th->cfp = cfp;
/* setup new frame */
......
if (VMDEBUG == 2) SDR();
th->cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
th->cfp_before_setjmp = NULL;
return flags & VM_FRAME_FLAG_FINISH;
}
(10-10/13)