summaryrefslogtreecommitdiff
path: root/internal.h
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-05-20 10:48:51 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-05-20 10:48:51 (GMT)
commitb7733bf6c5df5504f562d2becff3cb36856cb000 (patch)
tree92fb9f2d3cfa806d6be1e76cf16c8e6dbb325a34 /internal.h
parentc06a990806f2422f47bb1c189776526cd9bf09df (diff)
exclude non-VALUE in memo from GC
* internal.h (NEW_PARTIAL_MEMO_FOR): shrink buffer array not to mark non-VALUE fields. fix check_rvalue_consistency abort with RGENGC_CHECK_MODE=2. * internal.h (NEW_CMP_OPT_MEMO): exclude struct cmp_opt_data from the valid array range. * enum.c (slicewhen_i): exclude inverted too. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'internal.h')
-rw-r--r--internal.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/internal.h b/internal.h
index 2816737..5333bca 100644
--- a/internal.h
+++ b/internal.h
@@ -773,6 +773,10 @@ struct MEMO {
#define MEMO_FOR(type, value) ((type *)RARRAY_PTR(value))
#define NEW_MEMO_FOR(type, value) \
((value) = rb_ary_tmp_new_fill(type_roomof(type, VALUE)), MEMO_FOR(type, value))
+#define NEW_PARTIAL_MEMO_FOR(type, value, member) \
+ ((value) = rb_ary_tmp_new_fill(type_roomof(type, VALUE)), \
+ rb_ary_set_len((value), offsetof(type, member) / sizeof(VALUE)), \
+ MEMO_FOR(type, value))
#define STRING_P(s) (RB_TYPE_P((s), T_STRING) && CLASS_OF(s) == rb_cString)
@@ -787,6 +791,8 @@ struct cmp_opt_data {
int opt_inited;
};
+#define NEW_CMP_OPT_MEMO(type, value) \
+ NEW_PARTIAL_MEMO_FOR(type, value, cmp_opt)
#define CMP_OPTIMIZABLE_BIT(type) (1U << TOKEN_PASTE(cmp_opt_,type))
#define CMP_OPTIMIZABLE(data, type) \
(((data).opt_inited & CMP_OPTIMIZABLE_BIT(type)) ? \