ruby-changes:57963
From: Aaron <ko1@a...>
Date: Fri, 27 Sep 2019 06:52:55 +0900 (JST)
Subject: [ruby-changes:57963] 0846d48853 (master): Remove `iseq_add_mark_object_compile_time`
https://git.ruby-lang.org/ruby.git/commit/?id=0846d48853 From 0846d48853d460de50dda477d8c75024ba96679b Mon Sep 17 00:00:00 2001 From: Aaron Patterson <tenderlove@r...> Date: Thu, 26 Sep 2019 13:16:33 -0700 Subject: Remove `iseq_add_mark_object_compile_time` This function is just a synonym for RB_OBJ_WRITTEN, so we can just directly call that. diff --git a/compile.c b/compile.c index 004d386..a95b9c2 100644 --- a/compile.c +++ b/compile.c @@ -575,15 +575,6 @@ APPEND_ELEM(ISEQ_ARG_DECLARE LINK_ANCHOR *const anchor, LINK_ELEMENT *before, LI https://github.com/ruby/ruby/blob/trunk/compile.c#L575 #define ISEQ_LAST_LINE(iseq) (ISEQ_COMPILE_DATA(iseq)->last_line) -static int -iseq_add_mark_object_compile_time(const rb_iseq_t *iseq, VALUE v) -{ - if (!SPECIAL_CONST_P(v)) { - RB_OBJ_WRITTEN(iseq, Qundef, v); - } - return COMPILE_OK; -} - static inline VALUE freeze_literal(rb_iseq_t *iseq, VALUE lit) { @@ -2825,7 +2816,7 @@ iseq_peephole_optimize(rb_iseq_t *iseq, LINK_ELEMENT *list, const int do_tailcal https://github.com/ruby/ruby/blob/trunk/compile.c#L2816 ELEM_REMOVE(&end->link); range->insn_id = BIN(putobject); OPERAND_AT(range, 0) = lit_range; - iseq_add_mark_object_compile_time(iseq, lit_range); + RB_OBJ_WRITTEN(iseq, Qundef, lit_range); } } @@ -3655,7 +3646,7 @@ compile_dstr_fragments(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *cons https://github.com/ruby/ruby/blob/trunk/compile.c#L3646 } lit = freeze_literal(iseq, lit); ADD_INSN1(ret, nd_line(node), putobject, lit); - iseq_add_mark_object_compile_time(iseq, lit); + RB_OBJ_WRITTEN(iseq, Qundef, lit); if (RSTRING_LEN(lit) == 0) first_lit = LAST_ELEMENT(ret); } @@ -3664,7 +3655,7 @@ compile_dstr_fragments(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *cons https://github.com/ruby/ruby/blob/trunk/compile.c#L3655 if (nd_type(head) == NODE_STR) { lit = freeze_literal(iseq, head->nd_lit); ADD_INSN1(ret, nd_line(head), putobject, lit); - iseq_add_mark_object_compile_time(iseq, lit); + RB_OBJ_WRITTEN(iseq, Qundef, lit); lit = Qnil; } else { @@ -4025,7 +4016,7 @@ compile_array(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, int pop https://github.com/ruby/ruby/blob/trunk/compile.c#L4016 ADD_INSN1(ret, line, putobject, ary); ADD_INSN(ret, line, concatarray); } - iseq_add_mark_object_compile_time(iseq, ary); + RB_OBJ_WRITTEN(iseq, Qundef, ary); } } @@ -4165,7 +4156,7 @@ compile_hash(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, int popp https://github.com/ruby/ruby/blob/trunk/compile.c#L4156 ADD_SEND(ret, line, id_core_hash_merge_kwd, INT2FIX(2)); } - iseq_add_mark_object_compile_time(iseq, hash); + RB_OBJ_WRITTEN(iseq, Qundef, hash); } } @@ -4283,7 +4274,7 @@ when_vals(rb_iseq_t *iseq, LINK_ANCHOR *const cond_seq, const NODE *vals, https://github.com/ruby/ruby/blob/trunk/compile.c#L4274 debugp_param("nd_lit", val->nd_lit); lit = freeze_literal(iseq, val->nd_lit); ADD_INSN1(cond_seq, nd_line(val), putobject, lit); - iseq_add_mark_object_compile_time(iseq, lit); + RB_OBJ_WRITTEN(iseq, Qundef, lit); } else { if (!COMPILE(cond_seq, "when cond", val)) return -1; @@ -5046,7 +5037,7 @@ build_postexe_iseq(rb_iseq_t *iseq, LINK_ANCHOR *ret, const void *ptr) https://github.com/ruby/ruby/blob/trunk/compile.c#L5037 ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE)); ADD_CALL_WITH_BLOCK(ret, line, id_core_set_postexe, argc, block); - iseq_add_mark_object_compile_time(iseq, (VALUE)block); + RB_OBJ_WRITTEN(iseq, Qundef, (VALUE)block); iseq_set_local_table(iseq, 0); } @@ -5315,7 +5306,7 @@ compile_case(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const orig_nod https://github.com/ruby/ruby/blob/trunk/compile.c#L5306 if (only_special_literals && ISEQ_COMPILE_DATA(iseq)->option->specialized_instruction) { ADD_INSN(ret, nd_line(orig_node), dup); ADD_INSN2(ret, nd_line(orig_node), opt_case_dispatch, literals, elselabel); - iseq_add_mark_object_compile_time(iseq, literals); + RB_OBJ_WRITTEN(iseq, Qundef, literals); LABEL_REF(elselabel); } @@ -5677,7 +5668,7 @@ iseq_compile_pattern_each(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *c https://github.com/ruby/ruby/blob/trunk/compile.c#L5668 } else { ADD_INSN1(ret, line, duparray, keys); - iseq_add_mark_object_compile_time(iseq, rb_obj_hide(keys)); + RB_OBJ_WRITTEN(iseq, Qundef, rb_obj_hide(keys)); } ADD_SEND(ret, line, rb_intern("deconstruct_keys"), INT2FIX(1)); @@ -6666,7 +6657,7 @@ compile_call_precheck_freeze(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE https://github.com/ruby/ruby/blob/trunk/compile.c#L6657 new_callinfo(iseq, idFreeze, 0, 0, NULL, FALSE), Qundef /* CALL_CACHE */); } - iseq_add_mark_object_compile_time(iseq, str); + RB_OBJ_WRITTEN(iseq, Qundef, str); if (popped) { ADD_INSN(ret, line, pop); } @@ -6686,7 +6677,7 @@ compile_call_precheck_freeze(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE https://github.com/ruby/ruby/blob/trunk/compile.c#L6677 ADD_INSN3(ret, line, opt_aref_with, str, new_callinfo(iseq, idAREF, 1, 0, NULL, FALSE), NULL/* CALL_CACHE */); - iseq_add_mark_object_compile_time(iseq, str); + RB_OBJ_WRITTEN(iseq, Qundef, str); if (popped) { ADD_INSN(ret, line, pop); } @@ -7763,7 +7754,7 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in https://github.com/ruby/ruby/blob/trunk/compile.c#L7754 if (!ISEQ_COMPILE_DATA(iseq)->option->frozen_string_literal) { lit = freeze_literal(iseq, lit); ADD_INSN1(ret, line, putstring, lit); - iseq_add_mark_object_compile_time(iseq, lit); + RB_OBJ_WRITTEN(iseq, Qundef, lit); } else { if (ISEQ_COMPILE_DATA(iseq)->option->debug_frozen_string_literal || RTEST(ruby_debug)) { @@ -7776,7 +7767,7 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in https://github.com/ruby/ruby/blob/trunk/compile.c#L7767 lit = rb_fstring(lit); } ADD_INSN1(ret, line, putobject, lit); - iseq_add_mark_object_compile_time(iseq, lit); + RB_OBJ_WRITTEN(iseq, Qundef, lit); } } break; @@ -7795,7 +7786,7 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in https://github.com/ruby/ruby/blob/trunk/compile.c#L7786 } ADD_INSN1(ret, line, freezestring, debug_info); if (!NIL_P(debug_info)) { - iseq_add_mark_object_compile_time(iseq, rb_obj_freeze(debug_info)); + RB_OBJ_WRITTEN(iseq, Qundef, rb_obj_freeze(debug_info)); } } } @@ -7805,7 +7796,7 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in https://github.com/ruby/ruby/blob/trunk/compile.c#L7796 ADD_CALL_RECEIVER(ret, line); VALUE str = freeze_literal(iseq, node->nd_lit); ADD_INSN1(ret, line, putobject, str); - iseq_add_mark_object_compile_time(iseq, str); + RB_OBJ_WRITTEN(iseq, Qundef, str); ADD_CALL(ret, line, idBackquote, INT2FIX(1)); if (popped) { @@ -7840,7 +7831,7 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in https://github.com/ruby/ruby/blob/trunk/compile.c#L7831 block_iseq = NEW_CHILD_ISEQ(node->nd_body, make_name_for_block(iseq), ISEQ_TYPE_PLAIN, line); ADD_INSN2(ret, line, once, block_iseq, INT2FIX(ic_index)); - iseq_add_mark_object_compile_time(iseq, (VALUE)block_iseq); + RB_OBJ_WRITTEN(iseq, Qundef, (VALUE)block_iseq); if (popped) { ADD_INSN(ret, line, pop); @@ -7895,7 +7886,7 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in https://github.com/ruby/ruby/blob/trunk/compile.c#L7886 debugp_param("defn/iseq", rb_iseqw_new(method_iseq)); ADD_INSN2(ret, line, definemethod, ID2SYM(mid), method_iseq); - iseq_add_mark_object_compile_time(iseq, (VALUE)method_iseq); + RB_OBJ_WRITTEN(iseq, Qundef, (VALUE)method_iseq); if (!popped) { ADD_INSN1(ret, line, putobject, ID2SYM(mid)); @@ -7912,7 +7903,7 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in https://github.com/ruby/ruby/blob/trunk/compile.c#L7903 debugp_param("defs/iseq", rb_iseqw_new(singleton_method_iseq)); CHECK(COMPILE(ret, "defs: recv", node->nd_recv)); ADD_INSN2(ret, line, definesmethod, ID2SYM(mid), singleton_method_iseq); - iseq_add_mark_object_compile_time(iseq, (VALUE)singleton_method_iseq); + RB_OBJ_WRITTEN(iseq, Qundef, (VALUE)singleton_method_iseq); if (!popped) { ADD_INSN1(ret, line, putobject, ID2SYM(mid)); @@ -7963,7 +7954,7 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in https://github.com/ruby/ruby/blob/trunk/compile.c#L7954 CHECK(COMPILE(ret, "super", node->nd_super)); ADD_INSN3(ret, line, defineclass, ID2SYM(node->nd_cpath->nd_mid), class_iseq, INT2FIX(flags)); - iseq_add_mark_object_compile_time(iseq, (VALUE)class_iseq); + RB_OBJ_WRITTEN(iseq, Qundef, (VALUE)class_iseq); if (popped) { ADD_INSN(ret, line, pop); @@ -7979,7 +7970,7 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in https://github.com/ruby/ruby/blob/trunk/compile.c#L7970 ADD_INSN (ret, line, putnil); /* dummy */ ADD_INSN3(ret, line, defineclass, ID2SYM(node->nd_cpath->nd_mid), module_iseq, INT2FIX(flags)); - (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/