Skip to content

Commit

Permalink
RJIT: Automate function pointer imports
Browse files Browse the repository at this point in the history
  • Loading branch information
k0kubun committed Mar 12, 2023
1 parent 47a6cfc commit 58f7e8b
Show file tree
Hide file tree
Showing 5 changed files with 213 additions and 195 deletions.
2 changes: 1 addition & 1 deletion lib/ruby_vm/rjit/exit_compiler.rb
Expand Up @@ -43,7 +43,7 @@ def compile_full_cfunc_return(asm)
asm.comment('full cfunc return')
asm.mov(C_ARGS[0], EC)
asm.mov(C_ARGS[1], :rax)
asm.call(C.rb_full_cfunc_return)
asm.call(C.rjit_full_cfunc_return)

# TODO: count the exit

Expand Down
4 changes: 2 additions & 2 deletions lib/ruby_vm/rjit/insn_compiler.rb
Expand Up @@ -2713,7 +2713,7 @@ def jit_equality_specialized(jit, ctx, asm, gen_eq)
asm.comment('call rb_str_eql_internal')
asm.mov(C_ARGS[0], a_opnd)
asm.mov(C_ARGS[1], b_opnd)
asm.call(gen_eq ? C.rb_str_eql_internal : C.rb_str_neq_internal)
asm.call(gen_eq ? C.rb_str_eql_internal : C.rjit_str_neq_internal)

# Push the output on the stack
ctx.stack_pop(2)
Expand Down Expand Up @@ -3552,7 +3552,7 @@ def jit_call_opt_call(jit, ctx, asm, cme, flags, argc, block_handler, known_recv
asm.lea(C_ARGS[3], [:rax, -argc * C.VALUE.size]) # stack_argument_pointer. NOTE: C_ARGS[3] is rcx
asm.mov(C_ARGS[4], kw_splat)
asm.mov(C_ARGS[5], C.VM_BLOCK_HANDLER_NONE)
asm.call(C.rb_optimized_call)
asm.call(C.rjit_optimized_call)

ctx.stack_pop(argc + 1)

Expand Down
14 changes: 13 additions & 1 deletion rjit_c.c
Expand Up @@ -288,8 +288,20 @@ rjit_for_each_iseq(rb_execution_context_t *ec, VALUE self, VALUE block)
return Qnil;
}

extern bool rb_simple_iseq_p(const rb_iseq_t *iseq);
// bindgen funcs
extern ID rb_get_symbol_id(VALUE name);
extern VALUE rb_fix_aref(VALUE fix, VALUE idx);
extern VALUE rb_str_getbyte(VALUE str, VALUE index);
extern VALUE rb_vm_concat_array(VALUE ary1, VALUE ary2st);
extern VALUE rb_vm_get_ev_const(rb_execution_context_t *ec, VALUE orig_klass, ID id, VALUE allow_nil);
extern VALUE rb_vm_getclassvariable(const rb_iseq_t *iseq, const rb_control_frame_t *cfp, ID id, ICVARC ic);
extern VALUE rb_vm_opt_newarray_min(rb_execution_context_t *ec, rb_num_t num, const VALUE *ptr);
extern VALUE rb_vm_splat_array(VALUE flag, VALUE array);
extern bool rb_simple_iseq_p(const rb_iseq_t *iseq);
extern bool rb_vm_defined(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp, rb_num_t op_type, VALUE obj, VALUE v);
extern bool rb_vm_ic_hit_p(IC ic, const VALUE *reg_ep);
extern rb_event_flag_t rb_rjit_global_events;
extern void rb_vm_setinstancevariable(const rb_iseq_t *iseq, VALUE obj, ID id, VALUE val, IVC ic);

#include "rjit_c.rbinc"

Expand Down

0 comments on commit 58f7e8b

Please sign in to comment.