Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6626,6 +6626,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
Expand Down
10 changes: 10 additions & 0 deletions ujit_codegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1449,6 +1454,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)
{
Expand Down
11 changes: 10 additions & 1 deletion ujit_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
}

Expand Down
1 change: 1 addition & 0 deletions ujit_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,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,
Expand Down
2 changes: 2 additions & 0 deletions ujit_iface.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ ujit_root_update_references(void *ptr)
RUBY_ASSERT(false);
}
}

ujit_branches_update_references();
}

// GC callback during mark phase
Expand Down