if (MONO_TYPE_ISSTRUCT (mono_method_signature (m)->ret))
this_pos = 8;
- mono_domain_lock (domain);
- start = code = mono_code_manager_reserve (domain->code_mp, 16);
- mono_domain_unlock (domain);
+ start = code = mono_domain_code_reserve (domain, 16);
x86_alu_membase_imm (code, X86_ADD, X86_ESP, this_pos, sizeof (MonoObject));
x86_jump_code (code, addr);
return start;
}
+gpointer
+mono_arch_get_static_rgctx_trampoline (MonoMethod *m, MonoMethodRuntimeGenericContext *mrgctx, gpointer addr)
+{
+ guint8 *code, *start;
+ int buf_len;
+
+ MonoDomain *domain = mono_domain_get ();
+
+ buf_len = 10;
+
+ start = code = mono_domain_code_reserve (domain, buf_len);
+
+ x86_mov_reg_imm (code, MONO_ARCH_RGCTX_REG, mrgctx);
+ x86_jump_code (code, addr);
+ g_assert ((code - start) <= buf_len);
+
+ mono_arch_flush_icache (start, code - start);
+
+ return start;
+}
+
void
mono_arch_patch_callsite (guint8 *method_start, guint8 *orig_code, guint8 *addr)
{
/* call *<OFFSET>(<REG>) -> Call made from AOT code */
gpointer *vtable_slot;
- vtable_slot = mono_arch_get_vcall_slot_addr (code + 5, (gpointer*)regs);
+ vtable_slot = mono_get_vcall_slot_addr (code + 5, (gpointer*)regs);
g_assert (vtable_slot);
*vtable_slot = nullified_class_init_trampoline;
tramp = mono_get_trampoline_code (tramp_type);
- mono_domain_lock (domain);
- code = buf = mono_code_manager_reserve_align (domain->code_mp, TRAMPOLINE_SIZE, 4);
- mono_domain_unlock (domain);
+ code = buf = mono_domain_code_reserve_align (domain, TRAMPOLINE_SIZE, 4);
x86_push_imm (buf, arg1);
x86_jump_code (buf, tramp);