diff options
author | Takashi Kokubun <takashikkbn@gmail.com> | 2023-04-02 12:56:27 -0700 |
---|---|---|
committer | Takashi Kokubun <takashikkbn@gmail.com> | 2023-04-02 13:58:39 -0700 |
commit | 66f8efc342bd36ae14090f14e7c2b9a0e30b9be3 (patch) | |
tree | 0be84b050006a8e3ef30d3c7f3c75ef29a0f8780 /rjit_c.c | |
parent | 284a0ff96c97be0c2413e3fb59a7874e4092c90b (diff) |
RJIT: Simplify cfunc implementation
Diffstat (limited to 'rjit_c.c')
-rw-r--r-- | rjit_c.c | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -183,6 +183,21 @@ rjit_rb_ary_subseq_length(VALUE ary, long beg) return rb_ary_subseq(ary, beg, len); } +static VALUE +rjit_build_kwhash(const struct rb_callinfo *ci, VALUE *sp) +{ + const struct rb_callinfo_kwarg *kw_arg = vm_ci_kwarg(ci); + int kw_len = kw_arg->keyword_len; + VALUE hash = rb_hash_new_with_size(kw_len); + + for (int i = 0; i < kw_len; i++) { + VALUE key = kw_arg->keywords[i]; + VALUE val = *(sp - kw_len + i); + rb_hash_aset(hash, key, val); + } + return hash; +} + // The code we generate in gen_send_cfunc() doesn't fire the c_return TracePoint event // like the interpreter. When tracing for c_return is enabled, we patch the code after // the C method return to call into this to fire the event. |