Skip to content

Commit 8c7be5f

Browse files
committed
Only add objects to the compile time mark array
Now that marking is done directly on the iseq, we just need to keep objects alive during compile time via a mark array. This commit switches iseq mark to push on to the compile time mark array, then stops adding the iseq to iseq mark arrays
1 parent 5266796 commit 8c7be5f

File tree

1 file changed

+2
-21
lines changed

1 file changed

+2
-21
lines changed

compile.c

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -562,15 +562,6 @@ APPEND_ELEM(ISEQ_ARG_DECLARE LINK_ANCHOR *const anchor, LINK_ELEMENT *before, LI
562562
#define APPEND_ELEM(anchor, before, elem) APPEND_ELEM(iseq, (anchor), (before), (elem))
563563
#endif
564564

565-
static int
566-
iseq_add_mark_object(const rb_iseq_t *iseq, VALUE v)
567-
{
568-
if (!SPECIAL_CONST_P(v)) {
569-
rb_iseq_add_mark_object(iseq, v);
570-
}
571-
return COMPILE_OK;
572-
}
573-
574565
static int
575566
iseq_add_mark_object_compile_time(const rb_iseq_t *iseq, VALUE v)
576567
{
@@ -1235,7 +1226,7 @@ new_child_iseq(rb_iseq_t *iseq, const NODE *const node,
12351226
rb_iseq_path(iseq), rb_iseq_realpath(iseq),
12361227
INT2FIX(line_no), parent, type, ISEQ_COMPILE_DATA(iseq)->option);
12371228
debugs("[new_child_iseq]< ---------------------------------------\n");
1238-
iseq_add_mark_object(iseq, (VALUE)ret_iseq);
1229+
iseq_add_mark_object_compile_time(iseq, (VALUE)ret_iseq);
12391230
return ret_iseq;
12401231
}
12411232

@@ -1250,7 +1241,7 @@ new_child_iseq_ifunc(rb_iseq_t *iseq, const struct vm_ifunc *ifunc,
12501241
rb_iseq_path(iseq), rb_iseq_realpath(iseq),
12511242
INT2FIX(line_no), parent, type, ISEQ_COMPILE_DATA(iseq)->option);
12521243
debugs("[new_child_iseq_ifunc]< ---------------------------------------\n");
1253-
iseq_add_mark_object(iseq, (VALUE)ret_iseq);
1244+
iseq_add_mark_object_compile_time(iseq, (VALUE)ret_iseq);
12541245
return ret_iseq;
12551246
}
12561247

@@ -1501,7 +1492,6 @@ iseq_set_arguments_keywords(rb_iseq_t *iseq, LINK_ANCHOR *const optargs,
15011492
switch (nd_type(val_node)) {
15021493
case NODE_LIT:
15031494
dv = val_node->nd_lit;
1504-
iseq_add_mark_object(iseq, dv);
15051495
break;
15061496
case NODE_NIL:
15071497
dv = Qnil;
@@ -2044,7 +2034,6 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *const anchor)
20442034
VALUE v = operands[j];
20452035
generated_iseq[code_index + 1 + j] = v;
20462036
/* to mark ruby object */
2047-
iseq_add_mark_object(iseq, v);
20482037
break;
20492038
}
20502039
case TS_IC: /* inline cache */
@@ -4785,7 +4774,6 @@ compile_case(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const orig_nod
47854774
}
47864775

47874776
if (only_special_literals) {
4788-
iseq_add_mark_object(iseq, literals);
47894777

47904778
ADD_INSN(ret, nd_line(orig_node), dup);
47914779
ADD_INSN2(ret, nd_line(orig_node), opt_case_dispatch, literals, elselabel);
@@ -7500,7 +7488,6 @@ iseq_build_load_iseq(const rb_iseq_t *iseq, VALUE op)
75007488
}
75017489

75027490
loaded_iseq = rb_iseqw_to_iseq(iseqw);
7503-
iseq_add_mark_object(iseq, (VALUE)loaded_iseq);
75047491
return loaded_iseq;
75057492
}
75067493

@@ -7631,7 +7618,6 @@ iseq_build_from_ary_body(rb_iseq_t *iseq, LINK_ANCHOR *const anchor,
76317618
break;
76327619
case TS_VALUE:
76337620
argv[j] = op;
7634-
iseq_add_mark_object(iseq, op);
76357621
break;
76367622
case TS_ISEQ:
76377623
{
@@ -7678,7 +7664,6 @@ iseq_build_from_ary_body(rb_iseq_t *iseq, LINK_ANCHOR *const anchor,
76787664
}
76797665
RB_GC_GUARD(op);
76807666
argv[j] = map;
7681-
rb_iseq_add_mark_object(iseq, map);
76827667
}
76837668
break;
76847669
case TS_FUNCPTR:
@@ -9280,7 +9265,6 @@ ibf_load_object(const struct ibf_load *load, VALUE object_index)
92809265

92819266
rb_ary_store(load->obj_list, (long)object_index, obj);
92829267
}
9283-
iseq_add_mark_object(load->iseq, obj);
92849268
return obj;
92859269
}
92869270
}
@@ -9465,9 +9449,6 @@ ibf_load_iseq(const struct ibf_load *load, const rb_iseq_t *index_iseq)
94659449
ibf_load_iseq_complete(iseq);
94669450
#endif /* !USE_LAZY_LOAD */
94679451

9468-
if (load->iseq) {
9469-
iseq_add_mark_object(load->iseq, (VALUE)iseq);
9470-
}
94719452
return iseq;
94729453
}
94739454
}

0 commit comments

Comments
 (0)