summaryrefslogtreecommitdiff
path: root/mjit_compiler.c
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2022-11-27 15:15:52 -0800
committerTakashi Kokubun <takashikkbn@gmail.com>2022-11-27 21:11:33 -0800
commit6844bcc6b4cdc50def1c0d30d4e8b5045fb43443 (patch)
treee76f3b03120395c52007d1fcaec6e42ace508561 /mjit_compiler.c
parent6d26f78f684607a39249882ea686a231f8768bd5 (diff)
MJIT: Use a String buffer in builtin compilers
instead of FILE*. Using C.fprintf is slower than String manipulation on memory. I'm going to change the way MJIT writes files, and this is a prerequisite for it.
Diffstat (limited to 'mjit_compiler.c')
-rw-r--r--mjit_compiler.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/mjit_compiler.c b/mjit_compiler.c
index 6b2ff433e2..0e9f499424 100644
--- a/mjit_compiler.c
+++ b/mjit_compiler.c
@@ -143,11 +143,11 @@ cdhash_to_hash(rb_execution_context_t *ec, VALUE self, VALUE cdhash_addr)
}
static VALUE
-builtin_compile(rb_execution_context_t *ec, VALUE self, VALUE f_addr, VALUE bf_addr, VALUE index, VALUE stack_size, VALUE builtin_inline_p)
+builtin_compile(rb_execution_context_t *ec, VALUE self, VALUE buf, VALUE bf_addr, VALUE index, VALUE stack_size, VALUE builtin_inline_p)
{
- FILE *f = (FILE *)NUM2PTR(f_addr);
+ // Call "mjit_compile_invokebuiltin_for_#{func}" in mk_builtin_loader.rb
RB_BUILTIN bf = (RB_BUILTIN)NUM2PTR(bf_addr);
- bf->compiler(f, NIL_P(index) ? -1 : NUM2LONG(index), NUM2UINT(stack_size), RTEST(builtin_inline_p));
+ bf->compiler(buf, NIL_P(index) ? -1 : NUM2LONG(index), NUM2UINT(stack_size), RTEST(builtin_inline_p));
return Qnil;
}