summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--class.c2
-rw-r--r--eval.c10
-rw-r--r--include/ruby/ruby.h6
-rw-r--r--internal.h24
-rw-r--r--vm_insnhelper.h4
5 files changed, 23 insertions, 23 deletions
diff --git a/class.c b/class.c
index 7922df5..a8d21f9 100644
--- a/class.c
+++ b/class.c
@@ -176,7 +176,7 @@ class_alloc(VALUE flags, VALUE klass)
*/
RCLASS_SET_ORIGIN((VALUE)obj, (VALUE)obj);
RCLASS_SERIAL(obj) = rb_next_class_serial();
- RCLASS_REFINED_CLASS(obj) = Qnil;
+ RB_OBJ_WRITE(obj, &RCLASS_REFINED_CLASS(obj), Qnil);
RCLASS_EXT(obj)->allocator = 0;
return (VALUE)obj;
diff --git a/eval.c b/eval.c
index 138006e..afc7853 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);
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h
index af561ff..5456dbc 100644
--- a/include/ruby/ruby.h
+++ b/include/ruby/ruby.h
@@ -887,7 +887,7 @@ enum ruby_fl_type {
struct RUBY_ALIGNAS(SIZEOF_VALUE) RBasic {
VALUE flags;
- VALUE klass;
+ const VALUE klass;
};
VALUE rb_obj_hide(VALUE obj);
@@ -1054,7 +1054,7 @@ struct RArray {
long len;
union {
long capa;
- VALUE shared_root;
+ const VALUE shared_root;
} aux;
const VALUE *ptr;
} heap;
@@ -1109,7 +1109,7 @@ struct RArray {
struct RRegexp {
struct RBasic basic;
struct re_pattern_buffer *ptr;
- VALUE src;
+ const VALUE src;
unsigned long usecnt;
};
#define RREGEXP_PTR(r) (RREGEXP(r)->ptr)
diff --git a/internal.h b/internal.h
index f8baba4..4b4352d 100644
--- a/internal.h
+++ b/internal.h
@@ -1009,8 +1009,8 @@ struct rb_classext_struct {
*/
rb_subclass_entry_t **module_subclasses;
rb_serial_t class_serial;
- VALUE origin_;
- VALUE refined_class;
+ const VALUE origin_;
+ const VALUE refined_class;
rb_alloc_func_t allocator;
};
@@ -1127,10 +1127,10 @@ imemo_type_p(VALUE imemo, enum imemo_type imemo_type)
/*! SVAR (Special VARiable) */
struct vm_svar {
VALUE flags;
- VALUE cref_or_me; /*!< class reference or rb_method_entry_t */
- VALUE lastline;
- VALUE backref;
- VALUE others;
+ const VALUE cref_or_me; /*!< class reference or rb_method_entry_t */
+ const VALUE lastline;
+ const VALUE backref;
+ const VALUE others;
};
@@ -1140,9 +1140,9 @@ struct vm_svar {
struct vm_throw_data {
VALUE flags;
VALUE reserved;
- VALUE throw_obj;
+ const VALUE throw_obj;
const struct rb_control_frame_struct *catch_frame;
- VALUE throw_state;
+ int throw_state;
};
#define THROW_DATA_P(err) RB_TYPE_P((VALUE)(err), T_IMEMO)
@@ -1163,7 +1163,7 @@ struct vm_ifunc {
VALUE flags;
VALUE reserved;
VALUE (*func)(ANYARGS);
- void *data;
+ const void *data;
struct vm_ifunc_argc argc;
};
@@ -1220,12 +1220,12 @@ void rb_strterm_mark(VALUE obj);
struct MEMO {
VALUE flags;
VALUE reserved;
- VALUE v1;
- VALUE v2;
+ const VALUE v1;
+ const VALUE v2;
union {
long cnt;
long state;
- VALUE value;
+ const VALUE value;
VALUE (*func)(ANYARGS);
} u3;
};
diff --git a/vm_insnhelper.h b/vm_insnhelper.h
index 98aee9d..920ea6a 100644
--- a/vm_insnhelper.h
+++ b/vm_insnhelper.h
@@ -203,7 +203,7 @@ static inline int
THROW_DATA_STATE(const struct vm_throw_data *obj)
{
VM_ASSERT(THROW_DATA_P(obj));
- return (int)obj->throw_state;
+ return obj->throw_state;
}
static inline int
@@ -224,7 +224,7 @@ static inline void
THROW_DATA_STATE_SET(struct vm_throw_data *obj, int st)
{
VM_ASSERT(THROW_DATA_P(obj));
- obj->throw_state = (VALUE)st;
+ obj->throw_state = st;
}
static inline void