8000 Merge pull request #109 from Shopify/yjit-diff-local-types · jamatthews/ruby@991f56d · GitHub
[go: up one dir, main page]

Skip to content

Commit 991f56d

Browse files
authored
Merge pull request ruby#109 from Shopify/yjit-diff-local-types
Diff the local types in ctx_diff()
2 parents 346a19b + 2c2822d commit 991f56d

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

yjit_core.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#define MAX_VERSIONS 4
1414

1515
// Maximum number of branch instructions we can track
16-
#define MAX_BRANCHES 100000
16+
#define MAX_BRANCHES 250000
1717

1818
// Registered branch entries
1919
branch_t branch_entries[MAX_BRANCHES];
@@ -284,7 +284,18 @@ int ctx_diff(const ctx_t* src, const ctx_t* dst)
284284

285285
diff += self_diff;
286286

287-
// TODO: when we track local types, need to check them too
287+
// For each local type we track
288+
for (size_t i = 0; i < MAX_LOCAL_TYPES; ++i)
289+
{
290+
val_type_t t_src = src->local_types[i];
291+
val_type_t t_dst = dst->local_types[i];
292+
int temp_diff = type_diff(t_src, t_dst);
293+
294+
if (temp_diff == INT_MAX)
295+
return INT_MAX;
296+
297+
diff += temp_diff;
298+
}
288299

289300
// For each value on the temp stack
290301
for (size_t i = 0; i < src->stack_size; ++i)
@@ -659,7 +670,6 @@ void gen_branch(
659670
)
660671
{
661672
RUBY_ASSERT(target0.iseq != NULL);
662-
//RUBY_ASSERT(target1.iseq != NULL);
663673
RUBY_ASSERT_ALWAYS(num_branches < MAX_BRANCHES);
664674
uint32_t branch_idx = num_branches++;
665675

@@ -879,7 +889,7 @@ invalidate_block_version(block_t* block)
879889

880890
// For each incoming branch
881891
uint32_t* branch_idx;
882-
rb_darray_foreach(block->incoming, i, branch_idx)
892+
rb_darray_foreach(block->incoming, incoming_idx, branch_idx)
883893
{
884894
//uint32_t branch_idx = block->incoming[i];
885895
branch_t* branch = &branch_entries[*branch_idx];

0 commit comments

Comments
 (0)
0