1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

hidden objects should not be pushed.

* vm_insnhelper.h (PUSH): hidden objects (klass == 0) should not be pushed
  to a VM value stack. Add assertion for it.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63687 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2018-06-18 07:41:22 +00:00
parent 4a4f7aeaa1
commit 2e5aa3fba8

View file

@ -36,7 +36,18 @@ RUBY_SYMBOL_EXPORT_END
/* deal with stack */
/**********************************************************/
#define PUSH(x) (SET_SV(x), INC_SP(1))
static inline int
rb_obj_hidden_p(VALUE obj)
{
if (SPECIAL_CONST_P(obj)) {
return FALSE;
}
else {
return RBASIC_CLASS(obj) ? FALSE : TRUE;
}
}
#define PUSH(x) (VM_ASSERT(!rb_obj_hidden_p(x)), SET_SV(x), INC_SP(1))
#define TOPN(n) (*(GET_SP()-(n)-1))
#define POPN(n) (DEC_SP(n))
#define POP() (DEC_SP(1))