Browse files

* include/ruby/ruby.h: rename OBJ_WRITE and OBJ_WRITTEN into

  RB_OBJ_WRITE and RB_OBJ_WRITTEN.
* array.c, class.c, compile.c, hash.c, internal.h, iseq.c,
  proc.c, process.c, re.c, string.c, variable.c, vm.c,
  vm_eval.c, vm_insnhelper.c, vm_insnhelper.h,
  vm_method.c: catch up this change.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
1 parent b766cc4 commit c702005a7bbb807cab666537b5ef1877c14c40ba @ko1 ko1 committed Dec 20, 2013
Showing with 95 additions and 85 deletions.
  1. +10 −0 ChangeLog
  2. +4 −4 array.c
  3. +4 −4 class.c
  4. +2 −2 compile.c
  5. +3 −3 hash.c
  6. +10 −10 include/ruby/ruby.h
  7. +2 −2 internal.h
  8. +25 −25 iseq.c
  9. +1 −1 proc.c
  10. +2 −2 process.c
  11. +2 −2 re.c
  12. +4 −4 string.c
  13. +8 −8 variable.c
  14. +3 −3 vm.c
  15. +1 −1 vm_eval.c
  16. +3 −3 vm_insnhelper.c
  17. +3 −3 vm_insnhelper.h
  18. +8 −8 vm_method.c
