Skip to content

Commit

Permalink
[mono][interp] Fix il_offset of inserted instructions (#85305)
Browse files Browse the repository at this point in the history
After the original codegen happens, where instructions have the associated il_offset set, we might still generate new instruction as part of various optimizations. They would have the associated il_offset of the end of the method which is incorrect and was screwing up mapping from native_offset to il_offset.
  • Loading branch information
BrzVlad committed Apr 25, 2023
1 parent 19d545c commit 195bf98
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/mono/mono/mini/interp/transform.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ interp_insert_ins_bb (TransformData *td, InterpBasicBlock *bb, InterpInst *prev_
else
new_inst->next->prev = new_inst;

new_inst->il_offset = -1;
return new_inst;
}

Expand Down Expand Up @@ -10864,6 +10865,9 @@ generate (MonoMethod *method, MonoMethodHeader *header, InterpMethod *rtm, MonoG
generate_code (td, method, header, generic_context, error);
goto_if_nok (error, exit);

// Any newly created instructions will have undefined il_offset
td->current_il_offset = -1;

g_assert (td->inline_depth == 0);

if (td->has_localloc)
Expand Down

0 comments on commit 195bf98

Please sign in to comment.