Update two days worth of copyrights, many more missing
[mono.git] / mono / mini / mini.h
index ccc271fe188c3c6cae136bbd2a7bb7b8d9138002..60db6a8abc3f913ba513f9a9c0aa545e4bb17ecd 100644 (file)
@@ -1,3 +1,8 @@
+/*
+ * Copyright 2002-2003 Ximian Inc
+ * Copyright 2003-2011 Novell Inc
+ * Copyright 2011 Xamarin Inc
+ */
 #ifndef __MONO_MINI_H__
 #define __MONO_MINI_H__
 
@@ -21,6 +26,9 @@
 #include <mono/metadata/debug-helpers.h>
 #include <mono/utils/mono-compiler.h>
 #include <mono/utils/mono-machine.h>
+#include <mono/utils/mono-stack-unwinding.h>
+#include <mono/utils/mono-threads.h>
+#include <mono/utils/mono-tls.h>
 
 #define MONO_BREAKPOINT_ARRAY_SIZE 64
 
 #endif
 
 /* Version number of the AOT file format */
-#define MONO_AOT_FILE_VERSION 75
+#define MONO_AOT_FILE_VERSION 79
 
 //TODO: This is x86/amd64 specific.
 #define mono_simd_shuffle_mask(a,b,c,d) ((a) | ((b) << 2) | ((c) << 4) | ((d) << 6))
 /* Constants used to encode different types of methods in AOT */
 enum {
        MONO_AOT_METHODREF_MIN = 240,
-       /* Method encoded using its name */
-       MONO_AOT_METHODREF_WRAPPER_NAME = 250,
        /* Runtime provided methods on arrays */
-       MONO_AOT_METHODREF_ARRAY = 251,
-       MONO_AOT_METHODREF_NO_AOT_TRAMPOLINE = 252,
+       MONO_AOT_METHODREF_ARRAY = 250,
+       MONO_AOT_METHODREF_NO_AOT_TRAMPOLINE = 251,
        /* Wrappers */
-       MONO_AOT_METHODREF_WRAPPER = 253,
+       MONO_AOT_METHODREF_WRAPPER = 252,
        /* Methods on generic instances */
-       MONO_AOT_METHODREF_GINST = 254,
+       MONO_AOT_METHODREF_GINST = 253,
        /* Methods resolve using a METHODSPEC token */
-       MONO_AOT_METHODREF_METHODSPEC = 255,
+       MONO_AOT_METHODREF_METHODSPEC = 254,
+};
+
+/* Constants used to encode different types of types in AOT */
+enum {
+       /* typedef index */
+       MONO_AOT_TYPEREF_TYPEDEF_INDEX = 1,
+       /* typedef index + image index */
+       MONO_AOT_TYPEREF_TYPEDEF_INDEX_IMAGE = 2,
+       /* typespec token */
+       MONO_AOT_TYPEREF_TYPESPEC_TOKEN = 3,
+       /* generic inst */
+       MONO_AOT_TYPEREF_GINST = 4,
+       /* type/method variable */
+       MONO_AOT_TYPEREF_VAR = 5,
+       /* array */
+       MONO_AOT_TYPEREF_ARRAY = 6,
+       /* blob index of the type encoding */
+       MONO_AOT_TYPEREF_BLOB_INDEX = 7
 };
 
 /* Trampolines which we have a lot of */
@@ -198,6 +222,10 @@ typedef struct MonoAotFileInfo
        gpointer globals;
        /* Points to a string containing the assembly name*/
        gpointer assembly_name;
+       /* Points to a table mapping methods to their unbox trampolines */
+       gpointer unbox_trampolines;
+       /* Points to the end of the previous table */
+       gpointer unbox_trampolines_end;
 
        /* The index of the first GOT slot used by the PLT */
        guint32 plt_got_offset_base;
@@ -269,44 +297,10 @@ typedef struct {
 } MonoDynCallInfo;
 
 /*
- * Possible frame types returned by the stack walker.
+ * Information about a stack frame.
+ * FIXME This typedef exists only to avoid tons of code rewriting
  */
