aboutsummaryrefslogtreecommitdiffstats
path: root/vm_insnhelper.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-10 21:56:23 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-10 21:56:23 +0000
commit1ce8abe9c8682dd3ea27bde8ee90910f1d53fa59 (patch)
treef94455da3cadc6e667edd7ac68a656dc876baf1d /vm_insnhelper.c
parente71b3b0baa746f974c37837bd02d92c51d7898a2 (diff)
downloadruby-1ce8abe9c8682dd3ea27bde8ee90910f1d53fa59.tar.gz
* vm_insnhelper.c (check_frame): check type of cref_or_me first.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50820 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r--vm_insnhelper.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 1698921748..8b28471e62 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -51,6 +51,12 @@ vm_stackoverflow(void)
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, int req_me, int req_cref, VALUE specval, V
}
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 {