ruby-changes:51477
From: ko1 <ko1@a...>
Date: Mon, 18 Jun 2018 16:41:28 +0900 (JST)
Subject: [ruby-changes:51477] ko1:r63687 (trunk): hidden objects should not be pushed.
ko1 2018-06-18 16:41:22 +0900 (Mon, 18 Jun 2018) New Revision: 63687 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63687 Log: 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. Modified files: trunk/vm_insnhelper.h Index: vm_insnhelper.h =================================================================== --- vm_insnhelper.h (revision 63686) +++ vm_insnhelper.h (revision 63687) @@ -36,7 +36,18 @@ RUBY_SYMBOL_EXPORT_END https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.h#L36 /* 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)) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/