summaryrefslogtreecommitdiff
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
commit62a81ad98c2421077acd637c11e06022e19a4977 (patch)
treef94455da3cadc6e667edd7ac68a656dc876baf1d
parent4ddbc83c910dd62e1faffce0258d264296e372a9 (diff)
downloadruby-62a81ad98c2421077acd637c11e06022e19a4977.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
-rw-r--r--ChangeLog4
-rw-r--r--vm_insnhelper.c14
2 files changed, 14 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 4598bb54b0..1e9021ece5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Thu Jun 11 06:46:07 2015 Koichi Sasada <ko1@atdot.net>
+
+ * vm_insnhelper.c (check_frame): check type of cref_or_me first.
+
Thu Jun 11 04:34:39 2015 Kazuki Tanaka <gogotanaka@ruby-lang.org>
* test/test_cmath.rb: Add some assertions.
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 {