View
10 ChangeLog
@@ -1,3 +1,13 @@
+Fri Dec 20 17:03:10 2013 Koichi Sasada <ko1@atdot.net>
+
+ * include/ruby/ruby.h: rename OBJ_WRITE and OBJ_WRITTEN into
+ RB_OBJ_WRITE and RB_OBJ_WRITTEN.
+
+ * array.c, class.c, compile.c, hash.c, internal.h, iseq.c,
+ proc.c, process.c, re.c, string.c, variable.c, vm.c,
+ vm_eval.c, vm_insnhelper.c, vm_insnhelper.h,
+ vm_method.c: catch up this change.
+
Fri Dec 20 16:01:35 2013 Koichi Sasada <ko1@atdot.net>
* include/ruby/ruby.h: add a comment for WB interfaces.
View
8 array.c
@@ -60,7 +60,7 @@ ary_memfill(VALUE ary, long beg, long size, VALUE val)
{
RARRAY_PTR_USE(ary, ptr, {
memfill(ptr + beg, size, val);
- OBJ_WRITTEN(ary, Qundef, val);
+ RB_OBJ_WRITTEN(ary, Qundef, val);
});
}
@@ -79,7 +79,7 @@ ary_memcpy(VALUE ary, long beg, long argc, const VALUE *argv)
int i;
RARRAY_PTR_USE(ary, ptr, {
for (i=0; i<argc; i++) {
- OBJ_WRITE(ary, &ptr[i+beg], argv[i]);
+ RB_OBJ_WRITE(ary, &ptr[i+beg], argv[i]);
}
});
}
@@ -179,7 +179,7 @@ ary_memcpy(VALUE ary, long beg, long argc, const VALUE *argv)
assert(!ARY_EMBED_P(_ary_)); \
assert(ARY_SHARED_P(_ary_)); \
assert(ARY_SHARED_ROOT_P(_value_)); \
- OBJ_WRITE(_ary_, &RARRAY(_ary_)->as.heap.aux.shared, _value_); \
+ RB_OBJ_WRITE(_ary_, &RARRAY(_ary_)->as.heap.aux.shared, _value_); \
} while (0)
#define RARRAY_SHARED_ROOT_FLAG FL_USER5
#define ARY_SHARED_ROOT_P(ary) (FL_TEST((ary), RARRAY_SHARED_ROOT_FLAG))
@@ -4063,7 +4063,7 @@ rb_ary_or(VALUE ary1, VALUE ary2)
for (i=0; i<RARRAY_LEN(ary2); i++) {
VALUE elt = RARRAY_AREF(ary2, i);
if (!st_update(RHASH_TBL_RAW(hash), (st_data_t)elt, ary_hash_orset, (st_data_t)elt)) {
- OBJ_WRITTEN(hash, Qundef, elt);
+ RB_OBJ_WRITTEN(hash, Qundef, elt);
}
}
ary3 = rb_hash_values(hash);
View
8 class.c
@@ -239,7 +239,7 @@ rewrite_cref_stack(NODE *node, VALUE old_klass, VALUE new_klass, NODE **new_cref
while (node) {
if (node->nd_clss == old_klass) {
new_node = NEW_CREF(new_klass);
- OBJ_WRITE(new_node, &new_node->nd_next, node->nd_next);
+ RB_OBJ_WRITE(new_node, &new_node->nd_next, node->nd_next);
*new_cref_ptr = new_node;
return;
}
@@ -261,7 +261,7 @@ clone_method(VALUE klass, ID mid, const rb_method_entry_t *me)
newiseqval = rb_iseq_clone(me->def->body.iseq->self, klass);
GetISeqPtr(newiseqval, iseq);
rewrite_cref_stack(me->def->body.iseq->cref_stack, me->klass, klass, &new_cref);
- OBJ_WRITE(iseq->self, &iseq->cref_stack, new_cref);
+ RB_OBJ_WRITE(iseq->self, &iseq->cref_stack, new_cref);
rb_add_method(klass, mid, VM_METHOD_TYPE_ISEQ, iseq, me->flag);
RB_GC_GUARD(newiseqval);
}
@@ -287,8 +287,8 @@ clone_const(ID key, const rb_const_entry_t *ce, struct clone_const_arg *arg)
{
rb_const_entry_t *nce = ALLOC(rb_const_entry_t);
MEMCPY(nce, ce, rb_const_entry_t, 1);
- OBJ_WRITTEN(arg->klass, Qundef, ce->value);
- OBJ_WRITTEN(arg->klass, Qundef, ce->file);
+ RB_OBJ_WRITTEN(arg->klass, Qundef, ce->value);
+ RB_OBJ_WRITTEN(arg->klass, Qundef, ce->file);
st_insert(arg->tbl, key, (st_data_t)nce);
return ST_CONTINUE;
View
4 compile.c
@@ -278,7 +278,7 @@ r_value(VALUE value)
if (compile_debug) rb_compile_bug strs; \
GET_THREAD()->errinfo = iseq->compile_data->err_info; \
rb_compile_error strs; \
- OBJ_WRITE(iseq->self, &iseq->compile_data->err_info, GET_THREAD()->errinfo); \
+ RB_OBJ_WRITE(iseq->self, &iseq->compile_data->err_info, GET_THREAD()->errinfo); \
GET_THREAD()->errinfo = tmp; \
ret = 0; \
break; \
@@ -1710,7 +1710,7 @@ iseq_set_exception_table(rb_iseq_t *iseq)
}
}
- OBJ_WRITE(iseq->self, &iseq->compile_data->catch_table_ary, 0); /* free */
+ RB_OBJ_WRITE(iseq->self, &iseq->compile_data->catch_table_ary, 0); /* free */
return COMPILE_OK;
}
View
6 hash.c
@@ -60,7 +60,7 @@ static ID id_hash, id_yield, id_default;
VALUE
rb_hash_set_ifnone(VALUE hash, VALUE ifnone)
{
- OBJ_WRITE(hash, (&RHASH(hash)->ifnone), ifnone);
+ RB_OBJ_WRITE(hash, (&RHASH(hash)->ifnone), ifnone);
return hash;
}
@@ -390,8 +390,8 @@ tbl_update(VALUE hash, VALUE key, int (*func)(st_data_t *key, st_data_t *val, st
result = st_update(RHASH(hash)->ntbl, (st_data_t)key, func, (st_data_t)&arg);
/* write barrier */
- if (arg.new_key) OBJ_WRITTEN(hash, arg.old_key, arg.new_key);
- if (arg.new_value) OBJ_WRITTEN(hash, arg.old_value, arg.new_value);
+ if (arg.new_key) RB_OBJ_WRITTEN(hash, arg.old_key, arg.new_key);
+ if (arg.new_value) RB_OBJ_WRITTEN(hash, arg.old_value, arg.new_value);
return result;
}
View
20 include/ruby/ruby.h
@@ -901,7 +901,7 @@ struct RArray {
#define RARRAY_AREF(a, i) (RARRAY_CONST_PTR(a)[i])
#define RARRAY_ASET(a, i, v) do { \
const VALUE _ary_ = (a); \
- OBJ_WRITE(_ary_, &RARRAY_CONST_PTR(_ary_)[i], (v)); \
+ RB_OBJ_WRITE(_ary_, &RARRAY_CONST_PTR(_ary_)[i], (v)); \
} while (0)
#define RARRAY_PTR(a) ((VALUE *)RARRAY_CONST_PTR(RGENGC_WB_PROTECTED_ARRAY ? OBJ_WB_UNPROTECT((VALUE)a) : ((VALUE)a)))
@@ -942,17 +942,17 @@ struct RRational {
const VALUE den;
};
-#define RRATIONAL_SET_NUM(rat, n) OBJ_WRITE((rat), &((struct RRational *)(rat))->num,(n))
-#define RRATIONAL_SET_DEN(rat, d) OBJ_WRITE((rat), &((struct RRational *)(rat))->den,(d))
+#define RRATIONAL_SET_NUM(rat, n) RB_OBJ_WRITE((rat), &((struct RRational *)(rat))->num,(n))
+#define RRATIONAL_SET_DEN(rat, d) RB_OBJ_WRITE((rat), &((struct RRational *)(rat))->den,(d))
struct RComplex {
struct RBasic basic;
const VALUE real;
const VALUE imag;
};
-#define RCOMPLEX_SET_REAL(cmp, r) OBJ_WRITE((cmp), &((struct RComplex *)(cmp))->real,(r))
-#define RCOMPLEX_SET_IMAG(cmp, i) OBJ_WRITE((cmp), &((struct RComplex *)(cmp))->imag,(i))
+#define RCOMPLEX_SET_REAL(cmp, r) RB_OBJ_WRITE((cmp), &((struct RComplex *)(cmp))->real,(r))
+#define RCOMPLEX_SET_IMAG(cmp, i) RB_OBJ_WRITE((cmp), &((struct RComplex *)(cmp))->imag,(i))
struct RData {
struct RBasic basic;
@@ -1067,7 +1067,7 @@ struct RStruct {
RSTRUCT(st)->as.heap.ptr)
#define RSTRUCT_PTR(st) ((VALUE *)RSTRUCT_CONST_PTR(RGENGC_WB_PROTECTED_STRUCT ? OBJ_WB_UNPROTECT((VALUE)st) : (VALUE)st))
-#define RSTRUCT_SET(st, idx, v) OBJ_WRITE(st, &RSTRUCT_CONST_PTR(st)[idx], (v))
+#define RSTRUCT_SET(st, idx, v) RB_OBJ_WRITE(st, &RSTRUCT_CONST_PTR(st)[idx], (v))
#define RSTRUCT_GET(st, idx) (RSTRUCT_CONST_PTR(st)[idx])
#define RBIGNUM_EMBED_LEN_NUMBITS 3
@@ -1200,18 +1200,18 @@ void rb_gc_writebarrier_unprotect_promoted(VALUE obj);
#endif
/* Write barrier (WB) interfaces:
- * - OBJ_WRITE(a, slot, b): WB for new reference from `a' to `b'.
+ * - RB_OBJ_WRITE(a, slot, b): WB for new reference from `a' to `b'.
* Write `b' into `*slot'. `slot' is a pointer in `a'.
- * - OBJ_WRITTEN(a, oldv, b): WB for new reference from `a' to `b'.
+ * - RB_OBJ_WRITTEN(a, oldv, b): WB for new reference from `a' to `b'.
* This doesn't write any values, but only a WB declaration.
* `oldv' is replaced value with `b' (not used in current Ruby).
*
* NOTE: The following core interfaces can be changed in the future.
* Please catch up if you want to insert WB into C-extensions
* correctly.
*/
-#define OBJ_WRITE(a, slot, b) rb_obj_write((VALUE)(a), (VALUE *)(slot), (VALUE)(b), __FILE__, __LINE__)
-#define OBJ_WRITTEN(a, oldv, b) rb_obj_written((VALUE)(a), (VALUE)(oldv), (VALUE)(b), __FILE__, __LINE__)
+#define RB_OBJ_WRITE(a, slot, b) rb_obj_write((VALUE)(a), (VALUE *)(slot), (VALUE)(b), __FILE__, __LINE__)
+#define RB_OBJ_WRITTEN(a, oldv, b) rb_obj_written((VALUE)(a), (VALUE)(oldv), (VALUE)(b), __FILE__, __LINE__)
#ifndef USE_RGENGC_LOGGING_WB_UNPROTECT
#define USE_RGENGC_LOGGING_WB_UNPROTECT 0
View
4 internal.h
@@ -322,7 +322,7 @@ RCLASS_SET_SUPER(VALUE klass, VALUE super)
rb_class_remove_from_super_subclasses(klass);
rb_class_subclass_add(super, klass);
}
- OBJ_WRITE(klass, &RCLASS(klass)->super, super);
+ RB_OBJ_WRITE(klass, &RCLASS(klass)->super, super);
return super;
}
@@ -606,7 +606,7 @@ struct RBasicRaw {
#define RBASIC_SET_CLASS_RAW(obj, cls) (((struct RBasicRaw *)((VALUE)(obj)))->klass = (cls))
#define RBASIC_SET_CLASS(obj, cls) do { \
VALUE _obj_ = (obj); \
- OBJ_WRITE(_obj_, &((struct RBasicRaw *)(_obj_))->klass, cls); \
+ RB_OBJ_WRITE(_obj_, &((struct RBasicRaw *)(_obj_))->klass, cls); \
} while (0)
/* parse.y */
View
50 iseq.c
@@ -183,20 +183,20 @@ static rb_iseq_location_t *
iseq_location_setup(rb_iseq_t *iseq, VALUE path, VALUE absolute_path, VALUE name, size_t first_lineno)
{
rb_iseq_location_t *loc = &iseq->location;
- OBJ_WRITE(iseq->self, &loc->path, path);
+ RB_OBJ_WRITE(iseq->self, &loc->path, path);
if (RTEST(absolute_path) && rb_str_cmp(path, absolute_path) == 0) {
- OBJ_WRITE(iseq->self, &loc->absolute_path, path);
+ RB_OBJ_WRITE(iseq->self, &loc->absolute_path, path);
}
else {
- OBJ_WRITE(iseq->self, &loc->absolute_path, absolute_path);
+ RB_OBJ_WRITE(iseq->self, &loc->absolute_path, absolute_path);
}
- OBJ_WRITE(iseq->self, &loc->label, name);
- OBJ_WRITE(iseq->self, &loc->base_label, name);
+ RB_OBJ_WRITE(iseq->self, &loc->label, name);
+ RB_OBJ_WRITE(iseq->self, &loc->base_label, name);
loc->first_lineno = first_lineno;
return loc;
}
-#define ISEQ_SET_CREF(iseq, cref) OBJ_WRITE((iseq)->self, &(iseq)->cref_stack, (cref))
+#define ISEQ_SET_CREF(iseq, cref) RB_OBJ_WRITE((iseq)->self, &(iseq)->cref_stack, (cref))
static void
set_relation(rb_iseq_t *iseq, const VALUE parent)
@@ -208,14 +208,14 @@ set_relation(rb_iseq_t *iseq, const VALUE parent)
/* set class nest stack */
if (type == ISEQ_TYPE_TOP) {
/* toplevel is private */
- OBJ_WRITE(iseq->self, &iseq->cref_stack, NEW_CREF(rb_cObject));
+ RB_OBJ_WRITE(iseq->self, &iseq->cref_stack, NEW_CREF(rb_cObject));
iseq->cref_stack->nd_refinements = Qnil;
iseq->cref_stack->nd_visi = NOEX_PRIVATE;
if (th->top_wrapper) {
NODE *cref = NEW_CREF(th->top_wrapper);
cref->nd_refinements = Qnil;
cref->nd_visi = NOEX_PRIVATE;
- OBJ_WRITE(cref, &cref->nd_next, iseq->cref_stack);
+ RB_OBJ_WRITE(cref, &cref->nd_next, iseq->cref_stack);
ISEQ_SET_CREF(iseq, cref);
}
iseq->local_iseq = iseq;
@@ -245,7 +245,7 @@ void
rb_iseq_add_mark_object(rb_iseq_t *iseq, VALUE obj)
{
if (!RTEST(iseq->mark_ary)) {
- OBJ_WRITE(iseq->self, &iseq->mark_ary, rb_ary_tmp_new(3));
+ RB_OBJ_WRITE(iseq->self, &iseq->mark_ary, rb_ary_tmp_new(3));
RBASIC_CLEAR_CLASS(iseq->mark_ary);
}
rb_ary_push(iseq->mark_ary, obj);
@@ -261,7 +261,7 @@ prepare_iseq_build(rb_iseq_t *iseq,
iseq->arg_rest = -1;
iseq->arg_block = -1;
iseq->arg_keyword = -1;
- OBJ_WRITE(iseq->self, &iseq->klass, 0);
+ RB_OBJ_WRITE(iseq->self, &iseq->klass, 0);
set_relation(iseq, parent);
name = rb_fstring(name);
@@ -271,11 +271,11 @@ prepare_iseq_build(rb_iseq_t *iseq,
iseq_location_setup(iseq, path, absolute_path, name, first_lineno);
if (iseq != iseq->local_iseq) {
- OBJ_WRITE(iseq->self, &iseq->location.base_label, iseq->local_iseq->location.label);
+ RB_OBJ_WRITE(iseq->self, &iseq->location.base_label, iseq->local_iseq->location.label);
}
iseq->defined_method_id = 0;
- OBJ_WRITE(iseq->self, &iseq->mark_ary, 0);
+ RB_OBJ_WRITE(iseq->self, &iseq->mark_ary, 0);
/*
* iseq->special_block_builder = GC_GUARDED_PTR_REF(block_opt);
@@ -285,15 +285,15 @@ prepare_iseq_build(rb_iseq_t *iseq,
iseq->compile_data = ALLOC(struct iseq_compile_data);
MEMZERO(iseq->compile_data, struct iseq_compile_data, 1);
- OBJ_WRITE(iseq->self, &iseq->compile_data->err_info, Qnil);
- OBJ_WRITE(iseq->self, &iseq->compile_data->mark_ary, rb_ary_tmp_new(3));
+ RB_OBJ_WRITE(iseq->self, &iseq->compile_data->err_info, Qnil);
+ RB_OBJ_WRITE(iseq->self, &iseq->compile_data->mark_ary, rb_ary_tmp_new(3));
iseq->compile_data->storage_head = iseq->compile_data->storage_current =
(struct iseq_compile_data_storage *)
ALLOC_N(char, INITIAL_ISEQ_COMPILE_DATA_STORAGE_BUFF_SIZE +
sizeof(struct iseq_compile_data_storage));
- OBJ_WRITE(iseq->self, &iseq->compile_data->catch_table_ary, rb_ary_new());
+ RB_OBJ_WRITE(iseq->self, &iseq->compile_data->catch_table_ary, rb_ary_new());
iseq->compile_data->storage_head->pos = 0;
iseq->compile_data->storage_head->next = 0;
iseq->compile_data->storage_head->size =
@@ -303,12 +303,12 @@ prepare_iseq_build(rb_iseq_t *iseq,
iseq->compile_data->option = option;
iseq->compile_data->last_coverable_line = -1;
- OBJ_WRITE(iseq->self, &iseq->coverage, Qfalse);
+ RB_OBJ_WRITE(iseq->self, &iseq->coverage, Qfalse);
if (!GET_THREAD()->parse_in_eval) {
VALUE coverages = rb_get_coverages();
if (RTEST(coverages)) {
- OBJ_WRITE(iseq->self, &iseq->coverage, rb_hash_lookup(coverages, path));
- if (NIL_P(iseq->coverage)) OBJ_WRITE(iseq->self, &iseq->coverage, Qfalse);
+ RB_OBJ_WRITE(iseq->self, &iseq->coverage, rb_hash_lookup(coverages, path));
+ if (NIL_P(iseq->coverage)) RB_OBJ_WRITE(iseq->self, &iseq->coverage, Qfalse);
}
}
@@ -1923,19 +1923,19 @@ rb_iseq_clone(VALUE iseqval, VALUE newcbase)
iseq1->self = newiseq;
if (!iseq1->orig) {
- OBJ_WRITE(iseq1->self, &iseq1->orig, iseqval);
+ RB_OBJ_WRITE(iseq1->self, &iseq1->orig, iseqval);
}
if (iseq0->local_iseq == iseq0) {
iseq1->local_iseq = iseq1;
}
if (newcbase) {
ISEQ_SET_CREF(iseq1, NEW_CREF(newcbase));
- OBJ_WRITE(iseq1->cref_stack, &iseq1->cref_stack->nd_refinements, iseq0->cref_stack->nd_refinements);
+ RB_OBJ_WRITE(iseq1->cref_stack, &iseq1->cref_stack->nd_refinements, iseq0->cref_stack->nd_refinements);
iseq1->cref_stack->nd_visi = iseq0->cref_stack->nd_visi;
if (iseq0->cref_stack->nd_next) {
- OBJ_WRITE(iseq1->cref_stack, &iseq1->cref_stack->nd_next, iseq0->cref_stack->nd_next);
+ RB_OBJ_WRITE(iseq1->cref_stack, &iseq1->cref_stack->nd_next, iseq0->cref_stack->nd_next);
}
- OBJ_WRITE(iseq1, &iseq1->klass, newcbase);
+ RB_OBJ_WRITE(iseq1, &iseq1->klass, newcbase);
}
return newiseq;
@@ -2087,10 +2087,10 @@ rb_iseq_build_for_ruby2cext(
/* copy iseq */
MEMCPY(iseq, iseq_template, rb_iseq_t, 1); /* TODO: write barrier, *iseq = *iseq_template; */
- OBJ_WRITE(iseq->self, &iseq->location.label, rb_str_new2(name));
- OBJ_WRITE(iseq->self, &iseq->location.path, rb_str_new2(path));
+ RB_OBJ_WRITE(iseq->self, &iseq->location.label, rb_str_new2(name));
+ RB_OBJ_WRITE(iseq->self, &iseq->location.path, rb_str_new2(path));
iseq->location.first_lineno = first_lineno;
- OBJ_WRITE(iseq->self, &iseq->mark_ary, 0);
+ RB_OBJ_WRITE(iseq->self, &iseq->mark_ary, 0);
iseq->self = iseqval;
iseq->iseq = ALLOC_N(VALUE, iseq->iseq_size);
View
2 proc.c
@@ -1662,7 +1662,7 @@ rb_mod_define_method(int argc, VALUE *argv, VALUE mod)
GetProcPtr(body, proc);
if (BUILTIN_TYPE(proc->block.iseq) != T_NODE) {
proc->block.iseq->defined_method_id = id;
- OBJ_WRITE(proc->block.iseq->self, &proc->block.iseq->klass, mod);
+ RB_OBJ_WRITE(proc->block.iseq->self, &proc->block.iseq->klass, mod);
proc->is_lambda = TRUE;
proc->is_from_method = TRUE;
proc->block.klass = mod;
View
4 process.c
@@ -2328,8 +2328,8 @@ rb_execarg_fixup(VALUE execarg_obj)
}
else {
st_insert(stenv, (st_data_t)key, (st_data_t)val);
- OBJ_WRITTEN(envtbl, Qundef, key);
- OBJ_WRITTEN(envtbl, Qundef, val);
+ RB_OBJ_WRITTEN(envtbl, Qundef, key);
+ RB_OBJ_WRITTEN(envtbl, Qundef, val);
}
}
}
View
4 re.c
@@ -2460,7 +2460,7 @@ rb_reg_initialize(VALUE obj, const char *s, long len, rb_encoding *enc,
options & ARG_REG_OPTION_MASK, err,
sourcefile, sourceline);
if (!re->ptr) return -1;
- OBJ_WRITE(obj, &re->src, rb_fstring(rb_enc_str_new(s, len, enc)));
+ RB_OBJ_WRITE(obj, &re->src, rb_fstring(rb_enc_str_new(s, len, enc)));
RB_GC_GUARD(unescaped);
return 0;
}
@@ -2494,7 +2494,7 @@ rb_reg_s_alloc(VALUE klass)
NEWOBJ_OF(re, struct RRegexp, klass, T_REGEXP | (RGENGC_WB_PROTECTED_REGEXP ? FL_WB_PROTECTED : 0));
re->ptr = 0;
- OBJ_WRITE(re, &re->src, 0);
+ RB_OBJ_WRITE(re, &re->src, 0);
re->usecnt = 0;
return (VALUE)re;
View
8 string.c
@@ -114,7 +114,7 @@ VALUE rb_cSymbol;
} while (0)
#define STR_SET_SHARED(str, shared_str) do { \
- OBJ_WRITE((str), &RSTRING(str)->as.heap.aux.shared, (shared_str)); \
+ RB_OBJ_WRITE((str), &RSTRING(str)->as.heap.aux.shared, (shared_str)); \
FL_SET((str), ELTS_SHARED); \
} while (0)
@@ -822,7 +822,7 @@ rb_str_new_frozen(VALUE orig)
FL_UNSET(orig, STR_ASSOC);
str = str_new4(klass, orig);
FL_SET(str, STR_ASSOC);
- OBJ_WRITE(str, &RSTRING(str)->as.heap.aux.shared, assoc);
+ RB_OBJ_WRITE(str, &RSTRING(str)->as.heap.aux.shared, assoc);
/* TODO: WB is not needed because str is new object */
}
else {
@@ -955,7 +955,7 @@ rb_str_shared_replace(VALUE str, VALUE str2)
if (STR_NOCAPA_P(str2)) {
VALUE shared = RSTRING(str2)->as.heap.aux.shared;
FL_SET(str, RBASIC(str2)->flags & STR_NOCAPA);
- OBJ_WRITE(str, &RSTRING(str)->as.heap.aux.shared, shared);
+ RB_OBJ_WRITE(str, &RSTRING(str)->as.heap.aux.shared, shared);
}
else {
RSTRING(str)->as.heap.aux.capa = RSTRING(str2)->as.heap.aux.capa;
@@ -1523,7 +1523,7 @@ rb_str_associate(VALUE str, VALUE add)
}
FL_SET(str, STR_ASSOC);
RBASIC_CLEAR_CLASS(add);
- OBJ_WRITE(str, &RSTRING(str)->as.heap.aux.shared, add);
+ RB_OBJ_WRITE(str, &RSTRING(str)->as.heap.aux.shared, add);
}
}
View
16 variable.c
@@ -947,11 +947,11 @@ generic_ivar_set(VALUE obj, ID id, VALUE val)
tbl = st_init_numtable();
st_add_direct(generic_iv_tbl, (st_data_t)obj, (st_data_t)tbl);
st_add_direct(tbl, (st_data_t)id, (st_data_t)val);
- if (FL_ABLE(obj)) OBJ_WRITTEN(obj, Qundef, val);
+ if (FL_ABLE(obj)) RB_OBJ_WRITTEN(obj, Qundef, val);
return;
}
st_insert((st_table *)data, (st_data_t)id, (st_data_t)val);
- if (FL_ABLE(obj)) OBJ_WRITTEN(obj, data, val);
+ if (FL_ABLE(obj)) RB_OBJ_WRITTEN(obj, data, val);
}
static VALUE
@@ -1188,7 +1188,7 @@ rb_ivar_set(VALUE obj, ID id, VALUE val)
ROBJECT(obj)->as.heap.iv_index_tbl = iv_index_tbl;
}
}
- OBJ_WRITE(obj, &ROBJECT_IVPTR(obj)[index], val);
+ RB_OBJ_WRITE(obj, &ROBJECT_IVPTR(obj)[index], val);
break;
case T_CLASS:
case T_MODULE:
@@ -1631,7 +1631,7 @@ rb_autoload(VALUE mod, ID id, const char *file)
if (!tbl) tbl = RCLASS_IV_TBL(mod) = st_init_numtable();
av = (st_data_t)TypedData_Wrap_Struct(0, &autoload_data_type, 0);
st_add_direct(tbl, (st_data_t)autoload, av);
- OBJ_WRITTEN(mod, Qnil, av);
+ RB_OBJ_WRITTEN(mod, Qnil, av);
DATA_PTR(av) = tbl = st_init_numtable();
}
fn = rb_str_new2(file);
@@ -2215,8 +2215,8 @@ rb_const_set(VALUE klass, ID id, VALUE val)
ce->flag = visibility;
ce->line = rb_sourceline();
st_insert(RCLASS_CONST_TBL(klass), (st_data_t)id, (st_data_t)ce);
- OBJ_WRITE(klass, &ce->value, val);
- OBJ_WRITE(klass, &ce->file, rb_sourcefilename());
+ RB_OBJ_WRITE(klass, &ce->value, val);
+ RB_OBJ_WRITE(klass, &ce->file, rb_sourcefilename());
}
void
@@ -2615,14 +2615,14 @@ int
rb_st_insert_id_and_value(VALUE obj, st_table *tbl, ID key, VALUE value)
{
int result = st_insert(tbl, (st_data_t)key, (st_data_t)value);
- OBJ_WRITTEN(obj, Qundef, value);
+ RB_OBJ_WRITTEN(obj, Qundef, value);
return result;
}
static int
tbl_copy_i(st_data_t key, st_data_t value, st_data_t data)
{
- OBJ_WRITTEN((VALUE)data, Qundef, (VALUE)value);
+ RB_OBJ_WRITTEN((VALUE)data, Qundef, (VALUE)value);
return ST_CONTINUE;
}
View
6 vm.c
@@ -2150,7 +2150,7 @@ vm_define_method(rb_thread_t *th, VALUE obj, ID id, VALUE iseqval,
/* dup */
COPY_CREF(miseq->cref_stack, cref);
miseq->cref_stack->nd_visi = NOEX_PUBLIC;
- OBJ_WRITE(miseq->self, &miseq->klass, klass);
+ RB_OBJ_WRITE(miseq->self, &miseq->klass, klass);
miseq->defined_method_id = id;
rb_add_method(klass, id, VM_METHOD_TYPE_ISEQ, miseq, noex);
@@ -2275,7 +2275,7 @@ kwmerge_i(VALUE key, VALUE value, VALUE hash)
{
if (!SYMBOL_P(key)) Check_Type(key, T_SYMBOL);
if (st_update(RHASH_TBL_RAW(hash), key, kwmerge_ii, (st_data_t)value) == 0) { /* !existing */
- OBJ_WRITTEN(hash, Qundef, value);
+ RB_OBJ_WRITTEN(hash, Qundef, value);
}
return ST_CONTINUE;
}
@@ -2647,7 +2647,7 @@ rb_vm_set_progname(VALUE filename)
rb_thread_t *th = GET_VM()->main_thread;
rb_control_frame_t *cfp = (void *)(th->stack + th->stack_size);
--cfp;
- OBJ_WRITE(cfp->iseq->self, &cfp->iseq->location.path, filename);
+ RB_OBJ_WRITE(cfp->iseq->self, &cfp->iseq->location.path, filename);
}
#if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE
View
2 vm_eval.c
@@ -1546,7 +1546,7 @@ rb_yield_refine_block(VALUE refinement, VALUE refinements)
}
cref = vm_cref_push(th, refinement, NOEX_PUBLIC, blockptr);
cref->flags |= NODE_FL_CREF_PUSHED_BY_EVAL;
- OBJ_WRITE(cref, &cref->nd_refinements, refinements);
+ RB_OBJ_WRITE(cref, &cref->nd_refinements, refinements);
return vm_yield_with_cref(th, 0, NULL, cref);
}
View
6 vm_insnhelper.c
@@ -285,10 +285,10 @@ vm_cref_push(rb_thread_t *th, VALUE klass, int noex, rb_block_t *blockptr)
cref->nd_visi = noex;
if (blockptr) {
- OBJ_WRITE(cref, &cref->nd_next, vm_get_cref0(blockptr->iseq, blockptr->ep));
+ RB_OBJ_WRITE(cref, &cref->nd_next, vm_get_cref0(blockptr->iseq, blockptr->ep));
}
else if (cfp) {
- OBJ_WRITE(cref, &cref->nd_next, vm_get_cref0(cfp->iseq, cfp->ep));
+ RB_OBJ_WRITE(cref, &cref->nd_next, vm_get_cref0(cfp->iseq, cfp->ep));
}
/* TODO: why cref->nd_next is 1? */
if (cref->nd_next && cref->nd_next != (void *) 1 &&
@@ -549,7 +549,7 @@ vm_setivar(VALUE obj, ID id, VALUE val, IC ic, rb_call_info_t *ci, int is_attr)
VALUE *ptr = ROBJECT_IVPTR(obj);
if (index < len) {
- OBJ_WRITE(obj, &ptr[index], val);
+ RB_OBJ_WRITE(obj, &ptr[index], val);
return val; /* inline cache hit */
}
}
View
6 vm_insnhelper.h
@@ -174,7 +174,7 @@ enum vm_regan_acttype {
/**********************************************************/
#define COPY_CREF_OMOD(c1, c2) do { \
- OBJ_WRITE((c1), &(c1)->nd_refinements, (c2)->nd_refinements); \
+ RB_OBJ_WRITE((c1), &(c1)->nd_refinements, (c2)->nd_refinements); \
if (!NIL_P((c2)->nd_refinements)) { \
(c1)->flags |= NODE_FL_CREF_OMOD_SHARED; \
(c2)->flags |= NODE_FL_CREF_OMOD_SHARED; \
@@ -184,9 +184,9 @@ enum vm_regan_acttype {
#define COPY_CREF(c1, c2) do { \
NODE *__tmp_c2 = (c2); \
COPY_CREF_OMOD(c1, __tmp_c2); \
- OBJ_WRITE((c1), &(c1)->nd_clss, __tmp_c2->nd_clss); \
+ RB_OBJ_WRITE((c1), &(c1)->nd_clss, __tmp_c2->nd_clss); \
(c1)->nd_visi = __tmp_c2->nd_visi;\
- OBJ_WRITE((c1), &(c1)->nd_next, __tmp_c2->nd_next); \
+ RB_OBJ_WRITE((c1), &(c1)->nd_next, __tmp_c2->nd_next); \
if (__tmp_c2->flags & NODE_FL_CREF_PUSHED_BY_EVAL) { \
(c1)->flags |= NODE_FL_CREF_PUSHED_BY_EVAL; \
} \
View
16 vm_method.c
@@ -322,21 +322,21 @@ rb_method_entry_make(VALUE klass, ID mid, rb_method_type_t type,
me->flag = NOEX_WITH_SAFE(noex);
me->mark = 0;
me->called_id = mid;
- OBJ_WRITE(klass, &me->klass, defined_class);
+ RB_OBJ_WRITE(klass, &me->klass, defined_class);
me->def = def;
if (def) {
def->alias_count++;
switch(def->type) {
case VM_METHOD_TYPE_ISEQ:
- OBJ_WRITTEN(klass, Qundef, def->body.iseq->self);
+ RB_OBJ_WRITTEN(klass, Qundef, def->body.iseq->self);
break;
case VM_METHOD_TYPE_IVAR:
- OBJ_WRITTEN(klass, Qundef, def->body.attr.location);
+ RB_OBJ_WRITTEN(klass, Qundef, def->body.attr.location);
break;
case VM_METHOD_TYPE_BMETHOD:
- OBJ_WRITTEN(klass, Qundef, def->body.proc);
+ RB_OBJ_WRITTEN(klass, Qundef, def->body.proc);
break;
default:;
/* ignore */
@@ -438,7 +438,7 @@ rb_add_method(VALUE klass, ID mid, rb_method_type_t type, void *opts, rb_method_
case VM_METHOD_TYPE_ISEQ: {
rb_iseq_t *iseq = (rb_iseq_t *)opts;
*(rb_iseq_t **)&def->body.iseq = iseq;
- OBJ_WRITTEN(klass, Qundef, iseq->self);
+ RB_OBJ_WRITTEN(klass, Qundef, iseq->self);
break;
}
case VM_METHOD_TYPE_CFUNC:
@@ -450,16 +450,16 @@ rb_add_method(VALUE klass, ID mid, rb_method_type_t type, void *opts, rb_method_
case VM_METHOD_TYPE_ATTRSET:
case VM_METHOD_TYPE_IVAR:
def->body.attr.id = (ID)opts;
- OBJ_WRITE(klass, &def->body.attr.location, Qfalse);
+ RB_OBJ_WRITE(klass, &def->body.attr.location, Qfalse);
th = GET_THREAD();
cfp = rb_vm_get_ruby_level_next_cfp(th, th->cfp);
if (cfp && (line = rb_vm_get_sourceline(cfp))) {
VALUE location = rb_ary_new3(2, cfp->iseq->location.path, INT2FIX(line));
- OBJ_WRITE(klass, &def->body.attr.location, rb_ary_freeze(location));
+ RB_OBJ_WRITE(klass, &def->body.attr.location, rb_ary_freeze(location));
}
break;
case VM_METHOD_TYPE_BMETHOD:
- OBJ_WRITE(klass, &def->body.proc, (VALUE)opts);
+ RB_OBJ_WRITE(klass, &def->body.proc, (VALUE)opts);
break;
case VM_METHOD_TYPE_NOTIMPLEMENTED:
setup_method_cfunc_struct(&def->body.cfunc, rb_f_notimplement, -1);

0 comments on commit c702005

Please sign in to comment.