ruby-changes:38739
From: ko1 <ko1@a...>
Date: Thu, 11 Jun 2015 06:56:42 +0900 (JST)
Subject: [ruby-changes:38739] ko1:r50820 (trunk): * vm_insnhelper.c (check_frame): check type of cref_or_me first.
ko1 2015-06-11 06:56:23 +0900 (Thu, 11 Jun 2015) New Revision: 50820 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=50820 Log: * vm_insnhelper.c (check_frame): check type of cref_or_me first. Modified files: trunk/ChangeLog trunk/vm_insnhelper.c Index: ChangeLog =================================================================== --- ChangeLog (revision 50819) +++ ChangeLog (revision 50820) @@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Thu Jun 11 06:46:07 2015 Koichi Sasada <ko1@a...> + + * vm_insnhelper.c (check_frame): check type of cref_or_me first. + Thu Jun 11 04:34:39 2015 Kazuki Tanaka <gogotanaka@r...> * test/test_cmath.rb: Add some assertions. Index: vm_insnhelper.c =================================================================== --- vm_insnhelper.c (revision 50819) +++ vm_insnhelper.c (revision 50820) @@ -51,6 +51,12 @@ vm_stackoverflow(void) https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L51 static void check_frame(int magic, int req_block, int req_me, int req_cref, VALUE specval, VALUE cref_or_me) { + enum imemo_type cref_or_me_type = imemo_none; + + if (RB_TYPE_P(cref_or_me, T_IMEMO)) { + cref_or_me_type = imemo_type(cref_or_me); + } + if (req_block && !VM_ENVVAL_BLOCK_PTR_P(specval)) { rb_bug("vm_push_frame: specval (%p) should be a block_ptr on %x frame", (void *)specval, magic); } @@ -59,17 +65,17 @@ check_frame(int magic, int req_block, in https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L65 } if (req_me) { - if (!RB_TYPE_P(cref_or_me, T_IMEMO) || imemo_type(cref_or_me) != imemo_ment) { + if (cref_or_me_type != imemo_ment) { rb_bug("vm_push_frame: (%s) should be method entry on %x frame", rb_obj_info(cref_or_me), magic); } } else { - if (req_cref && (!RB_TYPE_P(cref_or_me, T_IMEMO) || imemo_type(cref_or_me) != imemo_cref)) { + if (req_cref && cref_or_me_type != imemo_cref) { rb_bug("vm_push_frame: (%s) should be CREF on %x frame", rb_obj_info(cref_or_me), magic); } else { /* cref or Qfalse */ - if (cref_or_me != Qfalse && (!RB_TYPE_P(cref_or_me, T_IMEMO) || imemo_type(cref_or_me) != imemo_cref)) { - if ((magic == VM_FRAME_MAGIC_LAMBDA || magic == VM_FRAME_MAGIC_IFUNC) && (RB_TYPE_P(cref_or_me, T_IMEMO) && imemo_type(cref_or_me) == imemo_ment)) { + if (cref_or_me != Qfalse && cref_or_me_type != imemo_cref) { + if ((magic == VM_FRAME_MAGIC_LAMBDA || magic == VM_FRAME_MAGIC_IFUNC) && (cref_or_me_type == imemo_ment)) { /* ignore */ } else { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/