Copy
[mono.git] / mono / mini / aot-runtime.c
index cf7a90d2ea4ec8237b9b0faa54614f918f209b87..cdee980f62fee351cd48ef4b2a0e577ba5199434 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * aot.c: mono Ahead of Time compiler
+ * aot-runtime.c: mono Ahead of Time compiler
  *
  * Author:
  *   Dietmar Maurer (dietmar@ximian.com)
 #endif
 #include <fcntl.h>
 #include <string.h>
-#ifndef PLATFORM_WIN32
+#ifdef HAVE_SYS_MMAN_H
 #include <sys/mman.h>
-#else
+#endif
+
+#if PLATFORM_WIN32
 #include <winsock2.h>
 #include <windows.h>
 #endif
 
 #include <errno.h>
 #include <sys/stat.h>
-#include <limits.h>    /* for PAGESIZE */
-#ifndef PAGESIZE
-#define PAGESIZE 4096
-#endif
 
 #ifdef HAVE_SYS_WAIT_H
 #include <sys/wait.h>  /* for WIFEXITED, WEXITSTATUS */
 #include <mono/metadata/metadata-internals.h>
 #include <mono/metadata/marshal.h>
 #include <mono/metadata/gc-internal.h>
+#include <mono/metadata/monitor.h>
+#include <mono/metadata/threads-types.h>
 #include <mono/utils/mono-logger.h>
+#include <mono/utils/mono-mmap.h>
 #include "mono/utils/mono-compiler.h"
+#include <mono/utils/mono-counters.h>
 
 #include "mini.h"
 #include "version.h"
@@ -72,11 +74,13 @@ typedef struct MonoAotModule {
        guint32 opts;
        /* Pointer to the Global Offset Table */
        gpointer *got;
-       guint32 got_size;
+       guint32 got_size, plt_size;
        GHashTable *name_cache;
        GHashTable *extra_methods;
        /* Maps methods to their code */
        GHashTable *method_to_code;
+       /* Maps pointers into the method info to the methods themselves */
+       GHashTable *method_ref_to_method;
        MonoAssemblyName *image_names;
        char **image_guids;
        MonoAssembly *assembly;
@@ -90,9 +94,7 @@ typedef struct MonoAotModule {
        guint8 *code_end;
        guint8 *plt;
        guint8 *plt_end;
-       guint8 *plt_info;
-       guint8 *plt_jump_table;
-       guint32 plt_jump_table_size;
+       guint32 plt_got_offset_base;
        guint32 *code_offsets;
        guint8 *method_info;
        guint32 *method_info_offsets;
@@ -109,12 +111,35 @@ typedef struct MonoAotModule {
        guint32 *extra_method_table;
        guint32 *extra_method_info_offsets;
        guint8 *extra_method_info;
-       guint8 *trampolines;
-       guint32 num_trampolines, first_trampoline_got_offset, trampoline_index;
+       guint8 *unwind_info;
+
+       guint8 *specific_trampolines;
+       guint32 num_specific_trampolines, specific_trampoline_got_offset_base;
+       guint32 specific_trampoline_index, specific_trampoline_size;
+
+       guint8 *static_rgctx_trampolines;
+       guint32 num_static_rgctx_trampolines, static_rgctx_trampoline_got_offset_base;
+       guint32 static_rgctx_trampoline_index, static_rgctx_trampoline_size;
+
        gpointer *globals;
        MonoDl *sofile;
 } MonoAotModule;
 
+/* This structure is stored in the AOT file */
+typedef struct MonoAotFileInfo
+{
+       guint32 plt_got_offset_base;
+       guint32 got_size;
+       guint32 plt_size;
+       guint32 num_specific_trampolines;
+       guint32 specific_trampoline_size;
+       guint32 specific_trampoline_got_offset_base;
+       guint32 num_static_rgctx_trampolines;
+       guint32 static_rgctx_trampoline_size;
+       guint32 static_rgctx_trampoline_got_offset_base;
+       gpointer *got;
+} MonoAotFileInfo;
+
 static GHashTable *aot_modules;
 #define mono_aot_lock() EnterCriticalSection (&aot_mutex)
 #define mono_aot_unlock() LeaveCriticalSection (&aot_mutex)
@@ -151,7 +176,6 @@ static gboolean spawn_compiler = TRUE;
 static gint32 mono_last_aot_method = -1;
 
 static gboolean make_unreadable = FALSE;
-static guint32 n_pagefaults = 0;
 static guint32 name_table_accesses = 0;
 
 /* Used to speed-up find_aot_module () */
@@ -169,12 +193,6 @@ load_patch_info (MonoAotModule *aot_module, MonoMemPool *mp, int n_patches,
                                 guint32 got_index, guint32 **got_slots, 
                                 guint8 *buf, guint8 **endbuf);
 
-static inline gboolean 
-is_got_patch (MonoJumpInfoType patch_type)
-{
-       return TRUE;
-}
-
 /*****************************************************/
 /*                 AOT RUNTIME                       */
 /*****************************************************/
@@ -336,46 +354,41 @@ decode_klass_ref (MonoAotModule *module, guint8 *buf, guint8 **endbuf)
                                mono_metadata_free_type (type);
                        } else if ((type == MONO_TYPE_VAR) || (type == MONO_TYPE_MVAR)) {
                                MonoType *t;
-                               gboolean is_method;
                                MonoGenericContainer *container;
 
-                               // FIXME: Maybe use types directly to avoid
-                               // the overhead of creating MonoClass-es
-
-                               // FIXME: Memory management
-                               t = g_new0 (MonoType, 1);
-                               t->type = type;
-                               t->data.generic_param = g_new0 (MonoGenericParam, 1);
-                               t->data.generic_param->num = decode_value (p, &p);
-                               t->data.generic_param->name = "T";
+                               int num = decode_value (p, &p);
+                               gboolean is_method = decode_value (p, &p);
 
-                               is_method = decode_value (p, &p);
                                if (is_method) {
-                                       MonoMethod *method_def = decode_method_ref_2 (module, p, &p);
-
-                                       if (!method_def) {
-                                               g_free (t->data.generic_param);
-                                               g_free (t);
+                                       MonoMethod *method_def;
+                                       g_assert (type == MONO_TYPE_MVAR);
+                                       method_def = decode_method_ref_2 (module, p, &p);
+                                       if (!method_def)
                                                return NULL;
-                                       }
 
                                        container = mono_method_get_generic_container (method_def);
                                } else {
-                                       MonoClass *class_def = decode_klass_ref (module, p, &p);
-                                       
-                                       if (!class_def) {
-                                               g_free (t->data.generic_param);
-                                               g_free (t);
+                                       MonoClass *class_def;
+                                       g_assert (type == MONO_TYPE_VAR);
+                                       class_def = decode_klass_ref (module, p, &p);
+                                       if (!class_def)
                                                return NULL;
-                                       }
 
                                        container = class_def->generic_container;
                                }
 
                                g_assert (container);
-                               t->data.generic_param->owner = container;
 
+                               // FIXME: Memory management
+                               t = g_new0 (MonoType, 1);
+                               t->type = type;
+                               t->data.generic_param = mono_generic_container_get_param (container, num);
+
+                               // FIXME: Maybe use types directly to avoid
+                               // the overhead of creating MonoClass-es
                                klass = mono_class_from_mono_type (t);
+
+                               g_free (t);
                        } else {
                                g_assert_not_reached ();
                        }
@@ -420,6 +433,41 @@ decode_field_info (MonoAotModule *module, guint8 *buf, guint8 **endbuf)
        return mono_class_get_field (klass, token);
 }
 
+/*
+ * can_method_ref_match_method:
+ *
+ *   Determine if calling decode_method_ref_2 on P could return the same method as 
+ * METHOD. This is an optimization to avoid calling decode_method_ref_2 () which
+ * would create MonoMethods which are not needed etc.
+ */
+static gboolean
+can_method_ref_match_method (MonoAotModule *module, guint8 *buf, MonoMethod *method)
+{
+       guint8 *p = buf;
+       guint32 image_index, value;
+
+       /* Keep this in sync with decode_method_ref () */
+       value = decode_value (p, &p);
+       image_index = value >> 24;
+
+       if (image_index == MONO_AOT_METHODREF_WRAPPER) {
+               guint32 wrapper_type;
+
+               if (!method->wrapper_type)
+                       return FALSE;
+
+               wrapper_type = decode_value (p, &p);
+
+               if (method->wrapper_type != wrapper_type)
+                       return FALSE;
+       } else if (image_index < MONO_AOT_METHODREF_MIN || image_index == MONO_AOT_METHODREF_METHODSPEC || image_index == MONO_AOT_METHODREF_GINST) {
+               if (method->wrapper_type)
+                       return FALSE;
+       }
+
+       return TRUE;
+}
+
 /*
  * decode_method_ref:
  *
@@ -431,7 +479,7 @@ static MonoImage*
 decode_method_ref (MonoAotModule *module, guint32 *token, MonoMethod **method, gboolean *no_aot_trampoline, guint8 *buf, guint8 **endbuf)
 {
        guint32 image_index, value;
-       MonoImage *image;
+       MonoImage *image = NULL;
        guint8 *p = buf;
 
        if (method)
@@ -442,15 +490,14 @@ decode_method_ref (MonoAotModule *module, guint32 *token, MonoMethod **method, g
        value = decode_value (p, &p);
        image_index = value >> 24;
 
-       if (image_index == 252) {
+       if (image_index == MONO_AOT_METHODREF_NO_AOT_TRAMPOLINE) {
                if (no_aot_trampoline)
                        *no_aot_trampoline = TRUE;
                value = decode_value (p, &p);
                image_index = value >> 24;
        }
 
-       if (image_index == 253) {
-               /* Wrapper */
+       if (image_index == MONO_AOT_METHODREF_WRAPPER) {
                guint32 wrapper_type;
 
                wrapper_type = decode_value (p, &p);
@@ -517,19 +564,45 @@ decode_method_ref (MonoAotModule *module, guint32 *token, MonoMethod **method, g
                        *method = mono_marshal_get_static_rgctx_invoke (m);
                        break;
                }
+               case MONO_WRAPPER_SYNCHRONIZED: {
+                       MonoMethod *m = decode_method_ref_2 (module, p, &p);
+
+                       if (!m)
+                               return NULL;
+                       *method = mono_marshal_get_synchronized_wrapper (m);
+                       break;
+               }
+               case MONO_WRAPPER_UNKNOWN: {
+                       MonoMethodDesc *desc;
+                       MonoMethod *orig_method;
+                       int subtype = decode_value (p, &p);
+
+                       if (subtype == MONO_AOT_WRAPPER_MONO_ENTER)
+                               desc = mono_method_desc_new ("Monitor:Enter", FALSE);
+                       else if (subtype == MONO_AOT_WRAPPER_MONO_EXIT)
+                               desc = mono_method_desc_new ("Monitor:Exit", FALSE);
+                       else
+                               g_assert_not_reached ();
+                       orig_method = mono_method_desc_search_in_class (desc, mono_defaults.monitor_class);
+                       g_assert (orig_method);
+                       mono_method_desc_free (desc);
+                       *method = mono_monitor_get_fast_path (orig_method);
+                       break;
+               }
                default:
                        g_assert_not_reached ();
                }
-       } else if (image_index == 255) {
-               /* Methodspec */
+       } else if (image_index == MONO_AOT_METHODREF_WRAPPER_NAME) {
+               /* Can't decode these */
+               g_assert_not_reached ();
+       } else if (image_index == MONO_AOT_METHODREF_METHODSPEC) {
                image_index = decode_value (p, &p);
                *token = decode_value (p, &p);
 
                image = load_image (module, image_index);
                if (!image)
                        return NULL;
-       } else if (image_index == 254) {
-               /* Method on generic instance */
+       } else if (image_index == MONO_AOT_METHODREF_GINST) {
                MonoClass *klass;
                MonoGenericContext ctx;
 
@@ -567,7 +640,36 @@ decode_method_ref (MonoAotModule *module, guint32 *token, MonoMethod **method, g
                        return NULL;
 
                *method = mono_class_inflate_generic_method_full (*method, klass, &ctx);
+       } else if (image_index == MONO_AOT_METHODREF_ARRAY) {
+               MonoClass *klass;
+               int method_type;
+
+               klass = decode_klass_ref (module, p, &p);
+               if (!klass)
+                       return NULL;
+               method_type = decode_value (p, &p);
+               *token = 0;
+               switch (method_type) {
+               case 0:
+                       *method = mono_class_get_method_from_name (klass, ".ctor", klass->rank);
+                       break;
+               case 1:
+                       *method = mono_class_get_method_from_name (klass, ".ctor", klass->rank * 2);
+                       break;
+               case 2:
+                       *method = mono_class_get_method_from_name (klass, "Get", -1);
+                       break;
+               case 3:
+                       *method = mono_class_get_method_from_name (klass, "Address", -1);
+                       break;
+               case 4:
+                       *method = mono_class_get_method_from_name (klass, "Set", -1);
+                       break;
+               default:
+                       g_assert_not_reached ();
+               }
        } else {
+               g_assert (image_index < MONO_AOT_METHODREF_MIN);
                *token = MONO_TOKEN_METHOD_DEF | (value & 0xffffff);
 
                image = load_image (module, image_index);
@@ -603,23 +705,17 @@ G_GNUC_UNUSED
 static void
 make_writable (guint8* addr, guint32 len)
 {
-#ifndef PLATFORM_WIN32
        guint8 *page_start;
        int pages, err;
 
        if (mono_aot_only)
                g_error ("Attempt to make AOT memory writable while running in aot-only mode.\n");
 
-       page_start = (guint8 *) (((gssize) (addr)) & ~ (PAGESIZE - 1));
-       pages = (addr + len - page_start + PAGESIZE - 1) / PAGESIZE;
-       err = mprotect (page_start, pages * PAGESIZE, PROT_READ | PROT_WRITE | PROT_EXEC);
+       page_start = (guint8 *) (((gssize) (addr)) & ~ (mono_pagesize () - 1));
+       pages = (addr + len - page_start + mono_pagesize () - 1) / mono_pagesize ();
+
+       err = mono_mprotect (page_start, pages * mono_pagesize (), MONO_MMAP_READ | MONO_MMAP_WRITE | MONO_MMAP_EXEC);
        g_assert (err == 0);
-#else
-       {
-               DWORD oldp;
-               g_assert (VirtualProtect (addr, len, PAGE_EXECUTE_READWRITE, &oldp) != 0);
-       }
-#endif
 }
 
 static void
@@ -775,16 +871,11 @@ load_aot_module (MonoAssembly *assembly, gpointer user_data)
        gboolean usable = TRUE;
        char *saved_guid = NULL;
        char *aot_version = NULL;
-       char *runtime_version;
+       char *runtime_version, *build_info;
        char *opt_flags = NULL;
        gpointer *globals;
        gboolean full_aot = FALSE;
-       gpointer *plt_jump_table_addr = NULL;
-       guint32 *plt_jump_table_size = NULL;
-       guint32 *trampolines_info = NULL;
-       gpointer *got_addr = NULL;
-       gpointer *got = NULL;
-       guint32 *got_size_ptr = NULL;
+       MonoAotFileInfo *file_info = NULL;
        int i;
 
        if (mono_compile_aot)
@@ -800,6 +891,9 @@ load_aot_module (MonoAssembly *assembly, gpointer user_data)
        if (assembly->image->dynamic)
                return;
 
+       if (mono_security_get_mode () == MONO_SECURITY_MODE_CAS)
+               return;
+
        mono_aot_lock ();
        if (static_aot_modules)
                globals = g_hash_table_lookup (static_aot_modules, assembly->aname.name);
@@ -864,10 +958,12 @@ load_aot_module (MonoAssembly *assembly, gpointer user_data)
                }
        }
 
-       if (!runtime_version || ((strlen (runtime_version) > 0 && strcmp (runtime_version, FULL_VERSION)))) {
-               mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_AOT, "AOT module %s is compiled against runtime version %s while this runtime has version %s.\n", aot_name, runtime_version, FULL_VERSION);
+       build_info = mono_get_runtime_build_info ();
+       if (!runtime_version || ((strlen (runtime_version) > 0 && strcmp (runtime_version, build_info)))) {
+               mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_AOT, "AOT module %s is compiled against runtime version '%s' while this runtime has version '%s'.\n", aot_name, runtime_version, build_info);
                usable = FALSE;
        }
+       g_free (build_info);
 
        {
                char *full_aot_str;
@@ -899,18 +995,22 @@ load_aot_module (MonoAssembly *assembly, gpointer user_data)
                return;
        }
 
-       find_symbol (sofile, globals, "got_addr", (gpointer *)&got_addr);
-       g_assert (got_addr);
-       got = (gpointer*)*got_addr;
-       g_assert (got);
-       find_symbol (sofile, globals, "got_size", (gpointer *)&got_size_ptr);
-       g_assert (got_size_ptr);
+       find_symbol (sofile, globals, "mono_aot_file_info", (gpointer*)&file_info);
+       g_assert (file_info);
 
        amodule = g_new0 (MonoAotModule, 1);
        amodule->aot_name = aot_name;
        amodule->assembly = assembly;
-       amodule->got = got;
-       amodule->got_size = *got_size_ptr;
+       amodule->plt_got_offset_base = file_info->plt_got_offset_base;
+       amodule->num_specific_trampolines = file_info->num_specific_trampolines;
+       amodule->specific_trampoline_got_offset_base = file_info->specific_trampoline_got_offset_base;
+       amodule->specific_trampoline_size = file_info->specific_trampoline_size;
+       amodule->got_size = file_info->got_size;
+       amodule->plt_size = file_info->plt_size;
+       amodule->num_static_rgctx_trampolines = file_info->num_static_rgctx_trampolines;
+       amodule->static_rgctx_trampoline_got_offset_base = file_info->static_rgctx_trampoline_got_offset_base;
+       amodule->static_rgctx_trampoline_size = file_info->static_rgctx_trampoline_size;
+       amodule->got = file_info->got;
        amodule->got [0] = assembly->image;
        amodule->globals = globals;
        amodule->sofile = sofile;
@@ -977,29 +1077,15 @@ load_aot_module (MonoAssembly *assembly, gpointer user_data)
        find_symbol (sofile, globals, "extra_method_info_offsets", (gpointer *)&amodule->extra_method_info_offsets);
        find_symbol (sofile, globals, "got_info", (gpointer*)&amodule->got_info);
        find_symbol (sofile, globals, "got_info_offsets", (gpointer*)&amodule->got_info_offsets);
-       find_symbol (sofile, globals, "trampolines", (gpointer*)&amodule->trampolines);
+       find_symbol (sofile, globals, "specific_trampolines", (gpointer*)&amodule->specific_trampolines);
+       find_symbol (sofile, globals, "static_rgctx_trampolines", (gpointer*)&amodule->static_rgctx_trampolines);
+       find_symbol (sofile, globals, "unwind_info", (gpointer)&amodule->unwind_info);
        find_symbol (sofile, globals, "mem_end", (gpointer*)&amodule->mem_end);
 
        amodule->mem_begin = amodule->code;
 
        find_symbol (sofile, globals, "plt", (gpointer*)&amodule->plt);
        find_symbol (sofile, globals, "plt_end", (gpointer*)&amodule->plt_end);
-       find_symbol (sofile, globals, "plt_info", (gpointer*)&amodule->plt_info);
-
-       find_symbol (sofile, globals, "plt_jump_table_addr", (gpointer *)&plt_jump_table_addr);
-       g_assert (plt_jump_table_addr);
-       amodule->plt_jump_table = (guint8*)*plt_jump_table_addr;
-       g_assert (amodule->plt_jump_table);
-
-       find_symbol (sofile, globals, "plt_jump_table_size", (gpointer *)&plt_jump_table_size);
-       g_assert (plt_jump_table_size);
-       amodule->plt_jump_table_size = *plt_jump_table_size;
-
-       find_symbol (sofile, globals, "trampolines_info", (gpointer *)&trampolines_info);
-       if (trampolines_info) {
-               amodule->num_trampolines = trampolines_info [0];
-               amodule->first_trampoline_got_offset = trampolines_info [1];
-       }       
 
        if (make_unreadable) {
 #ifndef PLATFORM_WIN32
@@ -1011,9 +1097,9 @@ load_aot_module (MonoAssembly *assembly, gpointer user_data)
                len = amodule->mem_end - amodule->mem_begin;
 
                /* Round down in both directions to avoid modifying data which is not ours */
-               page_start = (guint8 *) (((gssize) (addr)) & ~ (PAGESIZE - 1)) + PAGESIZE;
-               pages = ((addr + len - page_start + PAGESIZE - 1) / PAGESIZE) - 1;
-               err = mprotect (page_start, pages * PAGESIZE, 0);
+               page_start = (guint8 *) (((gssize) (addr)) & ~ (mono_pagesize () - 1)) + mono_pagesize ();
+               pages = ((addr + len - page_start + mono_pagesize () - 1) / mono_pagesize ()) - 1;
+               err = mono_mprotect (page_start, pages * mono_pagesize (), MONO_MMAP_NONE);
                g_assert (err == 0);
 #endif
        }
@@ -1315,14 +1401,17 @@ mono_aot_get_class_from_name (MonoImage *image, const char *name_space, const ch
        return TRUE;
 }
 
