From 5f10bd634fb6ae8f74a4ea730176233b0ca96954 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Wed, 23 Mar 2022 15:19:48 -0400 Subject: Add ISEQ_BODY macro Use ISEQ_BODY macro to get the rb_iseq_constant_body of the ISeq. Using this macro will make it easier for us to change the allocation strategy of rb_iseq_constant_body when using Variable Width Allocation. --- tool/mk_builtin_loader.rb | 2 +- tool/ruby_vm/views/_mjit_compile_send.erb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'tool') diff --git a/tool/mk_builtin_loader.rb b/tool/mk_builtin_loader.rb index 02941735f7..23e6a01017 100644 --- a/tool/mk_builtin_loader.rb +++ b/tool/mk_builtin_loader.rb @@ -321,7 +321,7 @@ def mk_builtin_header file f.puts %' fprintf(f, " const VALUE *argv = &stack[%d];\\n", stack_size - #{argc});' f.puts %' }' f.puts %' else {' - f.puts %' fprintf(f, " const unsigned int lnum = GET_ISEQ()->body->local_table_size;\\n");' + f.puts %' fprintf(f, " const unsigned int lnum = ISEQ_BODY(GET_ISEQ())->local_table_size;\\n");' f.puts %' fprintf(f, " const VALUE *argv = GET_EP() - lnum - VM_ENV_DATA_SIZE + 1 + %ld;\\n", index);' f.puts %' }' end diff --git a/tool/ruby_vm/views/_mjit_compile_send.erb b/tool/ruby_vm/views/_mjit_compile_send.erb index 28e316a1ef..8900ee6425 100644 --- a/tool/ruby_vm/views/_mjit_compile_send.erb +++ b/tool/ruby_vm/views/_mjit_compile_send.erb @@ -54,7 +54,7 @@ <%= render 'mjit_compile_pc_and_sp', locals: { insn: insn } -%> % # JIT: If ISeq is inlinable, call the inlined method without pushing a frame. - if (iseq && status->inlined_iseqs != NULL && iseq->body == status->inlined_iseqs[pos]) { + if (iseq && status->inlined_iseqs != NULL && ISEQ_BODY(iseq) == status->inlined_iseqs[pos]) { fprintf(f, " {\n"); fprintf(f, " VALUE orig_self = reg_cfp->self;\n"); fprintf(f, " reg_cfp->self = stack[%d];\n", b->stack_size + sp_inc - 1); @@ -84,8 +84,8 @@ } else { // VM_METHOD_TYPE_ISEQ % # fastpath_applied_iseq_p checks rb_simple_iseq_p, which ensures has_opt == FALSE - fprintf(f, " vm_call_iseq_setup_normal(ec, reg_cfp, &calling, cc_cme, 0, %d, %d);\n", iseq->body->param.size, iseq->body->local_table_size); - if (iseq->body->catch_except_p) { + fprintf(f, " vm_call_iseq_setup_normal(ec, reg_cfp, &calling, cc_cme, 0, %d, %d);\n", ISEQ_BODY(iseq)->param.size, ISEQ_BODY(iseq)->local_table_size); + if (ISEQ_BODY(iseq)->catch_except_p) { fprintf(f, " VM_ENV_FLAGS_SET(ec->cfp->ep, VM_FRAME_FLAG_FINISH);\n"); fprintf(f, " val = vm_exec(ec, true);\n"); } -- cgit v1.2.3