diff options
author | Zoltan Varga <vargaz@gmail.com> | 2010-03-30 23:49:46 +0400 |
---|---|---|
committer | Zoltan Varga <vargaz@gmail.com> | 2010-03-30 23:49:46 +0400 |
commit | 9d9cd95bf27cf376178b984ed30bc0e59b233d19 (patch) | |
tree | 64326ffc3053088e8279cb832d1920797476b2e1 | |
parent | b6b17619a9d1fce3c46104ee2e2e4b8a85799980 (diff) |
2010-03-30 Zoltan Varga <vargaz@gmail.com>
* mini-trampolines.c (mono_aot_trampoline): Remove some dead code.
* aot-runtime.c (mono_aot_patch_plt_entry): New helper function, which only
does the patching if the callee is in the same domain.
* aot-runtime.c mini-trampolines.c: Call mono_aot_patch_plt_entry instead
of mono_arch_patch_plt_entry ().
svn path=/trunk/mono/; revision=154483
-rwxr-xr-x | mono/mini/ChangeLog | 10 | ||||
-rw-r--r-- | mono/mini/aot-runtime.c | 20 | ||||
-rw-r--r-- | mono/mini/mini-trampolines.c | 24 | ||||
-rw-r--r-- | mono/mini/mini.h | 1 |
4 files changed, 32 insertions, 23 deletions
diff --git a/mono/mini/ChangeLog b/mono/mini/ChangeLog index c271d0533fc..8427a5c67c4 100755 --- a/mono/mini/ChangeLog +++ b/mono/mini/ChangeLog @@ -1,3 +1,13 @@ +2010-03-30 Zoltan Varga <vargaz@gmail.com> + + * mini-trampolines.c (mono_aot_trampoline): Remove some dead code. + + * aot-runtime.c (mono_aot_patch_plt_entry): New helper function, which only + does the patching if the callee is in the same domain. + + * aot-runtime.c mini-trampolines.c: Call mono_aot_patch_plt_entry instead + of mono_arch_patch_plt_entry (). + 2010-03-30 Rodrigo Kumpera <rkumpera@novell.com> * mini.c (create_jit_info): Fix try block hole length encoding. diff --git a/mono/mini/aot-runtime.c b/mono/mini/aot-runtime.c index 327ec8c3c8f..89fd3909e7e 100644 --- a/mono/mini/aot-runtime.c +++ b/mono/mini/aot-runtime.c @@ -3136,6 +3136,19 @@ find_aot_module (guint8 *code) return user_data.module; } +void +mono_aot_patch_plt_entry (guint8 *code, gpointer *got, mgreg_t *regs, guint8 *addr) +{ + /* + * Since AOT code is only used in the root domain, + * mono_domain_get () != mono_get_root_domain () means the calling method + * is AppDomain:InvokeInDomain, so this is the same check as in + * mono_method_same_domain () but without loading the metadata for the method. + */ + if (mono_domain_get () == mono_get_root_domain ()) + mono_arch_patch_plt_entry (code, got, regs, addr); +} + /* * mono_aot_plt_resolve: * @@ -3207,7 +3220,7 @@ mono_aot_plt_resolve (gpointer aot_module, guint32 plt_info_offset, guint8 *code /* Patch the PLT entry with target which might be the actual method not a trampoline */ plt_entry = mono_aot_get_plt_entry (code); g_assert (plt_entry); - mono_arch_patch_plt_entry (plt_entry, module->got, NULL, target); + mono_aot_patch_plt_entry (plt_entry, module->got, NULL, target); return target; #else @@ -3839,6 +3852,11 @@ mono_aot_plt_resolve (gpointer aot_module, guint32 plt_info_offset, guint8 *code return NULL; } +void +mono_aot_patch_plt_entry (guint8 *code, gpointer *got, mgreg_t *regs, guint8 *addr) +{ +} + gpointer mono_aot_get_method_from_vt_slot (MonoDomain *domain, MonoVTable *vtable, int slot) { diff --git a/mono/mini/mini-trampolines.c b/mono/mini/mini-trampolines.c index fb7f6380dad..6dcfbdb9245 100644 --- a/mono/mini/mini-trampolines.c +++ b/mono/mini/mini-trampolines.c @@ -560,7 +560,7 @@ common_call_trampoline (mgreg_t *regs, guint8 *code, gpointer arg, guint8* tramp guint8 *plt_entry = mono_aot_get_plt_entry (code); if (plt_entry) { - mono_arch_patch_plt_entry (plt_entry, NULL, regs, addr); + mono_aot_patch_plt_entry (plt_entry, NULL, regs, addr); } else { if (generic_shared) { if (m->wrapper_type != MONO_WRAPPER_NONE) @@ -704,9 +704,7 @@ mono_aot_trampoline (mgreg_t *regs, guint8 *code, guint8 *token_info, MonoMethod *method = NULL; gpointer addr; gpointer *vtable_slot; - gboolean is_got_entry; guint8 *plt_entry; - gboolean need_rgctx_tramp = FALSE; trampoline_calls ++; @@ -732,25 +730,7 @@ mono_aot_trampoline (mgreg_t *regs, guint8 *code, guint8 *token_info, plt_entry = mono_aot_get_plt_entry (code); g_assert (plt_entry); - mono_arch_patch_plt_entry (plt_entry, NULL, regs, addr); - - is_got_entry = FALSE; - - /* - * Since AOT code is only used in the root domain, - * mono_domain_get () != mono_get_root_domain () means the calling method - * is AppDomain:InvokeInDomain, so this is the same check as in - * mono_method_same_domain () but without loading the metadata for the method. - */ - if ((is_got_entry && (mono_domain_get () == mono_get_root_domain ())) || mono_domain_owns_vtable_slot (mono_domain_get (), vtable_slot)) { -#ifdef MONO_ARCH_HAVE_IMT - gboolean variance_used = FALSE; - if (!method) - method = mono_get_method (image, token, NULL); - vtable_slot = mono_convert_imt_slot_to_vtable_slot (vtable_slot, regs, code, method, NULL, &need_rgctx_tramp, &variance_used); -#endif - *vtable_slot = addr; - } + mono_aot_patch_plt_entry (plt_entry, NULL, regs, addr); return addr; } diff --git a/mono/mini/mini.h b/mono/mini/mini.h index a97bfdfd3bd..6e010292706 100644 --- a/mono/mini/mini.h +++ b/mono/mini/mini.h @@ -1532,6 +1532,7 @@ gboolean mono_aot_get_cached_class_info (MonoClass *klass, MonoCachedClassIn gboolean mono_aot_get_class_from_name (MonoImage *image, const char *name_space, const char *name, MonoClass **klass) MONO_INTERNAL; MonoJitInfo* mono_aot_find_jit_info (MonoDomain *domain, MonoImage *image, gpointer addr) MONO_INTERNAL; gpointer mono_aot_plt_resolve (gpointer aot_module, guint32 plt_info_offset, guint8 *code) MONO_INTERNAL; +void mono_aot_patch_plt_entry (guint8 *code, gpointer *got, mgreg_t *regs, guint8 *addr) MONO_INTERNAL; gpointer mono_aot_get_method_from_vt_slot (MonoDomain *domain, MonoVTable *vtable, int slot) MONO_INTERNAL; gpointer mono_aot_create_specific_trampoline (MonoImage *image, gpointer arg1, MonoTrampolineType tramp_type, MonoDomain *domain, guint32 *code_len) MONO_INTERNAL; gpointer mono_aot_get_named_code (const char *name) MONO_INTERNAL; |