mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Fix issue with version matching logic
This commit is contained in:
parent
fe784d1449
commit
5ec94e0d4a
1 changed files with 22 additions and 22 deletions
44
yjit_core.c
44
yjit_core.c
|
@ -390,22 +390,22 @@ branch_stub_hit(uint32_t branch_idx, uint32_t target_idx, rb_execution_context_t
|
||||||
RUBY_ASSERT(cb->write_pos <= branch->end_pos);
|
RUBY_ASSERT(cb->write_pos <= branch->end_pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Limit the number of block versions
|
// Try to find an existing compiled version of this block
|
||||||
ctx_t generic_ctx = DEFAULT_CTX;
|
|
||||||
generic_ctx.stack_size = target_ctx->stack_size;
|
|
||||||
generic_ctx.sp_offset = target_ctx->sp_offset;
|
|
||||||
if (target_ctx->chain_depth == 0) { // guard chains implement limits individually
|
|
||||||
if (get_num_versions(target) >= MAX_VERSIONS - 1) {
|
|
||||||
//fprintf(stderr, "version limit hit in branch_stub_hit\n");
|
|
||||||
target_ctx = &generic_ctx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try to find a compiled version of this block
|
|
||||||
block_t* p_block = find_block_version(target, target_ctx);
|
block_t* p_block = find_block_version(target, target_ctx);
|
||||||
|
|
||||||
// If this block hasn't yet been compiled
|
// If this block hasn't yet been compiled
|
||||||
if (!p_block) {
|
if (!p_block) {
|
||||||
|
// Limit the number of block versions
|
||||||
|
ctx_t generic_ctx = DEFAULT_CTX;
|
||||||
|
generic_ctx.stack_size = target_ctx->stack_size;
|
||||||
|
generic_ctx.sp_offset = target_ctx->sp_offset;
|
||||||
|
if (target_ctx->chain_depth == 0) { // guard chains implement limits individually
|
||||||
|
if (get_num_versions(target) >= MAX_VERSIONS - 1) {
|
||||||
|
//fprintf(stderr, "version limit hit in branch_stub_hit\n");
|
||||||
|
target_ctx = &generic_ctx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
p_block = gen_block_version(target, target_ctx, ec);
|
p_block = gen_block_version(target, target_ctx, ec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -558,16 +558,6 @@ void gen_direct_jump(
|
||||||
uint32_t start_pos;
|
uint32_t start_pos;
|
||||||
uint32_t end_pos;
|
uint32_t end_pos;
|
||||||
|
|
||||||
// Limit the number of block versions
|
|
||||||
ctx_t generic_ctx = DEFAULT_CTX;
|
|
||||||
generic_ctx.stack_size = ctx->stack_size;
|
|
||||||
generic_ctx.sp_offset = ctx->sp_offset;
|
|
||||||
if (get_num_versions(target0) >= MAX_VERSIONS - 1)
|
|
||||||
{
|
|
||||||
//fprintf(stderr, "version limit hit in gen_direct_jump\n");
|
|
||||||
ctx = &generic_ctx;
|
|
||||||
}
|
|
||||||
|
|
||||||
block_t* p_block = find_block_version(target0, ctx);
|
block_t* p_block = find_block_version(target0, ctx);
|
||||||
|
|
||||||
// If the version already exists
|
// If the version already exists
|
||||||
|
@ -584,6 +574,16 @@ void gen_direct_jump(
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// Limit the number of block versions
|
||||||
|
ctx_t generic_ctx = DEFAULT_CTX;
|
||||||
|
generic_ctx.stack_size = ctx->stack_size;
|
||||||
|
generic_ctx.sp_offset = ctx->sp_offset;
|
||||||
|
if (get_num_versions(target0) >= MAX_VERSIONS - 1)
|
||||||
|
{
|
||||||
|
//fprintf(stderr, "version limit hit in gen_direct_jump\n");
|
||||||
|
ctx = &generic_ctx;
|
||||||
|
}
|
||||||
|
|
||||||
// The target block will follow next
|
// The target block will follow next
|
||||||
// It will be compiled in gen_block_version()
|
// It will be compiled in gen_block_version()
|
||||||
dst_addr0 = NULL;
|
dst_addr0 = NULL;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue