mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Add write barrier calls for direct marking objects.
This commit adds write barriers for objects marked from `rb_iseq_mark`. r62851 introduced direct marking from iseqs to: * keyword arg default values * catch table iseqs * VALUEs embedded in encoded instructions This patch adds missing write barrier calls to those references. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63147 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
282efd1f32
commit
5bafb6c596
2 changed files with 26 additions and 7 deletions
31
compile.c
31
compile.c
|
@ -1596,6 +1596,9 @@ iseq_set_arguments_keywords(rb_iseq_t *iseq, LINK_ANCHOR *const optargs,
|
|||
for (i = 0; i < RARRAY_LEN(default_values); i++) {
|
||||
VALUE dv = RARRAY_AREF(default_values, i);
|
||||
if (dv == complex_mark) dv = Qundef;
|
||||
if (!SPECIAL_CONST_P(dv)) {
|
||||
RB_OBJ_WRITTEN(iseq, Qundef, dv);
|
||||
}
|
||||
dvs[i] = dv;
|
||||
}
|
||||
|
||||
|
@ -2082,6 +2085,7 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *const anchor)
|
|||
rb_hash_rehash(map);
|
||||
freeze_hide_obj(map);
|
||||
generated_iseq[code_index + 1 + j] = map;
|
||||
RB_OBJ_WRITTEN(iseq, Qundef, map);
|
||||
FL_SET(iseq, ISEQ_MARKABLE_ISEQ);
|
||||
break;
|
||||
}
|
||||
|
@ -2094,6 +2098,7 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *const anchor)
|
|||
VALUE v = operands[j];
|
||||
generated_iseq[code_index + 1 + j] = v;
|
||||
if (!SPECIAL_CONST_P(v)) {
|
||||
RB_OBJ_WRITTEN(iseq, Qundef, v);
|
||||
FL_SET(iseq, ISEQ_MARKABLE_ISEQ);
|
||||
}
|
||||
break;
|
||||
|
@ -2104,6 +2109,7 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *const anchor)
|
|||
generated_iseq[code_index + 1 + j] = v;
|
||||
/* to mark ruby object */
|
||||
if (!SPECIAL_CONST_P(v)) {
|
||||
RB_OBJ_WRITTEN(iseq, Qundef, v);
|
||||
FL_SET(iseq, ISEQ_MARKABLE_ISEQ);
|
||||
}
|
||||
break;
|
||||
|
@ -2280,6 +2286,7 @@ iseq_set_exception_table(rb_iseq_t *iseq)
|
|||
entry->start = label_get_position((LABEL *)(ptr[1] & ~1));
|
||||
entry->end = label_get_position((LABEL *)(ptr[2] & ~1));
|
||||
entry->iseq = (rb_iseq_t *)ptr[3];
|
||||
RB_OBJ_WRITTEN(iseq, Qundef, entry->iseq);
|
||||
|
||||
/* stack depth */
|
||||
if (ptr[4]) {
|
||||
|
@ -8478,13 +8485,25 @@ ibf_load_code(const struct ibf_load *load, const rb_iseq_t *iseq, const struct r
|
|||
switch (types[op_index]) {
|
||||
case TS_CDHASH:
|
||||
case TS_VALUE:
|
||||
code[code_index] = ibf_load_object(load, op);
|
||||
FL_SET(iseq, ISEQ_MARKABLE_ISEQ);
|
||||
break;
|
||||
{
|
||||
VALUE v = ibf_load_object(load, op);
|
||||
code[code_index] = v;
|
||||
if (!SPECIAL_CONST_P(v)) {
|
||||
RB_OBJ_WRITTEN(iseq, Qundef, v);
|
||||
FL_SET(iseq, ISEQ_MARKABLE_ISEQ);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TS_ISEQ:
|
||||
code[code_index] = (VALUE)ibf_load_iseq(load, (const rb_iseq_t *)op);
|
||||
FL_SET(iseq, ISEQ_MARKABLE_ISEQ);
|
||||
break;
|
||||
{
|
||||
VALUE v = (VALUE)ibf_load_iseq(load, (const rb_iseq_t *)op);
|
||||
code[code_index] = v;
|
||||
if (!SPECIAL_CONST_P(v)) {
|
||||
RB_OBJ_WRITTEN(iseq, Qundef, v);
|
||||
FL_SET(iseq, ISEQ_MARKABLE_ISEQ);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TS_IC:
|
||||
FL_SET(iseq, ISEQ_MARKABLE_ISEQ);
|
||||
case TS_ISE:
|
||||
|
|
2
iseq.c
2
iseq.c
|
@ -235,7 +235,7 @@ rb_iseq_mark(const rb_iseq_t *iseq)
|
|||
|
||||
for (j = 0; i < body->param.keyword->num; i++, j++) {
|
||||
VALUE obj = body->param.keyword->default_values[j];
|
||||
if (obj != Qundef) {
|
||||
if (!SPECIAL_CONST_P(obj)) {
|
||||
rb_gc_mark(obj);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue