From 5e8fef281c5a8fdb8ca70491869ef57973c0e1f1 Mon Sep 17 00:00:00 2001 From: kumpera Date: Thu, 7 Jan 2010 21:58:37 +0000 Subject: [PATCH] 2010-01-07 Rodrigo Kumpera * helpers.c (mono_disassemble_code): Fix a g_hash_table warning when cfg is null. * mini-trampolines.c (mono_convert_imt_slot_to_vtable_slot): Convert a given method using a variance aware function. * mini-x86.c: Add support for dumping IMT thunks if DEBUG_IMT is defined. git-svn-id: svn+ssh://mono-cvs.ximian.com/source/trunk/mono@149197 e3ebcda4-bce8-0310-ba0a-eca2169e7518 --- mono/mini/ChangeLog | 10 ++++++++++ mono/mini/helpers.c | 2 +- mono/mini/mini-trampolines.c | 3 ++- mono/mini/mini-x86.c | 10 ++++++++++ 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/mono/mini/ChangeLog b/mono/mini/ChangeLog index 82861465b..b0b88bfab 100644 --- a/mono/mini/ChangeLog +++ b/mono/mini/ChangeLog @@ -1,5 +1,15 @@ 2010-01-07 Rodrigo Kumpera + * helpers.c (mono_disassemble_code): Fix a g_hash_table warning + when cfg is null. + + * mini-trampolines.c (mono_convert_imt_slot_to_vtable_slot): Convert a given + method using a variance aware function. + + * mini-x86.c: Add support for dumping IMT thunks if DEBUG_IMT is defined. + +2010-01-07 Rodrigo Kumpera + * method-to-ir.c (mono_method_to_ir): Casts to variant interfaces do an icall for now. diff --git a/mono/mini/helpers.c b/mono/mini/helpers.c index 6526e78a4..af1235e31 100644 --- a/mono/mini/helpers.c +++ b/mono/mini/helpers.c @@ -158,7 +158,7 @@ mono_disassemble_code (MonoCompile *cfg, guint8 *code, int size, char *id) cindex = 0; for (i = 0; i < size; ++i) { - if (emit_debug_info) { + if (emit_debug_info && cfg != NULL) { bb_num = GPOINTER_TO_INT (g_hash_table_lookup (offset_to_bb_hash, GINT_TO_POINTER (i))); if (bb_num) { fprintf (ofd, "\n.stabd 68,0,%d\n", bb_num - 1); diff --git a/mono/mini/mini-trampolines.c b/mono/mini/mini-trampolines.c index 0675537ca..8ec71e706 100644 --- a/mono/mini/mini-trampolines.c +++ b/mono/mini/mini-trampolines.c @@ -171,7 +171,8 @@ mono_convert_imt_slot_to_vtable_slot (gpointer* slot, mgreg_t *regs, guint8 *cod int interface_offset; int imt_slot = MONO_IMT_SIZE + displacement; - interface_offset = mono_class_interface_offset (vt->klass, imt_method->klass); + /*This has to be variance aware since imt_method can be from an interface that vt->klass doesn't directly implement*/ + interface_offset = mono_class_interface_offset_with_variance (vt->klass, imt_method->klass); if (interface_offset < 0) { g_print ("%s doesn't implement interface %s\n", mono_type_get_name_full (&vt->klass->byval_arg, 0), mono_type_get_name_full (&imt_method->klass->byval_arg, 0)); diff --git a/mono/mini/mini-x86.c b/mono/mini/mini-x86.c index c0d8e1322..5b4ec192d 100644 --- a/mono/mini/mini-x86.c +++ b/mono/mini/mini-x86.c @@ -5097,6 +5097,7 @@ mono_arch_free_jit_tls_data (MonoJitTlsData *tls) #define BR_LARGE_SIZE 5 #define JUMP_IMM_SIZE 6 #define ENABLE_WRONG_METHOD_CHECK 0 +#define DEBUG_IMT 0 static int imt_branch_distance (MonoIMTCheckItem **imt_entries, int start, int target) @@ -5211,6 +5212,15 @@ mono_arch_build_imt_thunk (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckI if (!fail_tramp) mono_stats.imt_thunks_size += code - start; g_assert (code - start <= size); + +#if DEBUG_IMT + { + char *buff = g_strdup_printf ("thunk_for_class_%s_%s_entries_%d", vtable->klass->name_space, vtable->klass->name, count); + mono_disassemble_code (NULL, (guint8*)start, code - start, buff); + g_free (buff); + } +#endif + return start; } -- 2.11.4.GIT