{
mono_runtime_class_init (vtable);
}
+
+gpointer
+mono_fill_class_rgctx (MonoVTable *vtable, int index)
+{
+ return mono_class_fill_runtime_generic_context (vtable, index);
+}
+
+gpointer
+mono_fill_method_rgctx (MonoMethodRuntimeGenericContext *mrgctx, int index)
+{
+ return mono_method_fill_runtime_generic_context (mrgctx, index);
+}
emit_rgctx_fetch (MonoCompile *cfg, MonoInst *rgctx, MonoJumpInfoRgctxEntry *entry)
{
/* Inline version, not currently used */
+ // FIXME: This can be called from mono_decompose_vtype_opts (), which can't create new bblocks
#if 0
int i, slot, depth, index, rgctx_reg, val_reg, res_reg;
gboolean mrgctx;
MonoBasicBlock *is_null_bb, *end_bb;
MonoInst *res, *ins, *call;
+ MonoInst *args[16];
slot = mini_get_rgctx_entry_slot (entry);
/* Fastpath */
res_reg = alloc_preg (cfg);
- MONO_INST_NEW (cfg, res, OP_MOVE);
- res->dreg = res_reg;
- res->sreg1 = val_reg;
- MONO_ADD_INS (cfg->cbb, res);
+ MONO_INST_NEW (cfg, ins, OP_MOVE);
+ ins->dreg = res_reg;
+ ins->sreg1 = val_reg;
+ MONO_ADD_INS (cfg->cbb, ins);
+ res = ins;
MONO_EMIT_NEW_BRANCH_BLOCK (cfg, OP_BR, end_bb);
/* Slowpath */
MONO_START_BB (cfg, is_null_bb);
- // FIXME: This should use a jit icall
- call = mono_emit_abs_call (cfg, MONO_PATCH_INFO_RGCTX_FETCH, entry, helper_sig_rgctx_lazy_fetch_trampoline, &rgctx);
+ args [0] = rgctx;
+ EMIT_NEW_ICONST (cfg, args [1], index);
+ if (mrgctx)
+ call = mono_emit_jit_icall (cfg, mono_fill_method_rgctx, args);
+ else
+ call = mono_emit_jit_icall (cfg, mono_fill_class_rgctx, args);
MONO_INST_NEW (cfg, ins, OP_MOVE);
ins->dreg = res_reg;
ins->sreg1 = call->dreg;
MONO_ADD_INS (cfg->cbb, ins);
-
MONO_EMIT_NEW_BRANCH_BLOCK (cfg, OP_BR, end_bb);
MONO_START_BB (cfg, end_bb);
register_icall (mono_object_castclass_with_cache, "mono_object_castclass_with_cache", "object object ptr ptr", FALSE);
register_icall (mono_object_isinst_with_cache, "mono_object_isinst_with_cache", "object object ptr ptr", FALSE);
register_icall (mono_generic_class_init, "mono_generic_class_init", "void ptr", FALSE);
+ register_icall (mono_fill_class_rgctx, "mono_class_fill_rgctx", "ptr ptr int", FALSE);
+ register_icall (mono_fill_method_rgctx, "mono_method_fill_rgctx", "ptr ptr int", FALSE);
register_icall (mono_debugger_agent_user_break, "mono_debugger_agent_user_break", "void", FALSE);
register_dyn_icall (mono_create_specific_trampoline (NULL, MONO_TRAMPOLINE_GENERIC_CLASS_INIT, mono_get_root_domain (), NULL),