aboutsummaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2019-07-22 17:44:58 +0900
committerKoichi Sasada <ko1@atdot.net>2019-07-22 17:53:10 +0900
commit1feda1c2b091b950efcaa481a11fd660efa9e717 (patch)
tree385ccde7762ce9c2b1e3faebd4a386d0a6e300bb /eval.c
parent9095ff53cf6c25154c7f80910aab8d1af45c42ec (diff)
downloadruby-1feda1c2b091b950efcaa481a11fd660efa9e717.tar.gz
constify again.
Same as last commit, make some fields `const`. include/ruby/ruby.h: * Rasic::klass * RArray::heap::aux::shared_root * RRegexp::src internal.h: * rb_classext_struct::origin_, redefined_class * vm_svar::cref_or_me, lastline, backref, others * vm_throw_data::throw_obj * vm_ifunc::data * MEMO::v1, v2, u3::value While modifying this patch, I found write-barrier miss on rb_classext_struct::redefined_class. Also vm_throw_data::throw_state is only `int` so change the type.
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/eval.c b/eval.c
index 138006e0db..afc78532df 100644
--- a/eval.c
+++ b/eval.c
@@ -1356,7 +1356,7 @@ rb_using_refinement(rb_cref_t *cref, VALUE klass, VALUE module)
FL_SET(module, RMODULE_IS_OVERLAID);
superclass = refinement_superclass(superclass);
c = iclass = rb_include_class_new(module, superclass);
- RCLASS_REFINED_CLASS(c) = klass;
+ RB_OBJ_WRITE(c, &RCLASS_REFINED_CLASS(c), klass);
RCLASS_M_TBL(OBJ_WB_UNPROTECT(c)) =
RCLASS_M_TBL(OBJ_WB_UNPROTECT(module)); /* TODO: check unprotecting */
@@ -1365,8 +1365,8 @@ rb_using_refinement(rb_cref_t *cref, VALUE klass, VALUE module)
while (module && module != klass) {
FL_SET(module, RMODULE_IS_OVERLAID);
c = RCLASS_SET_SUPER(c, rb_include_class_new(module, RCLASS_SUPER(c)));
- RCLASS_REFINED_CLASS(c) = klass;
- module = RCLASS_SUPER(module);
+ RB_OBJ_WRITE(c, &RCLASS_REFINED_CLASS(c), klass);
+ module = RCLASS_SUPER(module);
}
rb_hash_aset(CREF_REFINEMENTS(cref), klass, iclass);
}
@@ -1451,12 +1451,12 @@ add_activated_refinement(VALUE activated_refinements,
FL_SET(refinement, RMODULE_IS_OVERLAID);
superclass = refinement_superclass(superclass);
c = iclass = rb_include_class_new(refinement, superclass);
- RCLASS_REFINED_CLASS(c) = klass;
+ RB_OBJ_WRITE(c, &RCLASS_REFINED_CLASS(c), klass);
refinement = RCLASS_SUPER(refinement);
while (refinement && refinement != klass) {
FL_SET(refinement, RMODULE_IS_OVERLAID);
c = RCLASS_SET_SUPER(c, rb_include_class_new(refinement, RCLASS_SUPER(c)));
- RCLASS_REFINED_CLASS(c) = klass;
+ RB_OBJ_WRITE(c, &RCLASS_REFINED_CLASS(c), klass);
refinement = RCLASS_SUPER(refinement);
}
rb_hash_aset(activated_refinements, klass, iclass);