summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/coverage/coverage.c3
-rw-r--r--ext/objspace/objspace.c3
-rw-r--r--hash.c9
-rw-r--r--internal.h1
-rw-r--r--internal/hash.h5
-rw-r--r--struct.c6
6 files changed, 10 insertions, 17 deletions
diff --git a/ext/coverage/coverage.c b/ext/coverage/coverage.c
index 49f7ffa0f8..5b29ea2aea 100644
--- a/ext/coverage/coverage.c
+++ b/ext/coverage/coverage.c
@@ -252,7 +252,8 @@ rb_coverage_peek_result(VALUE klass)
if (!RTEST(coverages)) {
rb_raise(rb_eRuntimeError, "coverage measurement is not enabled");
}
- st_foreach(RHASH_TBL(coverages), coverage_peek_result_i, ncoverages);
+ OBJ_WB_UNPROTECT(coverages);
+ st_foreach(RHASH_TBL_RAW(coverages), coverage_peek_result_i, ncoverages);
if (current_mode & COVERAGE_TARGET_METHODS) {
rb_objspace_each_objects(method_coverage_i, &ncoverages);
diff --git a/ext/objspace/objspace.c b/ext/objspace/objspace.c
index a9b1e64183..262640d30c 100644
--- a/ext/objspace/objspace.c
+++ b/ext/objspace/objspace.c
@@ -141,7 +141,8 @@ setup_hash(int argc, VALUE *argv)
hash = rb_hash_new();
}
else if (!RHASH_EMPTY_P(hash)) {
- st_foreach(RHASH_TBL(hash), set_zero_i, hash);
+ /* WB: no new reference */
+ st_foreach(RHASH_TBL_RAW(hash), set_zero_i, hash);
}
return hash;
diff --git a/hash.c b/hash.c
index a3853e8ef3..2d22f8ab2b 100644
--- a/hash.c
+++ b/hash.c
@@ -1620,23 +1620,16 @@ rb_hash_modify_check(VALUE hash)
}
MJIT_FUNC_EXPORTED struct st_table *
-#if RHASH_CONVERT_TABLE_DEBUG
rb_hash_tbl_raw(VALUE hash, const char *file, int line)
{
return ar_force_convert_table(hash, file, line);
}
-#else
-rb_hash_tbl_raw(VALUE hash)
-{
- return ar_force_convert_table(hash, NULL, 0);
-}
-#endif
struct st_table *
rb_hash_tbl(VALUE hash, const char *file, int line)
{
OBJ_WB_UNPROTECT(hash);
- return RHASH_TBL_RAW(hash);
+ return rb_hash_tbl_raw(hash, file, line);
}
static void
diff --git a/internal.h b/internal.h
index 9d4478b0ca..d033bc5df3 100644
--- a/internal.h
+++ b/internal.h
@@ -46,6 +46,7 @@
/* internal/hash.h */
#undef RHASH_IFNONE
#undef RHASH_SIZE
+#undef RHASH_TBL
/* internal/object.h */
#undef ROBJECT_IV_INDEX_TBL
diff --git a/internal/hash.h b/internal/hash.h
index f77102506e..73d71deaa2 100644
--- a/internal/hash.h
+++ b/internal/hash.h
@@ -107,13 +107,8 @@ VALUE rb_hash_keys(VALUE hash);
VALUE rb_hash_has_key(VALUE hash, VALUE key);
VALUE rb_hash_compare_by_id_p(VALUE hash);
-#if RHASH_CONVERT_TABLE_DEBUG
st_table *rb_hash_tbl_raw(VALUE hash, const char *file, int line);
#define RHASH_TBL_RAW(h) rb_hash_tbl_raw(h, __FILE__, __LINE__)
-#else
-st_table *rb_hash_tbl_raw(VALUE hash);
-#define RHASH_TBL_RAW(h) rb_hash_tbl_raw(h)
-#endif
MJIT_SYMBOL_EXPORT_END
#if 0 /* for debug */
diff --git a/struct.c b/struct.c
index bc89ec5cfc..d62b6ca021 100644
--- a/struct.c
+++ b/struct.c
@@ -388,9 +388,10 @@ struct_make_members_list(va_list ar)
{
char *mem;
VALUE ary, list = rb_ident_hash_new();
- st_table *tbl = RHASH_TBL(list);
+ st_table *tbl = RHASH_TBL_RAW(list);
RBASIC_CLEAR_CLASS(list);
+ OBJ_WB_UNPROTECT(list);
while ((mem = va_arg(ar, char*)) != 0) {
VALUE sym = rb_sym_intern_ascii_cstr(mem);
if (st_insert(tbl, sym, Qtrue)) {
@@ -583,7 +584,8 @@ rb_struct_s_def(int argc, VALUE *argv, VALUE klass)
rest = rb_ident_hash_new();
RBASIC_CLEAR_CLASS(rest);
- tbl = RHASH_TBL(rest);
+ OBJ_WB_UNPROTECT(rest);
+ tbl = RHASH_TBL_RAW(rest);
for (i=0; i<argc; i++) {
VALUE mem = rb_to_symbol(argv[i]);
if (rb_is_attrset_sym(mem)) {