diff options
author | Peter Zhu <peter@peterzhu.ca> | 2024-02-20 15:58:10 -0500 |
---|---|---|
committer | Peter Zhu <peter@peterzhu.ca> | 2024-02-21 11:33:05 -0500 |
commit | 330830dd1a44b6e497250a14d93efae6fa363f82 (patch) | |
tree | 864fc9a6ba29c91fcbeb0c9c439e99b7d7fb0a04 /proc.c | |
parent | 2e6f8554f8c4ec12f620f31d4a110066ee76bfbe (diff) |
Add IMEMO_NEW
Rather than exposing that an imemo has a flag and four fields, this
changes the implementation to only expose one field (the klass) and
fills the rest with 0. The type will have to fill in the values themselves.
Diffstat (limited to 'proc.c')
-rw-r--r-- | proc.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -719,8 +719,13 @@ rb_vm_ifunc_new(rb_block_call_func_t func, const void *data, int min_argc, int m arity.argc.min = min_argc; arity.argc.max = max_argc; rb_execution_context_t *ec = GET_EC(); - VALUE ret = rb_imemo_new(imemo_ifunc, (VALUE)func, (VALUE)data, arity.packed, (VALUE)rb_vm_svar_lep(ec, ec->cfp)); - return (struct vm_ifunc *)ret; + + struct vm_ifunc *ifunc = IMEMO_NEW(struct vm_ifunc, imemo_ifunc, (VALUE)rb_vm_svar_lep(ec, ec->cfp)); + ifunc->func = func; + ifunc->data = data; + ifunc->argc = arity.argc; + + return ifunc; } VALUE |