Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/6.0-rc2] [interp] Disable optimization if the var index is greater than G_MAXUINT16 #59261

Merged
merged 1 commit into from
Sep 21, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/mono/mono/mini/interp/transform.c
Original file line number Diff line number Diff line change
Expand Up @@ -9288,8 +9288,8 @@ interp_alloc_offsets (TransformData *td)
if (ins->flags & INTERP_INST_FLAG_CALL) {
int *call_args = ins->info.call_args;
if (call_args) {
int pair_sregs [MINT_MOV_PAIRS_MAX];
int pair_dregs [MINT_MOV_PAIRS_MAX];
guint16 pair_sregs [MINT_MOV_PAIRS_MAX];
guint16 pair_dregs [MINT_MOV_PAIRS_MAX];
int num_pairs = 0;
int var = *call_args;

Expand All @@ -9303,9 +9303,10 @@ interp_alloc_offsets (TransformData *td)
td->locals [new_var].flags |= INTERP_LOCAL_FLAG_CALL_ARGS;

int mt = mint_type (td->locals [var].type);
if (mt != MINT_TYPE_VT && num_pairs < MINT_MOV_PAIRS_MAX) {
pair_sregs [num_pairs] = var;
pair_dregs [num_pairs] = new_var;
if (mt != MINT_TYPE_VT && num_pairs < MINT_MOV_PAIRS_MAX && var <= G_MAXUINT16 && new_var <= G_MAXUINT16) {
// We store these in the instruction data slots so we do this optimizations only if they fit
pair_sregs [num_pairs] = (guint16)var;
pair_dregs [num_pairs] = (guint16)new_var;
num_pairs++;
// The arg of the call is no longer global
*call_args = new_var;
Expand Down