Skip to content
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
8 changes: 4 additions & 4 deletions src/mono/mono/mini/interp/transform-opt.c
Original file line number Diff line number Diff line change
Expand Up @@ -3403,9 +3403,11 @@ interp_super_instructions (TransformData *td)
current_liveness.bb_dfs_index = bb->dfs_index;
current_liveness.ins_index = 0;
for (InterpInst *ins = bb->first_ins; ins != NULL; ins = ins->next) {
int opcode = ins->opcode;
int opcode;
if (bb->dfs_index >= td->bblocks_count_no_eh || bb->dfs_index == -1 || (ins->flags & INTERP_INST_FLAG_LIVENESS_MARKER))
current_liveness.ins_index++;
retry_ins:
opcode = ins->opcode;
Comment on lines +3406 to +3410

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
int opcode;
if (bb->dfs_index >= td->bblocks_count_no_eh || bb->dfs_index == -1 || (ins->flags & INTERP_INST_FLAG_LIVENESS_MARKER))
current_liveness.ins_index++;
retry_ins:
opcode = ins->opcode;
if (bb->dfs_index >= td->bblocks_count_no_eh || bb->dfs_index == -1 || (ins->flags & INTERP_INST_FLAG_LIVENESS_MARKER))
current_liveness.ins_index++;
retry_ins:
int opcode = ins->opcode;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that would lead to compilation failures because opcode needs to be declared before the label.

if (MINT_IS_NOP (opcode))
continue;

Expand Down Expand Up @@ -3804,9 +3806,7 @@ interp_super_instructions (TransformData *td)
g_print ("superins: ");
interp_dump_ins (ins, td->data_items);
}

Copilot AI May 28, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replacing 'ins = ins->prev' with 'goto retry_ins' avoids a potential null pointer dereference, but consider adding a comment to clarify the control flow and ensure readability for future maintainers.

Suggested change
}
}
// Retry processing the current instruction after modifying its opcode and operands.

Copilot uses AI. Check for mistakes.
// The newly added opcode could be part of further superinstructions. Retry
ins = ins->prev;
continue;
goto retry_ins;
}
}
}
Expand Down