* mini-trampolines.c (mono_get_vcall_slot_addr): New helper function.
* mini-trampolines.c tramp-amd64.c tramp-x86.c: Use it.
* mini-<ARCH>.c: Get rid of the identical mono_arch_get_vcall_slot_addr ()
functions.
svn path=/trunk/mono/; revision=132097
2009-04-19 Zoltan Varga <vargaz@gmail.com>
+ * mini-trampolines.c (mono_get_vcall_slot_addr): New helper function.
+
+ * mini-trampolines.c tramp-amd64.c tramp-x86.c: Use it.
+
+ * mini-<ARCH>.c: Get rid of the identical mono_arch_get_vcall_slot_addr ()
+ functions.
+
* mini-<ARCH>.h mini-trampolines.c mini.c: Get rid of
MONO_ARCH_COMMON_VTABLE_TRAMPOLINE, it is supported by all archs.
return regs [reg];
}
-gpointer*
-mono_arch_get_vcall_slot_addr (guint8* code, gpointer *regs)
-{
- gpointer vt;
- int displacement;
- vt = mono_arch_get_vcall_slot (code, regs, &displacement);
- if (!vt)
- return NULL;
- return (gpointer*)((char*)vt + displacement);
-}
-
int
mono_arch_get_this_arg_reg (MonoMethodSignature *sig, MonoGenericSharingContext *gsctx, guint8 *code)
{
return NULL;
}
-gpointer*
-mono_arch_get_vcall_slot_addr (guint8* code, gpointer *regs)
-{
- gpointer vt;
- int displacement;
- vt = mono_arch_get_vcall_slot (code, regs, &displacement);
- if (!vt)
- return NULL;
- return (gpointer*)((char*)vt + displacement);
-}
-
#define MAX_ARCH_DELEGATE_PARAMS 3
static gpointer
return NULL;
}
-gpointer*
-mono_arch_get_vcall_slot_addr (guint8* code, gpointer *regs)
-{
- gpointer vt;
- int displacement;
- vt = mono_arch_get_vcall_slot (code, regs, &displacement);
- if (!vt)
- return NULL;
- return (gpointer*)(gpointer)((char*)vt + displacement);
-}
-
gpointer*
mono_arch_get_delegate_method_ptr_addr (guint8* code, gpointer *regs)
{
return o;
}
-gpointer*
-mono_arch_get_vcall_slot_addr (guint8 *code, gpointer *regs)
-{
- gpointer vt;
- int displacement;
- vt = mono_arch_get_vcall_slot (code, regs, &displacement);
- if (!vt)
- return NULL;
- return (gpointer*)((char*)vt + displacement);
-}
-
#define MAX_ARCH_DELEGATE_PARAMS 7
gpointer
return NULL;
}
-gpointer*
-mono_arch_get_vcall_slot_addr (guint8 *code, gpointer *regs)
-{
- gpointer vt;
- int displacement;
- vt = mono_arch_get_vcall_slot (code, regs, &displacement);
- if (!vt)
- return NULL;
- return (gpointer*)((char*)vt + displacement);
-}
-
#define CMP_SIZE 3
#define BR_SMALL_SIZE 2
#define BR_LARGE_SIZE 2
}
#endif
+gpointer*
+mono_get_vcall_slot_addr (guint8* code, gpointer *regs)
+{
+ gpointer vt;
+ int displacement;
+ vt = mono_arch_get_vcall_slot (code, regs, &displacement);
+ if (!vt)
+ return NULL;
+ return (gpointer*)((char*)vt + displacement);
+}
+
#ifdef MONO_ARCH_HAVE_IMT
static gpointer*
/* Avoid loading metadata or creating a generic vtable if possible */
addr = mono_aot_get_method_from_vt_slot (mono_domain_get (), vt, displacement);
if (addr && !vt->klass->valuetype) {
- vtable_slot = mono_arch_get_vcall_slot_addr (code, (gpointer*)regs);
+ vtable_slot = mono_get_vcall_slot_addr (code, (gpointer*)regs);
if (mono_aot_is_got_entry (code, (guint8*)vtable_slot) || mono_domain_owns_vtable_slot (mono_domain_get (), vtable_slot)) {
*vtable_slot = mono_get_addr_from_ftnptr (addr);
}
* needs the signature to be able to find the this argument
*/
m = mono_arch_find_imt_method ((gpointer*)regs, code);
- vtable_slot = mono_arch_get_vcall_slot_addr (code, (gpointer*)regs);
+ vtable_slot = mono_get_vcall_slot_addr (code, (gpointer*)regs);
g_assert (vtable_slot);
gsctx = mono_get_generic_context_from_code (code);
mono_get_generic_context_from_code (code));
vt = this_argument->vtable;
- vtable_slot = mono_arch_get_vcall_slot_addr (code, (gpointer*)regs);
+ vtable_slot = mono_get_vcall_slot_addr (code, (gpointer*)regs);
g_assert (this_argument->vtable->klass->inited);
//mono_class_init (this_argument->vtable->klass);
int displacement;
MonoVTable *vt = mono_arch_get_vcall_slot (code, (gpointer*)regs, &displacement);
- vtable_slot = mono_arch_get_vcall_slot_addr (code, (gpointer*)regs);
+ vtable_slot = mono_get_vcall_slot_addr (code, (gpointer*)regs);
g_assert (vtable_slot);
if (vt->klass->valuetype)
return addr;
}
- vtable_slot = mono_arch_get_vcall_slot_addr (code, (gpointer*)regs);
+ vtable_slot = mono_get_vcall_slot_addr (code, (gpointer*)regs);
if (vtable_slot) {
if (m->klass->valuetype)
return mono_magic_trampoline (regs, code, method, tramp);
}
- vtable_slot = mono_arch_get_vcall_slot_addr (code, (gpointer*)regs);
+ vtable_slot = mono_get_vcall_slot_addr (code, (gpointer*)regs);
g_assert (!vtable_slot);
/* This is a normal call through a PLT entry */
return regs [reg];
}
-gpointer*
-mono_arch_get_vcall_slot_addr (guint8 *code, gpointer *regs)
-{
- gpointer vt;
- int displacement;
- vt = mono_arch_get_vcall_slot (code, regs, &displacement);
- if (!vt)
- return NULL;
- return (gpointer*)((char*)vt + displacement);
-}
-
gpointer
mono_arch_get_this_arg_from_call (MonoGenericSharingContext *gsctx, MonoMethodSignature *sig,
gssize *regs, guint8 *code)
void mono_monitor_exit_trampoline (gssize *regs, guint8 *code, MonoObject *obj, guint8 *tramp) MONO_INTERNAL;
gconstpointer mono_get_trampoline_func (MonoTrampolineType tramp_type);
gpointer mini_get_vtable_trampoline (void) MONO_INTERNAL;
+gpointer* mono_get_vcall_slot_addr (guint8* code, gpointer *regs) MONO_INTERNAL;
gboolean mono_running_on_valgrind (void) MONO_INTERNAL;
void* mono_global_codeman_reserve (int size) MONO_INTERNAL;
gboolean mono_arch_is_int_overflow (void *sigctx, void *info) MONO_INTERNAL;
void mono_arch_invalidate_method (MonoJitInfo *ji, void *func, gpointer func_arg) MONO_INTERNAL;
guint32 mono_arch_get_patch_offset (guint8 *code) MONO_INTERNAL;
-gpointer*mono_arch_get_vcall_slot_addr (guint8* code, gpointer *regs) MONO_INTERNAL;
gpointer mono_arch_get_vcall_slot (guint8 *code, gpointer *regs, int *displacement) MONO_INTERNAL;
gpointer*mono_arch_get_delegate_method_ptr_addr (guint8* code, gpointer *regs) MONO_INTERNAL;
void mono_arch_create_vars (MonoCompile *cfg) MONO_INTERNAL;
gpointer *vtable_slot;
/* call *<OFFSET>(%rip) */
- vtable_slot = mono_arch_get_vcall_slot_addr (code + 3, (gpointer*)regs);
+ vtable_slot = mono_get_vcall_slot_addr (code + 3, (gpointer*)regs);
g_assert (vtable_slot);
*vtable_slot = nullified_class_init_trampoline;
return o;
}
-gpointer*
-mono_arch_get_vcall_slot_addr (guint8 *code, gpointer *regs)
-{
- gpointer vt;
- int displacement;
- vt = mono_arch_get_vcall_slot (code, regs, &displacement);
- if (!vt)
- return NULL;
- return (gpointer*)((char*)vt + displacement);
-}
-
void
mono_arch_nullify_plt_entry (guint8 *code)
{
/*========================= End of Function ========================*/
-gpointer*
-mono_arch_get_vcall_slot_addr (guint8* code, gpointer *regs)
-{
- gpointer vt;
- int displacement;
- vt = mono_arch_get_vcall_slot (code, regs, &displacement);
- if (!vt)
- return NULL;
- return (gpointer*)((char*)vt + displacement);
-}
-
-/*========================= End of Function ========================*/
-
/*------------------------------------------------------------------*/
/* */
/* Name - mono_arch_create_trampoline_code */
/*========================= End of Function ========================*/
-gpointer*
-mono_arch_get_vcall_slot_addr (guint8* code, gpointer *regs)
-{
- gpointer vt;
- int displacement;
- vt = mono_arch_get_vcall_slot (code, regs, &displacement);
- if (!vt)
- return NULL;
- return (gpointer*)((char*)vt + displacement);
-}
-
-/*========================= End of Function ========================*/
-
/*------------------------------------------------------------------*/
/* */
/* Name - mono_arch_create_trampoline_code */
/* 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;