diff --git a/common.mk b/common.mk index 4de1d833b7..abe03d487e 100644 --- a/common.mk +++ b/common.mk @@ -6627,6 +6627,7 @@ io.$(OBJEXT): {$(VPATH)}backward/2/stdarg.h io.$(OBJEXT): {$(VPATH)}builtin.h io.$(OBJEXT): {$(VPATH)}config.h io.$(OBJEXT): {$(VPATH)}constant.h +io.$(OBJEXT): {$(VPATH)}darray.h io.$(OBJEXT): {$(VPATH)}defines.h io.$(OBJEXT): {$(VPATH)}dln.h io.$(OBJEXT): {$(VPATH)}encindex.h diff --git a/ujit_codegen.c b/ujit_codegen.c index 6ab1ee1c9b..b6d5f5fbce 100644 --- a/ujit_codegen.c +++ b/ujit_codegen.c @@ -1277,6 +1277,11 @@ gen_opt_swb_iseq(jitstate_t* jit, ctx_t* ctx, struct rb_call_data * cd, const rb return false; } + if (vm_ci_flag(cd->ci) & VM_CALL_TAILCALL) { + // We can't handle tailcalls + return false; + } + rb_gc_register_mark_object((VALUE)iseq); // FIXME: intentional LEAK! // Create a size-exit to fall back to the interpreter @@ -1464,6 +1469,11 @@ gen_opt_send_without_block(jitstate_t* jit, ctx_t* ctx) return false; } + // We don't generate code to check protected method calls + if (METHOD_ENTRY_VISI(cme) == METHOD_VISI_PROTECTED) { + return false; + } + // If this is a C call if (cme->def->type == VM_METHOD_TYPE_CFUNC) { diff --git a/ujit_core.c b/ujit_core.c index 7b135dc89b..e642b67544 100644 --- a/ujit_core.c +++ b/ujit_core.c @@ -256,6 +256,15 @@ block_t* find_block_version(blockid_t blockid, const ctx_t* ctx) return best_version; } +void +ujit_branches_update_references(void) +{ + for (uint32_t i = 0; i < num_branches; i++) { + branch_entries[i].targets[0].iseq = (const void *)rb_gc_location((VALUE)branch_entries[i].targets[0].iseq); + branch_entries[i].targets[1].iseq = (const void *)rb_gc_location((VALUE)branch_entries[i].targets[1].iseq); + } +} + // Compile a new block version immediately block_t* gen_block_version(blockid_t blockid, const ctx_t* start_ctx) { @@ -539,7 +548,7 @@ void gen_direct_jump( generic_ctx.sp_offset = ctx->sp_offset; if (count_block_versions(target0) >= MAX_VERSIONS - 1) { - fprintf(stderr, "version limit hit in branch_stub_hit\n"); + fprintf(stderr, "version limit hit in gen_direct_jump\n"); ctx = &generic_ctx; } diff --git a/ujit_core.h b/ujit_core.h index 6e863f08bf..051fadb4a3 100644 --- a/ujit_core.h +++ b/ujit_core.h @@ -145,6 +145,7 @@ block_t* find_block_version(blockid_t blockid, const ctx_t* ctx); block_t* gen_block_version(blockid_t blockid, const ctx_t* ctx); uint8_t* gen_entry_point(const rb_iseq_t *iseq, uint32_t insn_idx); void ujit_free_block(block_t *block); +void ujit_branches_update_references(void); void gen_branch( const ctx_t* src_ctx, diff --git a/ujit_iface.c b/ujit_iface.c index 675cadd798..15a484fb8e 100644 --- a/ujit_iface.c +++ b/ujit_iface.c @@ -206,6 +206,8 @@ ujit_root_update_references(void *ptr) RUBY_ASSERT(false); } } + + ujit_branches_update_references(); } // GC callback during mark phase