From 2c1c0d3df033da6745aa0f828a704bb46a535fbc Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Sun, 27 Nov 2022 22:23:35 -0800 Subject: MJIT: Get rid of C.fprintf Faster code generation and cleaner code. --- mjit_compiler.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'mjit_compiler.c') diff --git a/mjit_compiler.c b/mjit_compiler.c index 0e9f499424..be3942a7b0 100644 --- a/mjit_compiler.c +++ b/mjit_compiler.c @@ -123,11 +123,14 @@ mjit_compile(FILE *f, const rb_iseq_t *iseq, const char *funcname, int id) mjit_call_p = false; // Avoid impacting JIT metrics by itself extern VALUE rb_mMJITCompiler; - bool success = RTEST(rb_funcall(rb_mMJITCompiler, rb_intern("compile"), 4, - PTR2NUM((VALUE)f), rb_ptr("rb_iseq_t", iseq), rb_str_new_cstr(funcname), INT2NUM(id))); + VALUE src = rb_funcall(rb_mMJITCompiler, rb_intern("compile"), 3, + rb_ptr("rb_iseq_t", iseq), rb_str_new_cstr(funcname), INT2NUM(id)); + if (!NIL_P(src)) { + fprintf(f, "%s", RSTRING_PTR(src)); + } mjit_call_p = original_call_p; - return success; + return !NIL_P(src); } // -- cgit v1.2.3