summaryrefslogtreecommitdiff
path: root/yjit_core.c
diff options
context:
space:
mode:
authorJohn Hawthorn <john@hawthorn.email>2021-07-27 23:35:01 -0700
committerAlan Wu <XrXr@users.noreply.github.com>2021-10-20 18:19:38 -0400
commit250b97da9be7d8d62be8055249497d9a93d83302 (patch)
tree082178388d139207b235cb1c174df84a9db3eb3f /yjit_core.c
parent6c80150d402758fa07470cb88d5a15b1ffd15e6c (diff)
Make ctx_diff aware of mappings
Diffstat (limited to 'yjit_core.c')
-rw-r--r--yjit_core.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/yjit_core.c b/yjit_core.c
index c4db3de854..f1a57a01ae 100644
--- a/yjit_core.c
+++ b/yjit_core.c
@@ -355,9 +355,22 @@ int ctx_diff(const ctx_t* src, const ctx_t* dst)
// For each value on the temp stack
for (size_t i = 0; i < src->stack_size; ++i)
{
- val_type_t t_src = ctx_get_opnd_type(src, OPND_STACK(i));
- val_type_t t_dst = ctx_get_opnd_type(dst, OPND_STACK(i));
- int temp_diff = type_diff(t_src, t_dst);
+ temp_type_mapping_t m_src = ctx_get_opnd_mapping(src, OPND_STACK(i));
+ temp_type_mapping_t m_dst = ctx_get_opnd_mapping(dst, OPND_STACK(i));
+
+ if (m_dst.mapping.kind != m_src.mapping.kind) {
+ if (m_dst.mapping.kind == TEMP_STACK) {
+ // We can safely drop information about the source of the temp
+ // stack operand.
+ diff += 1;
+ } else {
+ return INT_MAX;
+ }
+ } else if (m_dst.mapping.idx != m_src.mapping.idx) {
+ return INT_MAX;
+ }
+
+ int temp_diff = type_diff(m_src.type, m_dst.type);
if (temp_diff == INT_MAX)
return INT_MAX;