ruby-changes:69154
From: Maxime <ko1@a...>
Date: Thu, 21 Oct 2021 08:21:02 +0900 (JST)
Subject: [ruby-changes:69154] 0c1aa17556 (master): Remove a few more uses of the global cb/ocb
https://git.ruby-lang.org/ruby.git/commit/?id=0c1aa17556 From 0c1aa17556357ca3cb5802d7a23965ed820973e4 Mon Sep 17 00:00:00 2001 From: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@s...> Date: Wed, 22 Sep 2021 16:16:26 -0400 Subject: Remove a few more uses of the global cb/ocb --- yjit_codegen.c | 10 ++++++---- yjit_codegen.h | 2 +- yjit_core.c | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/yjit_codegen.c b/yjit_codegen.c index 2ee00cd464..29b9d21781 100644 --- a/yjit_codegen.c +++ b/yjit_codegen.c @@ -170,6 +170,7 @@ jit_peek_at_local(jitstate_t *jit, ctx_t *ctx, int n) https://github.com/ruby/ruby/blob/trunk/yjit_codegen.c#L170 static void jit_save_pc(jitstate_t* jit, x86opnd_t scratch_reg) { + codeblock_t* cb = jit->cb; mov(cb, scratch_reg, const_ptr_opnd(jit->pc + insn_len(jit->opcode))); mov(cb, mem_opnd(64, REG_CFP, offsetof(rb_control_frame_t, pc)), scratch_reg); } @@ -183,6 +184,7 @@ jit_save_sp(jitstate_t* jit, ctx_t* ctx) https://github.com/ruby/ruby/blob/trunk/yjit_codegen.c#L184 { if (ctx->sp_offset != 0) { x86opnd_t stack_pointer = ctx_sp_opnd(ctx, 0); + codeblock_t* cb = jit->cb; lea(cb, REG_SP, stack_pointer); mov(cb, member_opnd(REG_CFP, rb_control_frame_t, sp), REG_SP); ctx->sp_offset = 0; @@ -415,6 +417,7 @@ static uint8_t * https://github.com/ruby/ruby/blob/trunk/yjit_codegen.c#L417 yjit_side_exit(jitstate_t *jit, ctx_t *ctx) { if (!jit->side_exit_for_pc) { + codeblock_t* ocb = jit->ocb; uint32_t pos = yjit_gen_exit(jit->pc, ctx, ocb); jit->side_exit_for_pc = cb_get_ptr(ocb, pos); } @@ -428,7 +431,7 @@ yjit_side_exit(jitstate_t *jit, ctx_t *ctx) https://github.com/ruby/ruby/blob/trunk/yjit_codegen.c#L431 // PC for the method isn't necessarily 0, but we always generated code that // assumes the entry point is 0. static void -yjit_pc_guard(const rb_iseq_t *iseq) +yjit_pc_guard(codeblock_t* cb, const rb_iseq_t *iseq) { RUBY_ASSERT(cb != NULL); @@ -470,7 +473,6 @@ full_cfunc_return(rb_execution_context_t *ec, VALUE return_value) https://github.com/ruby/ruby/blob/trunk/yjit_codegen.c#L473 // CHECK_CFP_CONSISTENCY("full_cfunc_return"); TODO revive this - // Pop the C func's frame and fire the c_return TracePoint event // Note that this is the same order as vm_call_cfunc_with_frame(). rb_vm_pop_frame(ec); @@ -518,7 +520,7 @@ Compile an interpreter entry block to be inserted into an iseq https://github.com/ruby/ruby/blob/trunk/yjit_codegen.c#L520 Returns `NULL` if compilation fails. */ uint8_t * -yjit_entry_prologue(const rb_iseq_t *iseq) +yjit_entry_prologue(codeblock_t* cb, const rb_iseq_t *iseq) { RUBY_ASSERT(cb != NULL); @@ -555,7 +557,7 @@ yjit_entry_prologue(const rb_iseq_t *iseq) https://github.com/ruby/ruby/blob/trunk/yjit_codegen.c#L557 // compiled for is the same PC that the interpreter wants us to run with. // If they don't match, then we'll take a side exit. if (iseq->body->param.flags.has_opt) { - yjit_pc_guard(iseq); + yjit_pc_guard(cb, iseq); } return code_ptr; diff --git a/yjit_codegen.h b/yjit_codegen.h index 75edcc8da8..6d5fc27479 100644 --- a/yjit_codegen.h +++ b/yjit_codegen.h @@ -18,7 +18,7 @@ typedef enum codegen_status { https://github.com/ruby/ruby/blob/trunk/yjit_codegen.h#L18 // Code generation function signature typedef codegen_status_t (*codegen_fn)(jitstate_t* jit, ctx_t* ctx, codeblock_t* cb); -uint8_t* yjit_entry_prologue(const rb_iseq_t* iseq); +uint8_t* yjit_entry_prologue(codeblock_t* cb, const rb_iseq_t* iseq); void yjit_gen_block(block_t* block, rb_execution_context_t* ec); diff --git a/yjit_core.c b/yjit_core.c index 8090cdd80a..64f7b21156 100644 --- a/yjit_core.c +++ b/yjit_core.c @@ -719,7 +719,7 @@ uint8_t* gen_entry_point(const rb_iseq_t *iseq, uint32_t insn_idx, rb_execution_ https://github.com/ruby/ruby/blob/trunk/yjit_core.c#L719 blockid_t blockid = { iseq, insn_idx }; // Write the interpreter entry prologue - uint8_t* code_ptr = yjit_entry_prologue(iseq); + uint8_t* code_ptr = yjit_entry_prologue(cb, iseq); // Try to generate code for the entry block block_t* block = gen_block_version(blockid, &DEFAULT_CTX, ec); -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/