From 2c8d186c6e4fd03ea57466fa6dce6bad40d09401 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 11 Oct 2019 17:06:41 -0700 Subject: Introduce an "Inline IVAR cache" struct This commit introduces an "inline ivar cache" struct. The reason we need this is so compaction can differentiate from an ivar cache and a regular inline cache. Regular inline caches contain references to `VALUE` and ivar caches just contain references to the ivar index. With this new struct we can easily update references for inline caches (but not inline var caches as they just contain an int) --- tool/ruby_vm/models/typemap.rb | 1 + tool/ruby_vm/views/_mjit_compile_ivar.erb | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'tool') diff --git a/tool/ruby_vm/models/typemap.rb b/tool/ruby_vm/models/typemap.rb index 015aa05632..c4b13f67f9 100644 --- a/tool/ruby_vm/models/typemap.rb +++ b/tool/ruby_vm/models/typemap.rb @@ -16,6 +16,7 @@ RubyVM::Typemap = { "CDHASH" => %w[H TS_CDHASH], "GENTRY" => %w[G TS_GENTRY], "IC" => %w[K TS_IC], + "IVC" => %w[A TS_IVC], "ID" => %w[I TS_ID], "ISE" => %w[T TS_ISE], "ISEQ" => %w[S TS_ISEQ], diff --git a/tool/ruby_vm/views/_mjit_compile_ivar.erb b/tool/ruby_vm/views/_mjit_compile_ivar.erb index 4b4dcec828..57f8d14b76 100644 --- a/tool/ruby_vm/views/_mjit_compile_ivar.erb +++ b/tool/ruby_vm/views/_mjit_compile_ivar.erb @@ -13,8 +13,8 @@ % insn.opes.each_with_index do |ope, i| MAYBE_UNUSED(<%= ope.fetch(:decl) %>) = (<%= ope.fetch(:type) %>)operands[<%= i %>]; % end -% # compiler: Use copied IC to avoid race condition - IC ic_copy = &(status->is_entries + ((union iseq_inline_storage_entry *)ic - body->is_entries))->cache; +% # compiler: Use copied IVC to avoid race condition + IVC ic_copy = &(status->is_entries + ((union iseq_inline_storage_entry *)ic - body->is_entries))->iv_cache; % % # compiler: Consider cfp->self as T_OBJECT if ic_copy->ic_serial is set if (!status->compile_info->disable_ivar_cache && ic_copy->ic_serial) { @@ -25,7 +25,7 @@ fprintf(f, "{\n"); fprintf(f, " VALUE obj = GET_SELF();\n"); fprintf(f, " const rb_serial_t ic_serial = (rb_serial_t)%"PRI_SERIALT_PREFIX"u;\n", ic_copy->ic_serial); - fprintf(f, " const st_index_t index = %"PRIuSIZE";\n", ic_copy->ic_value.index); + fprintf(f, " const st_index_t index = %"PRIuSIZE";\n", ic_copy->index); % # JIT: cache hit path of vm_getivar, or cancel JIT. % if insn.name == 'setinstancevariable' fprintf(f, " VALUE val = stack[%d];\n", b->stack_size - 1); -- cgit v1.2.3