summaryrefslogtreecommitdiff
path: root/rjit_c.c
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2023-04-02 12:56:27 -0700
committerTakashi Kokubun <takashikkbn@gmail.com>2023-04-02 13:58:39 -0700
commit66f8efc342bd36ae14090f14e7c2b9a0e30b9be3 (patch)
tree0be84b050006a8e3ef30d3c7f3c75ef29a0f8780 /rjit_c.c
parent284a0ff96c97be0c2413e3fb59a7874e4092c90b (diff)
downloadruby-66f8efc342bd36ae14090f14e7c2b9a0e30b9be3.tar.gz
RJIT: Simplify cfunc implementation
Diffstat (limited to 'rjit_c.c')
-rw-r--r--rjit_c.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/rjit_c.c b/rjit_c.c
index 9e442f5f6f..7b5376701a 100644
--- a/rjit_c.c
+++ b/rjit_c.c
@@ -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.