diff options
-rw-r--r-- | bootstraptest/test_yjit.rb | 10 | ||||
-rw-r--r-- | yjit_codegen.c | 10 |
2 files changed, 19 insertions, 1 deletions
diff --git a/bootstraptest/test_yjit.rb b/bootstraptest/test_yjit.rb index 4bf9bc4262..14b901fbf1 100644 --- a/bootstraptest/test_yjit.rb +++ b/bootstraptest/test_yjit.rb @@ -26,6 +26,16 @@ assert_equal '2', %q{ mod(7, 5) } +# Test for opt_mult +assert_equal '12', %q{ + def mult(a, b) + a * b + end + + mult(6, 2) + mult(6, 2) +} + # BOP redefined methods work when JIT compiled assert_equal 'false', %q{ def less_than x diff --git a/yjit_codegen.c b/yjit_codegen.c index 0c1b0da7a4..ab838a233a 100644 --- a/yjit_codegen.c +++ b/yjit_codegen.c @@ -1794,7 +1794,7 @@ gen_opt_aset(jitstate_t *jit, ctx_t *ctx) x86opnd_t arg1 = ctx_stack_pop(ctx, 1); x86opnd_t arg0 = ctx_stack_pop(ctx, 1); - // Call rb_vm_opt_mod(VALUE recv, VALUE obj) + // Call rb_vm_opt_aset(VALUE recv, VALUE obj) yjit_save_regs(cb); mov(cb, C_ARG_REGS[0], arg0); mov(cb, C_ARG_REGS[1], arg1); @@ -1933,6 +1933,13 @@ gen_opt_plus(jitstate_t* jit, ctx_t* ctx) return YJIT_KEEP_COMPILING; } +static codegen_status_t +gen_opt_mult(jitstate_t* jit, ctx_t* ctx) +{ + // Delegate to send, call the method on the recv + return gen_opt_send_without_block(jit, ctx); +} + VALUE rb_vm_opt_mod(VALUE recv, VALUE obj); static codegen_status_t @@ -3462,6 +3469,7 @@ yjit_init_codegen(void) yjit_reg_op(BIN(opt_or), gen_opt_or); yjit_reg_op(BIN(opt_minus), gen_opt_minus); yjit_reg_op(BIN(opt_plus), gen_opt_plus); + yjit_reg_op(BIN(opt_mult), gen_opt_mult); yjit_reg_op(BIN(opt_mod), gen_opt_mod); yjit_reg_op(BIN(opt_ltlt), gen_opt_ltlt); yjit_reg_op(BIN(opt_nil_p), gen_opt_nil_p); |