diff options
author | John Hawthorn <john@hawthorn.email> | 2021-08-10 15:41:27 -0700 |
---|---|---|
committer | Alan Wu <XrXr@users.noreply.github.com> | 2021-10-20 18:19:38 -0400 |
commit | ed8aa3409a606a1c254eb94f7446827a11c66df2 (patch) | |
tree | 890313dd873a1cab3cc8156e5f73a04bd91daccd /yjit_core.c | |
parent | 6d852e847e163fad0f2ccebe59c57d6921d3c472 (diff) | |
download | ruby-ed8aa3409a606a1c254eb94f7446827a11c66df2.tar.gz |
Detach mapping to local in ctx_set_local_type
Similar to the previous fix to ctx_clear_local_types, we must detach
mappings to a local if we are changing its value.
Diffstat (limited to 'yjit_core.c')
-rw-r--r-- | yjit_core.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/yjit_core.c b/yjit_core.c index 3f866b0a2b..5389f3af5f 100644 --- a/yjit_core.c +++ b/yjit_core.c @@ -266,6 +266,15 @@ void ctx_set_local_type(ctx_t* ctx, size_t idx, val_type_t type) if (idx >= MAX_LOCAL_TYPES) return; + // If any values on the stack map to this local we must detach them + for (int i = 0; i < MAX_TEMP_TYPES; i++) { + temp_mapping_t *mapping = &ctx->temp_mapping[i]; + if (mapping->kind == TEMP_LOCAL && mapping->idx == idx) { + ctx->temp_types[i] = ctx->local_types[mapping->idx]; + *mapping = MAP_STACK; + } + } + ctx->local_types[idx] = type; } |