ruby-changes:47034
From: nobu <ko1@a...>
Date: Fri, 23 Jun 2017 10:43:44 +0900 (JST)
Subject: [ruby-changes:47034] nobu:r59149 (trunk): vm_insnhelper.c: vm_stack_consistency_error
nobu 2017-06-23 10:43:39 +0900 (Fri, 23 Jun 2017) New Revision: 59149 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59149 Log: vm_insnhelper.c: vm_stack_consistency_error * vm_insnhelper.c (vm_stack_consistency_error): extracted from insns.def for further info in the future. Modified files: trunk/insns.def trunk/vm_insnhelper.c Index: vm_insnhelper.c =================================================================== --- vm_insnhelper.c (revision 59148) +++ vm_insnhelper.c (revision 59149) @@ -3297,6 +3297,22 @@ vm_case_dispatch(CDHASH hash, OFFSET els https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L3297 return 0; } +NORETURN(static void + vm_stack_consistency_error(rb_thread_t *, + const rb_control_frame_t *, + const VALUE *)); +static void +vm_stack_consistency_error(rb_thread_t *th, + const rb_control_frame_t *cfp, + const VALUE *bp) +{ + const ptrdiff_t nsp = VM_SP_CNT(th, cfp->sp); + const ptrdiff_t nbp = VM_SP_CNT(th, bp); + static const char stack_consistency_error[] = + "Stack consistency error (sp: %"PRIdPTRDIFF", bp: %"PRIdPTRDIFF")"; + rb_bug(stack_consistency_error, nsp, nbp); +} + enum binop_operands_type { bot_others = 0, bot_fixnum, Index: insns.def =================================================================== --- insns.def (revision 59148) +++ insns.def (revision 59149) @@ -913,8 +913,7 @@ leave https://github.com/ruby/ruby/blob/trunk/insns.def#L913 if (OPT_CHECKED_RUN) { const VALUE *const bp = vm_base_ptr(reg_cfp); if (reg_cfp->sp != bp) { - rb_bug("Stack consistency error (sp: %"PRIdPTRDIFF", bp: %"PRIdPTRDIFF")", - VM_SP_CNT(th, reg_cfp->sp), VM_SP_CNT(th, bp)); + vm_stack_consistency_error(th, reg_cfp, bp); } } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/