aboutsummaryrefslogtreecommitdiffstats
path: root/vm_insnhelper.h
diff options
context:
space:
mode:
Diffstat (limited to 'vm_insnhelper.h')
-rw-r--r--vm_insnhelper.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/vm_insnhelper.h b/vm_insnhelper.h
index f630f73194..25bd92f6fd 100644
--- a/vm_insnhelper.h
+++ b/vm_insnhelper.h
@@ -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))