-typedef enum {
-       /* Normal managed frames */
-       FRAME_TYPE_MANAGED = 0,
-       /* Pseudo frame marking the start of a method invocation done by the soft debugger */
-       FRAME_TYPE_DEBUGGER_INVOKE = 1,
-       /* Frame for transitioning to native code */
-       FRAME_TYPE_MANAGED_TO_NATIVE = 2,
-       FRAME_TYPE_SENTINEL = 3
-} StackFrameType;
-
-/*
- * Information about a stack frame
- */
-typedef struct {
-       StackFrameType type;
-       /* 
-        * For FRAME_TYPE_MANAGED, otherwise NULL.
-        */
-       MonoJitInfo *ji;
-       /*
-        * Same as ji->method.
-        */
-       MonoMethod *method;
-       /*
-        * If ji->method is a gshared method, this is the actual method instance.
-        */
-       MonoMethod *actual_method;
-       /* The domain containing the code executed by this frame */
-       MonoDomain *domain;
-       gboolean managed;
-       int native_offset;
-       int il_offset;
-       gpointer lmf;
-       guint32 unwind_info_len;
-       guint8 *unwind_info;
-} StackFrameInfo;
+typedef MonoStackFrameInfo StackFrameInfo;
 
 typedef struct {
        int il_offset, native_offset;
@@ -472,7 +466,7 @@ typedef struct MonoLMF MonoLMF;
 typedef struct MonoSpillInfo MonoSpillInfo;
 typedef struct MonoTraceSpec MonoTraceSpec;
 
-extern guint32 mono_jit_tls_id;
+extern MonoNativeTlsKey mono_jit_tls_id;
 extern MonoTraceSpec *mono_jit_trace_calls;
 extern gboolean mono_break_on_exc;
 extern int mono_exc_esp_offset;
@@ -767,6 +761,7 @@ struct MonoInst {
                MonoInst *spill_var; /* for OP_ICONV_TO_R8_RAW and OP_FCONV_TO_R8_X */
                guint16 source_opcode; /*OP_XCONV_R8_TO_I4 needs to know which op was used to do proper widening*/
                int pc_offset; /* OP_GC_LIVERANGE_START/END */
+               int memory_barrier_kind; /* see mono-memory-model.h for valid values */
        } backend;
        
        MonoClass *klass;
@@ -803,6 +798,9 @@ struct MonoCallInst {
        LLVMCallInfo *cinfo;
        int rgctx_arg_reg, imt_arg_reg;
 #endif
+#if defined(TARGET_ARM)
+       GSList *r4_args;
+#endif
 };
 
 struct MonoCallArgParm {
@@ -1014,6 +1012,48 @@ typedef struct {
        MonoContext ctx; /* if debugger_invoke is TRUE */
 } MonoLMFExt;
 
+/* Generic sharing */
+typedef enum {
+       MONO_RGCTX_INFO_STATIC_DATA,
+       MONO_RGCTX_INFO_KLASS,
+       MONO_RGCTX_INFO_VTABLE,
+       MONO_RGCTX_INFO_TYPE,
+       MONO_RGCTX_INFO_REFLECTION_TYPE,
+       MONO_RGCTX_INFO_METHOD,
+       MONO_RGCTX_INFO_GENERIC_METHOD_CODE,
+       MONO_RGCTX_INFO_CLASS_FIELD,
+       MONO_RGCTX_INFO_METHOD_RGCTX,
+       MONO_RGCTX_INFO_METHOD_CONTEXT,
+       MONO_RGCTX_INFO_REMOTING_INVOKE_WITH_CHECK,
+       MONO_RGCTX_INFO_METHOD_DELEGATE_CODE,
+       MONO_RGCTX_INFO_CAST_CACHE
+} MonoRgctxInfoType;
+
+typedef struct _MonoRuntimeGenericContextOtherInfoTemplate {
+       MonoRgctxInfoType info_type;
+       gpointer data;
+       struct _MonoRuntimeGenericContextOtherInfoTemplate *next;
+} MonoRuntimeGenericContextOtherInfoTemplate;
+
+typedef struct {
+       MonoClass *next_subclass;
+       MonoRuntimeGenericContextOtherInfoTemplate *other_infos;
+       GSList *method_templates;
+} MonoRuntimeGenericContextTemplate;
+
+typedef struct {
+       MonoVTable *class_vtable; /* must be the first element */
+       MonoGenericInst *method_inst;
+       gpointer infos [MONO_ZERO_LEN_ARRAY];
+} MonoMethodRuntimeGenericContext;
+
+#define MONO_SIZEOF_METHOD_RUNTIME_GENERIC_CONTEXT (sizeof (MonoMethodRuntimeGenericContext) - MONO_ZERO_LEN_ARRAY * SIZEOF_VOID_P)
+
+#define MONO_RGCTX_SLOT_MAKE_RGCTX(i)  (i)
+#define MONO_RGCTX_SLOT_MAKE_MRGCTX(i) ((i) | 0x80000000)
+#define MONO_RGCTX_SLOT_INDEX(s)       ((s) & 0x7fffffff)
+#define MONO_RGCTX_SLOT_IS_MRGCTX(s)   (((s) & 0x80000000) ? TRUE : FALSE)
+
 typedef enum {
 #define PATCH_INFO(a,b) MONO_PATCH_INFO_ ## a,
 #include "patch-info.h"
@@ -1083,7 +1123,7 @@ struct MonoJumpInfoRgctxEntry {
        MonoMethod *method;
        gboolean in_mrgctx;
        MonoJumpInfo *data; /* describes the data to be loaded */
-       int info_type;
+       MonoRgctxInfoType info_type;
 };
 
 typedef enum {
@@ -1131,6 +1171,7 @@ enum {
 #define MONO_BBLOCK_IS_IN_REGION(bblock, regtype) (((bblock)->region & (0xf << 4)) == (regtype))
 
 #define MONO_REGION_FLAGS(region) ((region) & 0x7)
+#define MONO_REGION_CLAUSE_INDEX(region) (((region) >> 8) - 1)
 
 #define get_vreg_to_inst(cfg, vreg) ((vreg) < (cfg)->vreg_to_inst_len ? (cfg)->vreg_to_inst [(vreg)] : NULL)
 
@@ -1274,6 +1315,7 @@ typedef struct {
        guint            gen_seq_points : 1;
        guint            explicit_null_checks : 1;
        guint            compute_gc_maps : 1;
+       guint            soft_breakpoints : 1;
        gpointer         debug_info;
        guint32          lmf_offset;
     guint16          *intvars;
@@ -1388,6 +1430,17 @@ typedef struct {
         */
        guint8 *gc_map;
        guint32 gc_map_size;
+
+       /* Stats */
+       int stat_allocate_var;
+       int stat_locals_stack_size;
+       int stat_basic_blocks;
+       int stat_cil_code_size;
+       int stat_n_regvars;
+       int stat_inlineable_methods;
+       int stat_inlined_methods;
+       int stat_cas_demand_generation;
+       int stat_code_reallocs;
 } MonoCompile;
 
 typedef enum {
@@ -1403,30 +1456,30 @@ typedef enum {
 } MonoCompileFlags;
 
 typedef struct {
-       gulong methods_compiled;
-       gulong methods_aot;
-       gulong methods_lookups;
-       gulong allocate_var;
-       gulong cil_code_size;
-       gulong native_code_size;
-       gulong code_reallocs;
-       gulong max_code_size_ratio;
-       gulong biggest_method_size;
-       gulong allocated_code_size;
-       gulong inlineable_methods;
-       gulong inlined_methods;
-       gulong basic_blocks;
-       gulong max_basic_blocks;
-       gulong locals_stack_size;
-       gulong regvars;
-       gulong cas_declsec_check;
-       gulong cas_linkdemand_icall;
-       gulong cas_linkdemand_pinvoke;
-       gulong cas_linkdemand_aptc;
-       gulong cas_linkdemand;
-       gulong cas_demand_generation;
-       gulong generic_virtual_invocations;
-    int methods_with_llvm;
+       gint32 methods_compiled;
+       gint32 methods_aot;
+       gint32 methods_lookups;
+       gint32 allocate_var;
+       gint32 cil_code_size;
+       gint32 native_code_size;
+       gint32 code_reallocs;
+       gint32 max_code_size_ratio;
+       gint32 biggest_method_size;
+       gint32 allocated_code_size;
+       gint32 inlineable_methods;
+       gint32 inlined_methods;
+       gint32 basic_blocks;
+       gint32 max_basic_blocks;
+       gint32 locals_stack_size;
+       gint32 regvars;
+       gint32 cas_declsec_check;
+       gint32 cas_linkdemand_icall;
+       gint32 cas_linkdemand_pinvoke;
+       gint32 cas_linkdemand_aptc;
+       gint32 cas_linkdemand;
+       gint32 cas_demand_generation;
+       gint32 generic_virtual_invocations;
+       int methods_with_llvm;
        int methods_without_llvm;
        char *max_ratio_method;
        char *biggest_method;
@@ -1591,6 +1644,14 @@ typedef struct {
         * debugging of the stack marking code in the GC.
         */
        gboolean init_stacks;
+
+       /*
+        * Whenever to implement single stepping and breakpoints without signals in the
+        * soft debugger. This is useful on platforms without signals, like the ps3, or during
+        * runtime debugging, since it avoids SIGSEGVs when a single step location or breakpoint
+        * is hit.
+        */
+       gboolean soft_breakpoints;
 } MonoDebugOptions;
 
 enum {
@@ -1747,7 +1808,7 @@ MonoLMF * mono_get_lmf                      (void) MONO_INTERNAL;
 MonoLMF** mono_get_lmf_addr                 (void) MONO_INTERNAL;
 void      mono_set_lmf                      (MonoLMF *lmf) MONO_INTERNAL;
 void      mono_jit_thread_attach            (MonoDomain *domain);
-guint32   mono_get_jit_tls_key              (void) MONO_INTERNAL;
+MonoNativeTlsKey mono_get_jit_tls_key       (void) MONO_INTERNAL;
 gint32    mono_get_jit_tls_offset           (void) MONO_INTERNAL;
 gint32    mono_get_lmf_tls_offset           (void) MONO_INTERNAL;
 gint32    mono_get_lmf_addr_tls_offset      (void) MONO_INTERNAL;
@@ -1847,6 +1908,7 @@ void     mono_aot_set_make_unreadable       (gboolean unreadable) MONO_INTERNAL;
 gboolean mono_aot_is_pagefault              (void *ptr) MONO_INTERNAL;
 void     mono_aot_handle_pagefault          (void *ptr) MONO_INTERNAL;
 void     mono_aot_register_jit_icall        (const char *name, gpointer addr) MONO_INTERNAL;
+void*    mono_aot_readonly_field_override   (MonoClassField *field) MONO_INTERNAL;
 
 /* This is an exported function */
 void     mono_aot_register_globals          (gpointer *globals);
@@ -2026,8 +2088,6 @@ void      mono_arch_start_single_stepping       (void) MONO_INTERNAL;
 void      mono_arch_stop_single_stepping        (void) MONO_INTERNAL;
 gboolean  mono_arch_is_single_step_event        (void *info, void *sigctx) MONO_INTERNAL;
 gboolean  mono_arch_is_breakpoint_event         (void *info, void *sigctx) MONO_INTERNAL;
-guint8*   mono_arch_get_ip_for_single_step      (MonoJitInfo *ji, MonoContext *ctx) MONO_INTERNAL;
-guint8*   mono_arch_get_ip_for_breakpoint       (MonoJitInfo *ji, MonoContext *ctx) MONO_INTERNAL;
 void     mono_arch_skip_breakpoint              (MonoContext *ctx) MONO_INTERNAL;
 void     mono_arch_skip_single_step             (MonoContext *ctx) MONO_INTERNAL;
 gpointer mono_arch_get_seq_point_info           (MonoDomain *domain, guint8 *code) MONO_INTERNAL;
@@ -2047,14 +2107,15 @@ gpointer  mono_arch_get_throw_exception         (MonoTrampInfo **info, gboolean
 gpointer  mono_arch_get_rethrow_exception       (MonoTrampInfo **info, gboolean aot) MONO_INTERNAL;
 gpointer  mono_arch_get_throw_corlib_exception  (MonoTrampInfo **info, gboolean aot) MONO_INTERNAL;
 gpointer  mono_arch_get_throw_pending_exception (MonoTrampInfo **info, gboolean aot) MONO_INTERNAL;
-gboolean mono_arch_handle_exception             (void *sigctx, gpointer obj, gboolean test_only) MONO_INTERNAL;
+gboolean mono_arch_handle_exception             (void *sigctx, gpointer obj) MONO_INTERNAL;
 void     mono_arch_handle_altstack_exception    (void *sigctx, gpointer fault_addr, gboolean stack_ovf) MONO_INTERNAL;
 gboolean mono_handle_soft_stack_ovf             (MonoJitTlsData *jit_tls, MonoJitInfo *ji, void *ctx, guint8* fault_addr) MONO_INTERNAL;
 void     mono_handle_hard_stack_ovf             (MonoJitTlsData *jit_tls, MonoJitInfo *ji, void *ctx, guint8* fault_addr) MONO_INTERNAL;
 gpointer mono_arch_ip_from_context              (void *sigctx) MONO_INTERNAL;
 void     mono_arch_sigctx_to_monoctx            (void *sigctx, MonoContext *ctx) MONO_INTERNAL;
 void     mono_arch_monoctx_to_sigctx            (MonoContext *mctx, void *ctx) MONO_INTERNAL;
-gpointer mono_arch_context_get_int_reg         (MonoContext *ctx, int reg) MONO_INTERNAL;
+mgreg_t mono_arch_context_get_int_reg              (MonoContext *ctx, int reg) MONO_INTERNAL;
+void     mono_arch_context_set_int_reg             (MonoContext *ctx, int reg, mgreg_t val) MONO_INTERNAL;
 void     mono_arch_flush_register_windows       (void) MONO_INTERNAL;
 gboolean mono_arch_is_inst_imm                  (gint64 imm) MONO_INTERNAL;
 MonoInst* mono_arch_get_domain_intrinsic        (MonoCompile* cfg) MONO_INTERNAL;
@@ -2089,30 +2150,34 @@ GSList *mono_arch_get_trampolines               (gboolean aot) MONO_INTERNAL;
 gpointer mono_arch_install_handler_block_guard (MonoJitInfo *ji, MonoJitExceptionInfo *clause, MonoContext *ctx, gpointer new_value) MONO_INTERNAL;
 gpointer mono_arch_create_handler_block_trampoline (void) MONO_INTERNAL;
 gpointer mono_create_handler_block_trampoline (void) MONO_INTERNAL;
-gboolean mono_install_handler_block_guard (MonoInternalThread *thread, MonoContext *ctx) MONO_INTERNAL;
+gboolean mono_install_handler_block_guard (MonoThreadUnwindState *ctx) MONO_INTERNAL;
 
-/* Exception handling */
+/*New interruption machinery */
+void
+mono_setup_async_callback (MonoContext *ctx, void (*async_cb)(void *fun), gpointer user_data) MONO_INTERNAL;
 
-typedef enum {
-       MONO_UNWIND_NONE = 0x0,
-       MONO_UNWIND_LOOKUP_IL_OFFSET = 0x1,
-       MONO_UNWIND_LOOKUP_ACTUAL_METHOD = 0x2,
-       MONO_UNWIND_DEFAULT = MONO_UNWIND_LOOKUP_ACTUAL_METHOD,
-       MONO_UNWIND_SIGNAL_SAFE = MONO_UNWIND_NONE,
-       MONO_UNWIND_LOOKUP_ALL = MONO_UNWIND_LOOKUP_IL_OFFSET | MONO_UNWIND_LOOKUP_ACTUAL_METHOD,
-} MonoUnwindOptions;
+void
+mono_arch_setup_async_callback (MonoContext *ctx, void (*async_cb)(void *fun), gpointer user_data) MONO_INTERNAL;
+
+gboolean
+mono_thread_state_init_from_handle (MonoThreadUnwindState *tctx, MonoNativeThreadId thread_id, MonoNativeThreadHandle thread_handle) MONO_INTERNAL;
 
+
+/* Exception handling */
 typedef gboolean (*MonoJitStackWalk)            (StackFrameInfo *frame, MonoContext *ctx, gpointer data);
 
 void     mono_exceptions_init                   (void) MONO_INTERNAL;
-gboolean mono_handle_exception                  (MonoContext *ctx, gpointer obj,
-                                                gpointer original_ip, gboolean test_only) MONO_INTERNAL;
+gboolean mono_handle_exception                  (MonoContext *ctx, gpointer obj) MONO_INTERNAL;
 void     mono_handle_native_sigsegv             (int signal, void *sigctx) MONO_INTERNAL;
 void     mono_print_thread_dump                 (void *sigctx);
 void     mono_print_thread_dump_from_ctx        (MonoContext *ctx);
-void     mono_jit_walk_stack                    (MonoStackWalk func, gboolean do_il_offset, gpointer user_data) MONO_INTERNAL;
-void     mono_jit_walk_stack_from_ctx           (MonoStackWalk func, MonoContext *ctx, MonoUnwindOptions unwind_options, gpointer user_data) MONO_INTERNAL;
-void     mono_walk_stack                        (MonoJitStackWalk func, MonoDomain *domain, MonoContext *start_ctx, MonoUnwindOptions unwind_options, MonoInternalThread *thread, MonoLMF *lmf, gpointer user_data) MONO_INTERNAL;
+void     mono_walk_stack_with_ctx               (MonoJitStackWalk func, MonoContext *start_ctx, MonoUnwindOptions unwind_options, void *user_data) MONO_INTERNAL;
+void     mono_walk_stack_with_state             (MonoJitStackWalk func, MonoThreadUnwindState *state, MonoUnwindOptions unwind_options, void *user_data) MONO_INTERNAL;
+void     mono_walk_stack                        (MonoJitStackWalk func, MonoUnwindOptions options, void *user_data) MONO_INTERNAL;
+gboolean mono_thread_state_init_from_sigctx     (MonoThreadUnwindState *ctx, void *sigctx) MONO_INTERNAL;
+gboolean mono_thread_state_init_from_current    (MonoThreadUnwindState *ctx) MONO_INTERNAL;
+gboolean mono_thread_state_init_from_monoctx    (MonoThreadUnwindState *ctx, MonoContext *mctx) MONO_INTERNAL;
+
 void     mono_setup_altstack                    (MonoJitTlsData *tls) MONO_INTERNAL;
 void     mono_free_altstack                     (MonoJitTlsData *tls) MONO_INTERNAL;
 gpointer mono_altstack_restore_prot             (mgreg_t *regs, guint8 *code, gpointer *tramp_data, guint8* tramp) MONO_INTERNAL;
@@ -2237,7 +2302,7 @@ mono_class_rgctx_get_array_size (int n, gboolean mrgctx) MONO_INTERNAL;
 
 guint32
 mono_method_lookup_or_register_other_info (MonoMethod *method, gboolean in_mrgctx, gpointer data,
-       int info_type, MonoGenericContext *generic_context) MONO_INTERNAL;
+       MonoRgctxInfoType info_type, MonoGenericContext *generic_context) MONO_INTERNAL;
 
 MonoGenericContext
 mono_method_construct_object_context (MonoMethod *method) MONO_INTERNAL;
@@ -2383,7 +2448,7 @@ void mono_runtime_setup_stat_profiler (void) MONO_INTERNAL;
 void mono_runtime_shutdown_stat_profiler (void) MONO_INTERNAL;
 void mono_runtime_posix_install_handlers (void) MONO_INTERNAL;
 pid_t mono_runtime_syscall_fork (void) MONO_INTERNAL;
-gboolean mono_gdb_render_native_backtraces (void) MONO_INTERNAL;
+gboolean mono_gdb_render_native_backtraces (pid_t crashed_pid) MONO_INTERNAL;
 
 /*
  * Signal handling
@@ -2415,7 +2480,7 @@ gboolean mono_gdb_render_native_backtraces (void) MONO_INTERNAL;
 #define SIG_HANDLER_SIGNATURE(ftn) ftn (int _dummy, siginfo_t *info, void *context)
 #define SIG_HANDLER_PARAMS _dummy, info, context
 #elif defined(HOST_WIN32)
-#define SIG_HANDLER_SIGNATURE(ftn) ftn (int _dummy, EXCEPTION_RECORD *info, void *context)
+#define SIG_HANDLER_SIGNATURE(ftn) ftn (int _dummy, EXCEPTION_POINTERS *info, void *context)
 #define SIG_HANDLER_PARAMS _dummy, info, context
 #elif defined(__HAIKU__)
 #define SIG_HANDLER_SIGNATURE(ftn) ftn (int _dummy, void *userData, vregs regs)
@@ -2431,14 +2496,28 @@ void SIG_HANDLER_SIGNATURE (mono_sigsegv_signal_handler) MONO_INTERNAL;
 void SIG_HANDLER_SIGNATURE (mono_sigint_signal_handler)  MONO_INTERNAL;
 gboolean SIG_HANDLER_SIGNATURE (mono_chain_signal) MONO_INTERNAL;
 
-/* for MONO_WRAPPER_UNKNOWN/MANAGED_TO_MANAGED subtypes */
+/* Subtypes of some wrapper types */
 enum {
-       MONO_AOT_WRAPPER_MONO_ENTER,
-       MONO_AOT_WRAPPER_MONO_EXIT,
+       MONO_AOT_WRAPPER_MONITOR_ENTER,
+       MONO_AOT_WRAPPER_MONITOR_EXIT,
        MONO_AOT_WRAPPER_ELEMENT_ADDR,
        MONO_AOT_WRAPPER_PTR_TO_STRUCTURE,
        MONO_AOT_WRAPPER_STRUCTURE_TO_PTR,
        MONO_AOT_WRAPPER_CASTCLASS_WITH_CACHE,
+       MONO_AOT_WRAPPER_ISINST_WITH_CACHE,
+       MONO_AOT_WRAPPER_MONITOR_ENTER_V4,
+       MONO_AOT_WRAPPER_JIT_ICALL,
+       MONO_AOT_WRAPPER_RUNTIME_INVOKE_DYNAMIC,
+       MONO_AOT_WRAPPER_RUNTIME_INVOKE_DIRECT,
+       MONO_AOT_WRAPPER_RUNTIME_INVOKE_VIRTUAL,
+       /*
+        * We can't encode this wrapper directly, so we emit its name instead.
+        * This means that its not possible to decode this into a method, only to check
+        * that the method reference matches a given method. This is normally not a problem
+        * as these wrappers only occur in the extra_methods table, where we already have
+        * a method we want to lookup.
+        */
+       MONO_AOT_WRAPPER_BY_NAME,
        MONO_AOT_WRAPPER_LAST
 };