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

constify RHash::ifnone.

RHash::ifnone should be protected by write-barriers so this field
should be const. However, to introduce GC.compact, the const was
removed. This commit revert this removing `const` and modify
gc.c `TYPED_UPDATE_IF_MOVED` to remove `const` forcely by a type cast.
This commit is contained in:
Koichi Sasada 2019-07-22 17:01:31 +09:00
parent d1c2b19698
commit f75561b8d4
2 changed files with 2 additions and 2 deletions

2
gc.c
View file

@ -915,7 +915,7 @@ static inline void gc_prof_set_heap_info(rb_objspace_t *);
#define TYPED_UPDATE_IF_MOVED(_objspace, _type, _thing) do { \
if (gc_object_moved_p(_objspace, (VALUE)_thing)) { \
(_thing) = (_type)RMOVED((_thing))->destination; \
*((_type *)(&_thing)) = (_type)RMOVED((_thing))->destination; \
} \
} while (0)

View file

@ -873,7 +873,7 @@ struct RHash {
struct ar_table_struct *ar; /* possibly 0 */
} as;
int iter_lev;
VALUE ifnone;
const VALUE ifnone;
};
#ifdef RHASH_ITER_LEV