+/*
+ * LOCKING: Acquires the domain lock.
+ */
 static MonoJitInfo*
 decode_exception_debug_info (MonoAotModule *aot_module, MonoDomain *domain, 
                                                         MonoMethod *method, guint8* ex_info, guint8 *code)
 {
        int i, buf_len;
        MonoJitInfo *jinfo;
-       guint code_len, used_int_regs;
-       gboolean has_generic_jit_info;
+       guint code_len, used_int_regs, flags;
+       gboolean has_generic_jit_info, has_dwarf_unwind_info;
        guint8 *p;
        MonoMethodHeader *header;
        int generic_info_size;
@@ -1333,8 +1422,18 @@ decode_exception_debug_info (MonoAotModule *aot_module, MonoDomain *domain,
 
        p = ex_info;
        code_len = decode_value (p, &p);
-       used_int_regs = decode_value (p, &p);
-       has_generic_jit_info = decode_value (p, &p);
+       flags = decode_value (p, &p);
+       has_generic_jit_info = (flags & 1) != 0;
+       has_dwarf_unwind_info = (flags & 2) != 0;
+       if (has_dwarf_unwind_info) {
+               guint32 offset;
+
+               offset = decode_value (p, &p);
+               g_assert (offset < (1 << 30));
+               used_int_regs = offset;
+       } else {
+               used_int_regs = decode_value (p, &p);
+       }
        if (has_generic_jit_info)
                generic_info_size = sizeof (MonoGenericJitInfo);
        else
@@ -1363,14 +1462,16 @@ decode_exception_debug_info (MonoAotModule *aot_module, MonoDomain *domain,
                        ei->handler_start = code + decode_value (p, &p);
                }
        }
-       else
+       else {
                jinfo = mono_domain_alloc0 (domain, sizeof (MonoJitInfo) + generic_info_size);
+       }
 
        jinfo->code_size = code_len;
        jinfo->used_regs = used_int_regs;
        jinfo->method = method;
        jinfo->code_start = code;
        jinfo->domain_neutral = 0;
+       jinfo->from_aot = 1;
 
        if (has_generic_jit_info) {
                MonoGenericJitInfo *gi;
@@ -1397,6 +1498,25 @@ decode_exception_debug_info (MonoAotModule *aot_module, MonoDomain *domain,
        return jinfo;
 }
 
+/*
+ * mono_aot_get_unwind_info:
+ *
+ *   Return a pointer to the DWARF unwind info belonging to JI.
+ */
+guint8*
+mono_aot_get_unwind_info (MonoJitInfo *ji, guint32 *unwind_info_len)
+{
+       MonoAotModule *amodule = ji->method->klass->image->aot_module;
+       guint8 *p;
+
+       g_assert (amodule);
+       g_assert (ji->from_aot);
+
+       p = amodule->unwind_info + ji->used_regs;
+       *unwind_info_len = decode_value (p, &p);
+       return p;
+}
+
 MonoJitInfo *
 mono_aot_find_jit_info (MonoDomain *domain, MonoImage *image, gpointer addr)
 {
@@ -1577,6 +1697,7 @@ is_shared_got_patch (MonoJumpInfo *patch_info)
        case MONO_PATCH_INFO_TYPE_FROM_HANDLE:
        case MONO_PATCH_INFO_RVA:
        case MONO_PATCH_INFO_METHODCONST:
+       case MONO_PATCH_INFO_IMAGE:
                return TRUE;
        default:
                return FALSE;
@@ -1726,6 +1847,8 @@ decode_patch (MonoAotModule *aot_module, MonoMemPool *mp, MonoJumpInfo *ji, guin
                break;
        case MONO_PATCH_INFO_INTERRUPTION_REQUEST_FLAG:
        case MONO_PATCH_INFO_GENERIC_CLASS_INIT:
+       case MONO_PATCH_INFO_MONITOR_ENTER:
+       case MONO_PATCH_INFO_MONITOR_EXIT:
                break;
        case MONO_PATCH_INFO_RGCTX_FETCH: {
                gboolean res;
@@ -1757,6 +1880,14 @@ decode_patch (MonoAotModule *aot_module, MonoMemPool *mp, MonoJumpInfo *ji, guin
        return FALSE;
 }
 
+/*
+ * decode_got_entry:
+ *
+ *   Decode a reference to a GOT entry. GOT_OFFSET is set to the index of the got
+ * entry. If that got entry is not already filled out, then JI is filled out with
+ * the information required to resolve the value of the GOT entry.
+ * FIXME: Clean up this confusing API.
+ */
 static gboolean
 decode_got_entry (MonoAotModule *aot_module, MonoMemPool *mp, MonoJumpInfo *ji, guint8 *buf, guint8 **endbuf, guint32 *got_offset)
 {
@@ -1871,10 +2002,10 @@ static gpointer
 load_method (MonoDomain *domain, MonoAotModule *aot_module, MonoImage *image, MonoMethod *method, guint32 token, int method_index)
 {
        MonoClass *klass;
-       MonoJumpInfo *patch_info = NULL;
+       gboolean from_plt = method == NULL;
        MonoMemPool *mp;
        int i, pindex, got_index = 0, n_patches, used_strings;
-       gboolean non_got_patches, keep_patches = TRUE;
+       gboolean keep_patches = TRUE;
        guint8 *p, *ex_info;
        MonoJitInfo *jinfo = NULL;
        guint8 *code, *info;
@@ -1938,9 +2069,7 @@ load_method (MonoDomain *domain, MonoAotModule *aot_module, MonoImage *image, Mo
                        jinfo = decode_exception_debug_info (aot_module, domain, method, ex_info, code);
                }
 
-               mono_domain_lock (domain);
-               code2 = mono_code_manager_reserve (domain->code_mp, jinfo->code_size);
-               mono_domain_unlock (domain);
+               code2 = mono_domain_code_reserve (domain, jinfo->code_size);
                memcpy (code2, code, jinfo->code_size);
                mono_arch_flush_icache (code2, jinfo->code_size);
                code = code2;
@@ -1978,30 +2107,15 @@ load_method (MonoDomain *domain, MonoAotModule *aot_module, MonoImage *image, Mo
                if (patches == NULL)
                        goto cleanup;
 
-               non_got_patches = FALSE;
                for (pindex = 0; pindex < n_patches; ++pindex) {
                        MonoJumpInfo *ji = &patches [pindex];
 
-                       if (is_got_patch (ji->type)) {
-                               if (!aot_module->got [got_slots [pindex]]) {
-                                       aot_module->got [got_slots [pindex]] = mono_resolve_patch_target (method, domain, code, ji, TRUE);
-                                       if (ji->type == MONO_PATCH_INFO_METHOD_JUMP)
-                                               register_jump_target_got_slot (domain, ji->data.method, &(aot_module->got [got_slots [pindex]]));
-                               }
-                               ji->type = MONO_PATCH_INFO_NONE;
-                       }
-                       else
-                               non_got_patches = TRUE;
-               }
-               if (non_got_patches) {
-                       if (!jinfo) {
-                               ex_info = &aot_module->ex_info [aot_module->ex_info_offsets [mono_metadata_token_index (token) - 1]];
-                               jinfo = decode_exception_debug_info (aot_module, domain, method, ex_info, code);
+                       if (!aot_module->got [got_slots [pindex]]) {
+                               aot_module->got [got_slots [pindex]] = mono_resolve_patch_target (method, domain, code, ji, TRUE);
+                               if (ji->type == MONO_PATCH_INFO_METHOD_JUMP)
+                                       register_jump_target_got_slot (domain, ji->data.method, &(aot_module->got [got_slots [pindex]]));
                        }
-
-                       mono_arch_flush_icache (code, jinfo->code_size);
-                       make_writable (code, jinfo->code_size);
-                       mono_arch_patch_code (method, domain, code, patch_info, TRUE);
+                       ji->type = MONO_PATCH_INFO_NONE;
                }
 
                g_free (got_slots);
@@ -2010,10 +2124,6 @@ load_method (MonoDomain *domain, MonoAotModule *aot_module, MonoImage *image, Mo
                        mono_mempool_destroy (mp);
        }
 
-       mono_aot_lock ();
-
-       mono_jit_stats.methods_aot++;
-
        if (mono_trace_is_traced (G_LOG_LEVEL_DEBUG, MONO_TRACE_AOT)) {
                char *full_name;
 
@@ -2031,6 +2141,10 @@ load_method (MonoDomain *domain, MonoAotModule *aot_module, MonoImage *image, Mo
                g_free (full_name);
        }
 
+       mono_aot_lock ();
+
+       mono_jit_stats.methods_aot++;
+
        aot_module->methods_loaded [method_index / 32] |= 1 << (method_index % 32);
 
        init_plt (aot_module);
@@ -2040,7 +2154,7 @@ load_method (MonoDomain *domain, MonoAotModule *aot_module, MonoImage *image, Mo
 
        mono_aot_unlock ();
 
-       if (!method && klass)
+       if (from_plt && klass && !klass->generic_container)
                mono_runtime_class_init (mono_class_vtable (domain, klass));
 
        return code;
@@ -2062,7 +2176,9 @@ find_extra_method_in_amodule (MonoAotModule *amodule, MonoMethod *method)
 {
        guint32 table_size, entry_size, hash;
        guint32 *table, *entry;
-       char *full_name = NULL;
+       char *name = NULL;
+       int num_checks = 0;
+       guint32 index;
 
        if (!amodule)
                return 0xffffff;
@@ -2072,53 +2188,79 @@ find_extra_method_in_amodule (MonoAotModule *amodule, MonoMethod *method)
        entry_size = 3;
 
        if (method->wrapper_type) {
-               /* FIXME: This is a hack to work around the fact that runtime invoke wrappers get assigned to some random class */
-               if (method->wrapper_type == MONO_WRAPPER_RUNTIME_INVOKE) {
-                       char *tmpsig = mono_signature_get_desc (mono_method_signature (method), TRUE);
-                       full_name = g_strdup_printf ("(wrapper runtime-invoke):%s (%s)", method->name, tmpsig);
-                       g_free (tmpsig);
-               } else {
-                       full_name = mono_method_full_name (method, TRUE);
-               }
+               name = mono_aot_wrapper_name (method);
        }
 
-       if (method->wrapper_type)
-               hash = g_str_hash (method->name) % table_size;
-       else
-               hash = 0 % table_size;
+       hash = mono_aot_method_hash (method) % table_size;
 
        entry = &table [hash * entry_size];
 
-       if (entry [0] != 0) {
-               while (TRUE) {
-                       guint32 key = entry [0];
-                       guint32 value = entry [1];
-                       guint32 next = entry [entry_size - 1];
-                       MonoMethod *m;
-                       guint8 *p;
-                       int is_wrapper;
-
-                       // FIXME: Avoid fully decoding the method ref
-                       p = amodule->extra_method_info + key;
-                       is_wrapper = decode_value (p, &p);
-                       if (method->wrapper_type && is_wrapper) {
-                               if (!strcmp (full_name, (char*)p))
-                                       return value;
-                       } else {
+       if (entry [0] == 0)
+               return 0xffffff;
+
+       index = 0xffffff;
+       while (TRUE) {
+               guint32 key = entry [0];
+               guint32 value = entry [1];
+               guint32 next = entry [entry_size - 1];
+               MonoMethod *m;
+               guint8 *p;
+               int is_wrapper_name;
+
+               p = amodule->extra_method_info + key;
+               is_wrapper_name = decode_value (p, &p);
+               if (is_wrapper_name) {
+                       int wrapper_type = decode_value (p, &p);
+                       if (wrapper_type == method->wrapper_type && !strcmp (name, (char*)p)) {
+                               index = value;
+                               break;
+                       }
+               } else if (can_method_ref_match_method (amodule, p, method)) {
+                       num_checks ++;
+                       mono_aot_lock ();
+                       if (!amodule->method_ref_to_method)
+                               amodule->method_ref_to_method = g_hash_table_new (NULL, NULL);
+                       m = g_hash_table_lookup (amodule->method_ref_to_method, p);
+                       mono_aot_unlock ();
+                       if (!m) {
+                               guint8 *orig_p = p;
                                m = decode_method_ref_2 (amodule, p, &p);
-                               if (m == method)
-                                       return value;
+                               if (m) {
+                                       mono_aot_lock ();
+                                       g_hash_table_insert (amodule->method_ref_to_method, orig_p, m);
+                                       mono_aot_unlock ();
+                               }
                        }
-
-                       if (next != 0) {
-                               entry = &table [next * entry_size];
-                       } else {
+                       /*
+                         if (m)
+                         printf ("%d %s %s\n", num_checks, mono_method_full_name (method, TRUE), mono_method_full_name (m, TRUE));
+                       */
+                       if (m == method) {
+                               index = value;
                                break;
                        }
+
+                       /* Special case: wrappers of shared generic methods */
+                       if (m && method->wrapper_type && m->wrapper_type == m->wrapper_type &&
+                               method->wrapper_type == MONO_WRAPPER_SYNCHRONIZED) {
+                               MonoMethod *w1 = mono_marshal_method_from_wrapper (method);
+                               MonoMethod *w2 = mono_marshal_method_from_wrapper (m);
+
+                               if (w1->is_inflated && ((MonoMethodInflated *)w1)->declaring == w2) {
+                                       index = value;
+                                       break;
+                               }
+                       }
                }
+
+               if (next != 0)
+                       entry = &table [next * entry_size];
+               else
+                       break;
        }
 
-       return 0xffffff;
+       g_free (name);
+       return index;
 }
 
 static void
@@ -2188,6 +2330,9 @@ mono_aot_get_method (MonoDomain *domain, MonoMethod *method)
        if (!amodule)
                return NULL;
 
+       if (amodule->out_of_date)
+               return NULL;
+
        if ((method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) ||
                (method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) ||
                (method->iflags & METHOD_IMPL_ATTRIBUTE_RUNTIME) ||
@@ -2324,106 +2469,6 @@ find_aot_module (guint8 *code)
        return user_data.module;
 }
 
-/*
- * mono_aot_set_make_unreadable:
- *
- *   Set whenever to make all mmaped memory unreadable. In conjuction with a
- * SIGSEGV handler, this is useful to find out which pages the runtime tries to read.
- */
-void
-mono_aot_set_make_unreadable (gboolean unreadable)
-{
-       make_unreadable = unreadable;
-}
-
-typedef struct {
-       MonoAotModule *module;
-       guint8 *ptr;
-} FindMapUserData;
-
-static void
-find_map (gpointer key, gpointer value, gpointer user_data)
-{
-       MonoAotModule *module = (MonoAotModule*)value;
-       FindMapUserData *data = (FindMapUserData*)user_data;
-
-       if (!data->module)
-               if ((data->ptr >= module->mem_begin) && (data->ptr < module->mem_end))
-                       data->module = module;
-}
-
-static MonoAotModule*
-find_module_for_addr (void *ptr)
-{
-       FindMapUserData data;
-
-       if (!make_unreadable)
-               return NULL;
-
-       data.module = NULL;
-       data.ptr = (guint8*)ptr;
-
-       mono_aot_lock ();
-       g_hash_table_foreach (aot_modules, (GHFunc)find_map, &data);
-       mono_aot_unlock ();
-
-       return data.module;
-}
-
-/*
- * mono_aot_is_pagefault:
- *
- *   Should be called from a SIGSEGV signal handler to find out whenever @ptr is
- * within memory allocated by this module.
- */
-gboolean
-mono_aot_is_pagefault (void *ptr)
-{
-       if (!make_unreadable)
-               return FALSE;
-
-       return find_module_for_addr (ptr) != NULL;
-}
-
-/*
- * mono_aot_handle_pagefault:
- *
- *   Handle a pagefault caused by an unreadable page by making it readable again.
- */
-void
-mono_aot_handle_pagefault (void *ptr)
-{
-#ifndef PLATFORM_WIN32
-       guint8* start = (guint8*)ROUND_DOWN (((gssize)ptr), PAGESIZE);
-       int res;
-
-       mono_aot_lock ();
-       res = mprotect (start, PAGESIZE, PROT_READ|PROT_WRITE|PROT_EXEC);
-       g_assert (res == 0);
-
-       n_pagefaults ++;
-       mono_aot_unlock ();
-
-#if 0
- {
-       void *array [256];
-       char **names;
-       int i, size;
-
-       printf ("\nNative stacktrace:\n\n");
-
-       size = backtrace (array, 256);
-       names = backtrace_symbols (array, size);
-       for (i =0; i < size; ++i) {
-               printf ("\t%s\n", names [i]);
-       }
-       free (names);
- }
-#endif
-
-#endif
-}
-
 /*
  * mono_aot_plt_resolve:
  *
@@ -2442,7 +2487,7 @@ mono_aot_plt_resolve (gpointer aot_module, guint32 plt_info_offset, guint8 *code
 
        //printf ("DYN: %p %d\n", aot_module, plt_info_offset);
 
-       p = &module->plt_info [plt_info_offset];
+       p = &module->got_info [plt_info_offset];
 
        ji.type = decode_value (p, &p);
 
@@ -2480,10 +2525,8 @@ init_plt (MonoAotModule *info)
 #ifdef MONO_ARCH_AOT_SUPPORTED
 #ifdef __i386__
        guint8 *buf = info->plt;
-#elif defined(__x86_64__)
-       int i, n_entries;
-#elif defined(__arm__)
-       int i, n_entries;
+#elif defined(__x86_64__) || defined(__arm__)
+       int i;
 #endif
        gpointer tramp;
 
@@ -2498,15 +2541,14 @@ init_plt (MonoAotModule *info)
        x86_jump_code (buf, tramp);
 #elif defined(__x86_64__) || defined(__arm__)
        /*
-        * Initialize the entries in the plt_jump_table to point to the default targets.
+        * Initialize the PLT entries in the GOT to point to the default targets.
         */
-        n_entries = info->plt_jump_table_size / sizeof (gpointer);
 
         /* The first entry points to the AOT trampoline */
-        ((gpointer*)info->plt_jump_table)[0] = tramp;
-        for (i = 1; i < n_entries; ++i)
+        ((gpointer*)info->got)[info->plt_got_offset_base] = tramp;
+        for (i = 1; i < info->plt_size; ++i)
                 /* All the default entries point to the first entry */
-                ((gpointer*)info->plt_jump_table)[i] = info->plt;
+                ((gpointer*)info->got)[info->plt_got_offset_base + i] = info->plt;
 #else
        g_assert_not_reached ();
 #endif
@@ -2630,6 +2672,9 @@ load_named_code (MonoAotModule *amodule, const char *name)
                        MonoJumpInfo *ji = &patches [pindex];
                        gpointer target;
 
+                       if (amodule->got [got_slots [pindex]])
+                               continue;
+
                        /*
                         * When this code is executed, the runtime may not yet initalized, so
                         * resolve the patch info by hand.
@@ -2647,16 +2692,35 @@ load_named_code (MonoAotModule *amodule, const char *name)
                                } else if (!strcmp (ji->data.name, "mono_amd64_throw_exception")) {
                                        target = mono_amd64_throw_exception;
 #endif
+#ifdef __x86_64__
+                               } else if (!strcmp (ji->data.name, "mono_amd64_get_original_ip")) {
+                                       target = mono_amd64_get_original_ip;
+#endif
 #ifdef __arm__
                                } else if (!strcmp (ji->data.name, "mono_arm_throw_exception")) {
                                        target = mono_arm_throw_exception;
+                               } else if (!strcmp (ji->data.name, "mono_arm_throw_exception_by_token")) {
+                                       target = mono_arm_throw_exception_by_token;
 #endif
                                } else if (strstr (ji->data.name, "trampoline_func_") == ji->data.name) {
                                        int tramp_type2 = atoi (ji->data.name + strlen ("trampoline_func_"));
                                        target = (gpointer)mono_get_trampoline_func (tramp_type2);
                                } else if (strstr (ji->data.name, "specific_trampoline_lazy_fetch_") == ji->data.name) {
-                                       guint32 slot = atoi (ji->data.name + strlen ("specific_trampoline_lazy_fetch_"));
+                                       /* atoll is needed because the the offset is unsigned */
+                                       guint32 slot;
+                                       int res;
+
+                                       res = sscanf (ji->data.name, "specific_trampoline_lazy_fetch_%u", &slot);
+                                       g_assert (res == 1);
                                        target = mono_create_specific_trampoline (GUINT_TO_POINTER (slot), MONO_TRAMPOLINE_RGCTX_LAZY_FETCH, mono_get_root_domain (), NULL);
+                               } else if (!strcmp (ji->data.name, "specific_trampoline_monitor_enter")) {
+                                       target = mono_create_specific_trampoline (NULL, MONO_TRAMPOLINE_MONITOR_ENTER, mono_get_root_domain (), NULL);
+                               } else if (!strcmp (ji->data.name, "specific_trampoline_monitor_exit")) {
+                                       target = mono_create_specific_trampoline (NULL, MONO_TRAMPOLINE_MONITOR_EXIT, mono_get_root_domain (), NULL);
+                               } else if (!strcmp (ji->data.name, "specific_trampoline_generic_class_init")) {
+                                       target = mono_create_specific_trampoline (NULL, MONO_TRAMPOLINE_GENERIC_CLASS_INIT, mono_get_root_domain (), NULL);
+                               } else if (!strcmp (ji->data.name, "mono_thread_get_and_clear_pending_exception")) {
+                                       target = mono_thread_get_and_clear_pending_exception;
                                } else {
                                        fprintf (stderr, "Unknown relocation '%s'\n", ji->data.name);
                                        g_assert_not_reached ();
@@ -2667,6 +2731,7 @@ load_named_code (MonoAotModule *amodule, const char *name)
                                 * domain to be set.
                                 */
                                target = mono_resolve_patch_target (NULL, NULL, code, ji, FALSE);
+                               g_assert (target);
                        }
 
                        amodule->got [got_slots [pindex]] = target;
@@ -2708,6 +2773,8 @@ mono_aot_create_specific_trampoline (MonoImage *image, gpointer arg1, MonoTrampo
        int index, tramp_size;
        guint8 *code, *tramp;
        static gpointer generic_trampolines [MONO_TRAMPOLINE_NUM];
+       static gboolean inited;
+       static guint32 num_trampolines;
 
        /* Currently, we keep all trampolines in the mscorlib AOT image */
        image = mono_defaults.corlib;
@@ -2715,13 +2782,20 @@ mono_aot_create_specific_trampoline (MonoImage *image, gpointer arg1, MonoTrampo
 
        mono_aot_lock ();
 
+       if (!inited) {
+               mono_counters_register ("Specific trampolines", MONO_COUNTER_JIT | MONO_COUNTER_INT, &num_trampolines);
+               inited = TRUE;
+       }
+
        amodule = image->aot_module;
        g_assert (amodule);
 
-       if (amodule->trampoline_index == amodule->num_trampolines)
-               g_error ("Ran out of trampolines in '%s' (%d)\n", image->name, amodule->num_trampolines);
+       if (amodule->specific_trampoline_index == amodule->num_specific_trampolines)
+               g_error ("Ran out of trampolines in '%s' (%d)\n", image->name, amodule->num_specific_trampolines);
 
-       index = amodule->trampoline_index ++;
+       index = amodule->specific_trampoline_index ++;
+
+       num_trampolines ++;
 
        mono_aot_unlock ();
 
@@ -2736,25 +2810,52 @@ mono_aot_create_specific_trampoline (MonoImage *image, gpointer arg1, MonoTrampo
        tramp = generic_trampolines [tramp_type];
        g_assert (tramp);
 
-       amodule->got [amodule->first_trampoline_got_offset + (index *2)] = tramp;
-       amodule->got [amodule->first_trampoline_got_offset + (index *2) + 1] = arg1;
+       amodule->got [amodule->specific_trampoline_got_offset_base + (index *2)] = tramp;
+       amodule->got [amodule->specific_trampoline_got_offset_base + (index *2) + 1] = arg1;
 
-#ifdef __x86_64__
-       tramp_size = 16;
-#elif defined(__arm__)
-       tramp_size = 28;
-#else
-       tramp_size = -1;
-       g_assert_not_reached ();
-#endif
+       tramp_size = amodule->specific_trampoline_size;
 
-       code = amodule->trampolines + (index * tramp_size);
+       code = amodule->specific_trampolines + (index * tramp_size);
        if (code_len)
                *code_len = tramp_size;
 
        return code;
 }
 
+gpointer
+mono_aot_get_static_rgctx_trampoline (gpointer ctx, gpointer addr)
+{
+       MonoAotModule *amodule;
+       int index, tramp_size;
+       guint8 *code;
+       MonoImage *image;
+
+       /* Currently, we keep all trampolines in the mscorlib AOT image */
+       image = mono_defaults.corlib;
+       g_assert (image);
+
+       mono_aot_lock ();
+
+       amodule = image->aot_module;
+       g_assert (amodule);
+
+       if (amodule->static_rgctx_trampoline_index == amodule->num_static_rgctx_trampolines)
+               g_error ("Ran out of trampolines in '%s' (%d)\n", image->name, amodule->num_static_rgctx_trampolines);
+
+       index = amodule->static_rgctx_trampoline_index ++;
+
+       mono_aot_unlock ();
+
+       amodule->got [amodule->static_rgctx_trampoline_got_offset_base + (index *2)] = ctx;
+       amodule->got [amodule->static_rgctx_trampoline_got_offset_base + (index *2) + 1] = addr; 
+
+       tramp_size = amodule->static_rgctx_trampoline_size;
+
+       code = amodule->static_rgctx_trampolines + (index * tramp_size);
+
+       return code;
+}
+
 gpointer
 mono_aot_get_unbox_trampoline (MonoMethod *method)
 {
@@ -2763,10 +2864,18 @@ mono_aot_get_unbox_trampoline (MonoMethod *method)
        char *symbol;
        gpointer code;
 
-       amodule = method->klass->image->aot_module;
-       g_assert (amodule);
+       if (method->is_inflated) {
+               guint32 index = find_extra_method (method, &amodule);
+
+               g_assert (index != 0xffffff);
+               
+               symbol = g_strdup_printf ("ut_e_%d", index);
+       } else {
+               amodule = method->klass->image->aot_module;
+               g_assert (amodule);
 
-       symbol = g_strdup_printf ("unbox_trampoline_%d", method_index);
+               symbol = g_strdup_printf ("ut_%d", method_index);
+       }
        code = load_named_code (amodule, symbol);
        g_free (symbol);
        return code;
@@ -2784,17 +2893,6 @@ mono_aot_get_lazy_fetch_trampoline (guint32 slot)
        return code;
 }
 
-/*
- * mono_aot_get_n_pagefaults:
- *
- *   Return the number of times handle_pagefault is called.
- */
-guint32
-mono_aot_get_n_pagefaults (void)
-{
-       return n_pagefaults;
-}
-
 #else
 /* AOT disabled */
 
@@ -2839,62 +2937,62 @@ mono_aot_get_method_from_token (MonoDomain *domain, MonoImage *image, guint32 to
        return NULL;
 }
 
-gboolean
-mono_aot_is_pagefault (void *ptr)
+guint8*
+mono_aot_get_plt_entry (guint8 *code)
 {
-       return FALSE;
+       return NULL;
 }
 
-void
-mono_aot_set_make_unreadable (gboolean unreadable)
+gpointer
+mono_aot_plt_resolve (gpointer aot_module, guint32 plt_info_offset, guint8 *code)
 {
+       return NULL;
 }
 
-guint32
-mono_aot_get_n_pagefaults (void)
+gpointer
+mono_aot_get_method_from_vt_slot (MonoDomain *domain, MonoVTable *vtable, int slot)
 {
-       return 0;
+       return NULL;
 }
 
-void
-mono_aot_handle_pagefault (void *ptr)
+guint32
+mono_aot_get_plt_info_offset (gssize *regs, guint8 *code)
 {
-}
+       g_assert_not_reached ();
 
-guint8*
-mono_aot_get_plt_entry (guint8 *code)
-{
-       return NULL;
+       return 0;
 }
 
 gpointer
-mono_aot_plt_resolve (gpointer aot_module, guint32 plt_info_offset, guint8 *code)
+mono_aot_create_specific_trampoline (MonoImage *image, gpointer arg1, MonoTrampolineType tramp_type, MonoDomain *domain, guint32 *code_len)
 {
+       g_assert_not_reached ();
        return NULL;
 }
 
 gpointer
-mono_aot_get_method_from_vt_slot (MonoDomain *domain, MonoVTable *vtable, int slot)
+mono_aot_get_static_rgctx_trampoline (gpointer ctx, gpointer addr)
 {
+       g_assert_not_reached ();
        return NULL;
 }
 
 gpointer
-mono_aot_create_specific_trampolines (gpointer arg1, MonoTrampolineType tramp_type, MonoDomain *domain, guint32 *code_len)
+mono_aot_get_named_code (const char *name)
 {
        g_assert_not_reached ();
        return NULL;
 }
 
 gpointer
-mono_aot_get_named_code (char *name)
+mono_aot_get_unbox_trampoline (MonoMethod *method)
 {
        g_assert_not_reached ();
        return NULL;
 }
 
 gpointer
-mono_aot_get_unbox_trampoline (MonoMethod *method)
+mono_aot_get_lazy_fetch_trampoline (guint32 slot)
 {
        g_assert_not_reached ();
        return NULL;