From 1c8fb90f6bde0c630f5dc532dfe198218bc9f910 Mon Sep 17 00:00:00 2001 From: Maxime Chevalier-Boisvert Date: Thu, 10 Sep 2020 17:20:46 -0400 Subject: Add new files, ujit_compile.c, ujit_compile.h --- compile.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'compile.c') diff --git a/compile.c b/compile.c index a1983eaecb..dd19fe2736 100644 --- a/compile.c +++ b/compile.c @@ -43,6 +43,7 @@ #include "builtin.h" #include "insns.inc" #include "insns_info.inc" +#include "ujit_compile.h" #undef RUBY_UNTYPED_DATA_WARNING #define RUBY_UNTYPED_DATA_WARNING 0 @@ -856,8 +857,6 @@ rb_iseq_compile_node(rb_iseq_t *iseq, const NODE *node) return iseq_setup(iseq, ret); } -extern uint8_t *native_pop_code; // TODO global hack - static int rb_iseq_translate_threaded_code(rb_iseq_t *iseq) { @@ -870,17 +869,17 @@ rb_iseq_translate_threaded_code(rb_iseq_t *iseq) { int insn = (int)iseq->body->iseq_encoded[i]; int len = insn_len(insn); - encoded[i] = (VALUE)table[insn]; - - if (insn == BIN(pop)) - encoded[i] = (VALUE)native_pop_code; - const char* name = insn_name(insn); - printf("%s\n", name); + uint8_t* native_code_ptr = ujit_compile_insn(iseq, i); + if (native_code_ptr) + encoded[i] = (VALUE)native_code_ptr; + else + encoded[i] = (VALUE)table[insn]; i += len; } + FL_SET((VALUE)iseq, ISEQ_TRANSLATED); #endif return COMPILE_OK; -- cgit v1.2.3