ruby-changes:71077
From: Jemma <ko1@a...>
Date: Thu, 3 Feb 2022 02:20:59 +0900 (JST)
Subject: [ruby-changes:71077] 2913a2f5cf (master): Treat TS_ICVARC cache as separate from TS_IVC cache
https://git.ruby-lang.org/ruby.git/commit/?id=2913a2f5cf From 2913a2f5cfceb6d6b411e165d9c723bd2435eacd Mon Sep 17 00:00:00 2001 From: Jemma Issroff <jemmaissroff@g...> Date: Wed, 2 Feb 2022 09:14:59 -0500 Subject: Treat TS_ICVARC cache as separate from TS_IVC cache --- compile.c | 5 +++++ insns.def | 8 ++++---- iseq.c | 3 +++ misc/lldb_disasm.py | 2 ++ tool/ruby_vm/models/typemap.rb | 1 + 5 files changed, 15 insertions(+), 4 deletions(-) diff --git a/compile.c b/compile.c index 8fd1fd65f8..4b7d0e5a22 100644 --- a/compile.c +++ b/compile.c @@ -2401,6 +2401,7 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *const anchor) https://github.com/ruby/ruby/blob/trunk/compile.c#L2401 } case TS_IC: /* inline cache */ case TS_ISE: /* inline storage entry */ + case TS_ICVARC: /* inline cvar cache */ case TS_IVC: /* inline ivar cache */ { unsigned int ic_index = FIX2UINT(operands[j]); @@ -9900,6 +9901,7 @@ insn_data_to_s_detail(INSN *iobj) https://github.com/ruby/ruby/blob/trunk/compile.c#L9901 break; case TS_IC: /* inline cache */ case TS_IVC: /* inline ivar cache */ + case TS_ICVARC: /* inline cvar cache */ case TS_ISE: /* inline storage entry */ rb_str_catf(str, "<ic:%d>", FIX2INT(OPERAND_AT(iobj, j))); break; @@ -10293,6 +10295,7 @@ iseq_build_from_ary_body(rb_iseq_t *iseq, LINK_ANCHOR *const anchor, https://github.com/ruby/ruby/blob/trunk/compile.c#L10295 case TS_ISE: case TS_IC: case TS_IVC: /* inline ivar cache */ + case TS_ICVARC: /* inline cvar cache */ argv[j] = op; if (NUM2UINT(op) >= iseq->body->is_size) { iseq->body->is_size = NUM2INT(op) + 1; @@ -11109,6 +11112,7 @@ ibf_dump_code(struct ibf_dump *dump, const rb_iseq_t *iseq) https://github.com/ruby/ruby/blob/trunk/compile.c#L11112 break; case TS_IC: case TS_IVC: + case TS_ICVARC: case TS_ISE: { unsigned int i; @@ -11215,6 +11219,7 @@ ibf_load_code(const struct ibf_load *load, rb_iseq_t *iseq, ibf_offset_t bytecod https://github.com/ruby/ruby/blob/trunk/compile.c#L11219 case TS_ISE: case TS_IC: case TS_IVC: + case TS_ICVARC: { VALUE op = ibf_load_small_value(load, &reading_pos); code[code_index] = (VALUE)&is_entries[op]; diff --git a/insns.def b/insns.def index 30b7c626d7..d686118688 100644 --- a/insns.def +++ b/insns.def @@ -230,27 +230,27 @@ setinstancevariable https://github.com/ruby/ruby/blob/trunk/insns.def#L230 /* Get value of class variable id of klass as val. */ DEFINE_INSN getclassvariable -(ID id, IVC ic) +(ID id, ICVARC ic) () (VALUE val) /* "class variable access from toplevel" warning can be hooked. */ // attr bool leaf = false; /* has rb_warning() */ { rb_control_frame_t *cfp = GET_CFP(); - val = vm_getclassvariable(GET_ISEQ(), cfp, id, (ICVARC)ic); + val = vm_getclassvariable(GET_ISEQ(), cfp, id, ic); } /* Set value of class variable id of klass as val. */ DEFINE_INSN setclassvariable -(ID id, IVC ic) +(ID id, ICVARC ic) (VALUE val) () /* "class variable access from toplevel" warning can be hooked. */ // attr bool leaf = false; /* has rb_warning() */ { vm_ensure_not_refinement_module(GET_SELF()); - vm_setclassvariable(GET_ISEQ(), GET_CFP(), id, val, (ICVARC)ic); + vm_setclassvariable(GET_ISEQ(), GET_CFP(), id, val, ic); } /* Get constant variable id. If klass is Qnil and allow_nil is Qtrue, constants diff --git a/iseq.c b/iseq.c index f711367cfc..a2eb09f00f 100644 --- a/iseq.c +++ b/iseq.c @@ -196,6 +196,7 @@ iseq_extract_values(VALUE *code, size_t pos, iseq_value_itr_t * func, void *data https://github.com/ruby/ruby/blob/trunk/iseq.c#L196 } break; case TS_IVC: + case TS_ICVARC: { IVC ivc = (IVC)code[pos + op_no + 1]; if (ivc->entry) { @@ -2060,6 +2061,7 @@ rb_insn_operand_intern(const rb_iseq_t *iseq, https://github.com/ruby/ruby/blob/trunk/iseq.c#L2061 case TS_IC: case TS_IVC: + case TS_ICVARC: case TS_ISE: ret = rb_sprintf("<is:%"PRIdPTRDIFF">", (union iseq_inline_storage_entry *)op - iseq->body->is_entries); break; @@ -2893,6 +2895,7 @@ iseq_data_to_ary(const rb_iseq_t *iseq) https://github.com/ruby/ruby/blob/trunk/iseq.c#L2895 break; case TS_IC: case TS_IVC: + case TS_ICVARC: case TS_ISE: { union iseq_inline_storage_entry *is = (union iseq_inline_storage_entry *)*seq; diff --git a/misc/lldb_disasm.py b/misc/lldb_disasm.py index c02af52bc4..ff805ed428 100644 --- a/misc/lldb_disasm.py +++ b/misc/lldb_disasm.py @@ -27,6 +27,7 @@ class IseqDisassembler: https://github.com/ruby/ruby/blob/trunk/misc/lldb_disasm.py#L27 TS_CDHASH = b'H'[0] TS_IC = b'K'[0] TS_IVC = b'A'[0] + TS_ICVARC = b'J'[0] TS_ID = b'I'[0] TS_ISE = b'T'[0] TS_ISEQ = b'S'[0] @@ -48,6 +49,7 @@ class IseqDisassembler: https://github.com/ruby/ruby/blob/trunk/misc/lldb_disasm.py#L49 TS_ISE: "(iseq_inline_storage_entry *)%0#x", TS_ID: "ID: %0#x", TS_IVC: "(struct iseq_inline_iv_cache_entry *)%0#x", + TS_ICVARC: "(struct iseq_inline_cvar_cache_entry *)%0#x", TS_IC: "(struct iseq_inline_cache_entry *)%0#x", TS_CDHASH: "CDHASH (VALUE)%0#x", TS_CALLDATA: "(struct rb_call_data *)%0#x", diff --git a/tool/ruby_vm/models/typemap.rb b/tool/ruby_vm/models/typemap.rb index ed3aea7d2e..d762dd3321 100644 --- a/tool/ruby_vm/models/typemap.rb +++ b/tool/ruby_vm/models/typemap.rb @@ -16,6 +16,7 @@ RubyVM::Typemap = { https://github.com/ruby/ruby/blob/trunk/tool/ruby_vm/models/typemap.rb#L16 "CDHASH" => %w[H TS_CDHASH], "IC" => %w[K TS_IC], "IVC" => %w[A TS_IVC], + "ICVARC" => %w[J TS_ICVARC], "ID" => %w[I TS_ID], "ISE" => %w[T TS_ISE], "ISEQ" => %w[S TS_ISEQ], -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/