Skip to content

Commit

Permalink
[mini] Emit a null check using MONO_EMIT_NEW_CHECK_THIS for GetArrayD…
Browse files Browse the repository at this point in the history
…ataReference (#72897)

using MONO_EMIT_NULL_CHECK does not emit a null check in the backend
if the pointer is otherwise unused

Fixes #72745
  • Loading branch information
lambdageek authored Jul 27, 2022
1 parent 60e5f40 commit 35d1171
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/mono/mono/mini/intrinsics.c
Original file line number Diff line number Diff line change
Expand Up @@ -1008,7 +1008,8 @@ mini_emit_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSign
if (!strcmp (cmethod->name, "GetArrayDataReference")) {
// Logic below works for both SZARRAY and MDARRAY
int dreg = alloc_preg (cfg);
MONO_EMIT_NULL_CHECK (cfg, args [0]->dreg, FALSE);
MONO_EMIT_NEW_CHECK_THIS(cfg, args[0]->dreg);
//MONO_EMIT_NULL_CHECK (cfg, args [0]->dreg, FALSE);
EMIT_NEW_BIALU_IMM (cfg, ins, OP_PADD_IMM, dreg, args [0]->dreg, MONO_STRUCT_OFFSET (MonoArray, vector));
return ins;
}
Expand Down

0 comments on commit 35d1171

Please sign in to comment.