diff options
author | 卜部昌平 <shyouhei@ruby-lang.org> | 2019-08-26 14:25:53 +0900 |
---|---|---|
committer | 卜部昌平 <shyouhei@ruby-lang.org> | 2019-08-27 15:52:26 +0900 |
commit | b8fd2e83e7b18fe3c70fc342388b1cb054b22e42 (patch) | |
tree | ede1f096b9a970a831f036323915b1b76f40aa17 /vm_core.h | |
parent | 7329b3339adab12092056bd8159513645d4f9e8a (diff) | |
download | ruby-b8fd2e83e7b18fe3c70fc342388b1cb054b22e42.tar.gz |
decouple compile.c usage of imemo_ifunc
After 5e86b005c0f2ef30df2f9906c7e2f3abefe286a2, I now think ANYARGS is
dangerous and should be extinct. This commit deletes ANYARGS from
struct vm_ifunc, but in doing so we also have to decouple the usage
of this struct in compile.c, which (I think) is an abuse of ANYARGS.
Diffstat (limited to 'vm_core.h')
-rw-r--r-- | vm_core.h | 19 |
1 files changed, 17 insertions, 2 deletions
@@ -1022,8 +1022,23 @@ rb_iseq_t *rb_iseq_new_top (const rb_ast_body_t *ast, VALUE name, VALUE path rb_iseq_t *rb_iseq_new_main (const rb_ast_body_t *ast, VALUE path, VALUE realpath, const rb_iseq_t *parent); rb_iseq_t *rb_iseq_new_with_opt(const rb_ast_body_t *ast, VALUE name, VALUE path, VALUE realpath, VALUE first_lineno, const rb_iseq_t *parent, enum iseq_type, const rb_compile_option_t*); -rb_iseq_t *rb_iseq_new_ifunc(const struct vm_ifunc *ifunc, VALUE name, VALUE path, VALUE realpath, VALUE first_lineno, - const rb_iseq_t *parent, enum iseq_type, const rb_compile_option_t*); +struct iseq_link_anchor; +struct rb_iseq_new_with_callback_callback_func { + VALUE flags; + VALUE reserved; + void (*func)(rb_iseq_t *, struct iseq_link_anchor *, const void *); + const void *data; +}; +static inline struct rb_iseq_new_with_callback_callback_func * +rb_iseq_new_with_callback_new_callback( + void (*func)(rb_iseq_t *, struct iseq_link_anchor *, const void *), const void *ptr) +{ + VALUE memo = rb_imemo_new(imemo_ifunc, (VALUE)func, (VALUE)ptr, Qundef, Qfalse); + return (struct rb_iseq_new_with_callback_callback_func *)memo; +} +rb_iseq_t *rb_iseq_new_with_callback(const struct rb_iseq_new_with_callback_callback_func * ifunc, + VALUE name, VALUE path, VALUE realpath, VALUE first_lineno, + const rb_iseq_t *parent, enum iseq_type, const rb_compile_option_t*); /* src -> iseq */ rb_iseq_t *rb_iseq_compile(VALUE src, VALUE file, VALUE line); |