Skip to content

Commit

Permalink
[mono][jit] Compute the type of generic context used by static virtua…
Browse files Browse the repository at this point in the history
…l calls properly.

Fixes dotnet#65394.
  • Loading branch information
vargaz committed Feb 16, 2022
1 parent f1337d9 commit 88b9154
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/mono/mono/mini/method-to-ir.c
Original file line number Diff line number Diff line change
Expand Up @@ -2749,6 +2749,9 @@ emit_get_rgctx_virt_method (MonoCompile *cfg, int context_used,
MonoJumpInfoVirtMethod *info;
MonoJumpInfoRgctxEntry *entry;

if (context_used == -1)
context_used = mono_class_check_context_used (klass) | mono_method_check_context_used (virt_method);

info = (MonoJumpInfoVirtMethod *)mono_mempool_alloc0 (cfg->mempool, sizeof (MonoJumpInfoVirtMethod));
info->klass = klass;
info->method = virt_method;
Expand Down Expand Up @@ -7980,7 +7983,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
addr = emit_get_rgctx_method (cfg, context_used, cmethod, MONO_RGCTX_INFO_GSHAREDVT_OUT_WRAPPER);
} else {
if (gshared_static_virtual)
addr = emit_get_rgctx_virt_method (cfg, mono_class_check_context_used (constrained_class), constrained_class, cmethod, MONO_RGCTX_INFO_VIRT_METHOD_CODE);
addr = emit_get_rgctx_virt_method (cfg, -1, constrained_class, cmethod, MONO_RGCTX_INFO_VIRT_METHOD_CODE);
else
addr = emit_get_rgctx_method (cfg, context_used, cmethod, MONO_RGCTX_INFO_METHOD_FTNDESC);
}
Expand All @@ -7994,7 +7997,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
* cmethod is a static interface method, the actual called method at runtime
* needs to be computed using constrained_class and cmethod.
*/
addr = emit_get_rgctx_virt_method (cfg, mono_class_check_context_used (constrained_class), constrained_class, cmethod, MONO_RGCTX_INFO_VIRT_METHOD_CODE);
addr = emit_get_rgctx_virt_method (cfg, -1, constrained_class, cmethod, MONO_RGCTX_INFO_VIRT_METHOD_CODE);
} else {
addr = emit_get_rgctx_method (cfg, context_used, cmethod, MONO_RGCTX_INFO_GENERIC_METHOD_CODE);
}
Expand Down

0 comments on commit 88b9154

Please sign in to comment.