Skip to content

Commit 46693f2

Browse files
authored
[mono][interp] Fix first arg offset computation for unoptimized newobj (#85787)
Instead of obtaining the offset directly, we were computing it as the next available offset (once the arguments were pop'ed), which was not accounting for the case where the first argument was aligned.
1 parent e0ed554 commit 46693f2

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/mono/mono/mini/interp/transform.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6035,9 +6035,15 @@ generate_code (TransformData *td, MonoMethod *method, MonoMethodHeader *header,
60356035
interp_ins_set_dreg (td->last_ins, td->sp [-1].local);
60366036
} else if (!td->optimized) {
60376037
int tos = get_tos_offset (td);
6038-
td->sp -= csignature->param_count;
6039-
int param_offset = get_tos_offset (td);
6040-
int param_size = tos - param_offset;
6038+
int param_offset, param_size;
6039+
if (csignature->param_count) {
6040+
td->sp -= csignature->param_count;
6041+
param_offset = td->sp [0].offset;
6042+
param_size = tos - param_offset;
6043+
} else {
6044+
param_offset = tos;
6045+
param_size = 0;
6046+
}
60416047

60426048
td->cbb->contains_call_instruction = TRUE;
60436049
interp_add_ins (td, MINT_NEWOBJ_SLOW_UNOPT);

0 commit comments

Comments
 (0)