diff options
author | Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com> | 2021-04-01 10:43:54 -0400 |
---|---|---|
committer | Alan Wu <XrXr@users.noreply.github.com> | 2021-10-20 18:19:32 -0400 |
commit | 215a2f401068fe0afc18a22377082d0d3d8644fd (patch) | |
tree | f6618573c1175a3035900b35e088ec7467be1930 /yjit_core.c | |
parent | aee44e4f2bcd795b5a81c72cb75d742103bb070b (diff) | |
download | ruby-215a2f401068fe0afc18a22377082d0d3d8644fd.tar.gz |
Fix type_diff logic after Alan pointed out errors
Diffstat (limited to 'yjit_core.c')
-rw-r--r-- | yjit_core.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/yjit_core.c b/yjit_core.c index 23bddfb573..ec793a053a 100644 --- a/yjit_core.c +++ b/yjit_core.c @@ -146,22 +146,25 @@ int type_diff(val_type_t src, val_type_t dst) RUBY_ASSERT(!src.is_heap || !src.is_imm); RUBY_ASSERT(!dst.is_heap || !dst.is_imm); - if (src.type != dst.type && dst.type != ETYPE_UNKNOWN) + // If dst assumes heap but src doesn't + if (dst.is_heap && !src.is_heap) return INT_MAX; - if (src.is_heap && !dst.is_heap) + // If dst assumes imm but src doesn't + if (dst.is_imm && !src.is_imm) return INT_MAX; - if (src.is_imm && !dst.is_imm) + // If dst assumes known type different from src + if (dst.type != ETYPE_UNKNOWN && dst.type != src.type) return INT_MAX; - if (src.is_heap != dst.is_heap) + if (dst.is_heap != src.is_heap) return 1; - if (src.is_imm != dst.is_imm) + if (dst.is_imm != src.is_imm) return 1; - if (src.type != dst.type) + if (dst.type != src.type) return 1; return 0; |