* Exception.cs: Cosmetic change to default exception message on
[mono.git] / mono / mini / mini.h
index de594bd19f90b8444e895e0b55bea57c5cd419cb..3eb5926b0adca037a428ccbb8885f63b30db2ddf 100644 (file)
 #include "mono/metadata/class-internals.h"
 #include "mono/metadata/object-internals.h"
 #include <mono/metadata/profiler-private.h>
+#include <mono/metadata/debug-helpers.h>
 #include <mono/utils/mono-compiler.h>
 
+#define MONO_BREAKPOINT_ARRAY_SIZE 64
+
 #include "mini-arch.h"
 #include "regalloc.h"
 #include "declsec.h"
@@ -49,6 +52,9 @@
 #define inst_ls_word data.op[MINI_LS_WORD_IDX].const_val
 #define inst_ms_word data.op[MINI_MS_WORD_IDX].const_val
 
+#define MONO_FAKE_IMT_METHOD ((MonoMethod*)GINT_TO_POINTER(-1))
+#define MONO_FAKE_VTABLE_METHOD ((MonoMethod*)GINT_TO_POINTER(-2))
+
 /* Version number of the AOT file format */
 #define MONO_AOT_FILE_VERSION "32"
 
@@ -130,6 +136,8 @@ extern int mono_exc_esp_offset;
 #else
 extern gboolean mono_compile_aot;
 #endif
+extern MonoMethodDesc *mono_inject_async_exc_method;
+extern int mono_inject_async_exc_pos;
 
 struct MonoEdge {
        MonoEdge *next;
@@ -527,6 +535,14 @@ enum {
 
 #define MONO_BBLOCK_IS_IN_REGION(bblock, regtype) (((bblock)->region & (0xf << 4)) == (regtype))
 
+/*
+ * Will contain information on the generic type arguments in the
+ * future.  For now, all arguments are always reference types.
+ */
+typedef struct {
+       int dummy;
+} MonoGenericSharingContext;
+
 /*
  * Control Flow Graph and compilation unit information
  */
@@ -579,6 +595,8 @@ typedef struct {
        
        MonoDomain      *domain;
 
+       MonoGenericSharingContext *generic_sharing_context;
+
        unsigned char   *cil_start;
        unsigned char   *native_code;
        guint            code_size;
@@ -825,6 +843,16 @@ enum {
        MONO_EXC_INTRINS_NUM
 };
 
+/*
+ * Flags for which contexts were used in inflating a generic.
+ */
+enum {
+       MONO_GENERIC_CONTEXT_USED_CLASS = 1,
+       MONO_GENERIC_CONTEXT_USED_METHOD = 2
+};
+
+#define MONO_GENERIC_CONTEXT_USED_BOTH         (MONO_GENERIC_CONTEXT_USED_CLASS | MONO_GENERIC_CONTEXT_USED_METHOD)
+
 typedef void (*MonoInstFunc) (MonoInst *tree, gpointer data);
 
 /* main function */
@@ -944,6 +972,8 @@ CompRelation      mono_opcode_to_cond (int opcode) MONO_INTERNAL;
 CompType          mono_opcode_to_type (int opcode, int cmp_opcode) MONO_INTERNAL;
 
 /* methods that must be provided by the arch-specific port */
+void      mono_arch_init                        (void) MONO_INTERNAL;
+void      mono_arch_cleanup                     (void) MONO_INTERNAL;
 void      mono_arch_cpu_init                    (void) MONO_INTERNAL;
 guint32   mono_arch_cpu_optimizazions           (guint32 *exclude_mask) MONO_INTERNAL;
 void      mono_arch_instrument_mem_needs        (MonoMethod *method, int *stack, int *code) MONO_INTERNAL;
@@ -1006,6 +1036,7 @@ gboolean mono_arch_is_int_overflow              (void *sigctx, void *info) MONO_
 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;
 void     mono_arch_save_unwind_info             (MonoCompile *cfg) MONO_INTERNAL;
@@ -1071,6 +1102,10 @@ void      mono_debug_add_icall_wrapper          (MonoMethod *method, MonoJitICal
 void      mono_debug_print_vars                 (gpointer ip, gboolean only_arguments);
 void      mono_debugger_run_finally             (MonoContext *start_ctx);
 
+extern gssize mono_breakpoint_info_index [MONO_BREAKPOINT_ARRAY_SIZE];
+
+gboolean mono_breakpoint_clean_code (guint8 *code, guint8 *buf, int size);
+
 /* Mono Debugger support */
 void      mono_debugger_init                    (void);
 int       mono_debugger_main                    (MonoDomain *domain, MonoAssembly *assembly, int argc, char **argv);
@@ -1096,4 +1131,18 @@ int mini_wapi_hps     (int argc, char **argv);
 int mini_wapi_semdel  (int argc, char **argv);
 int mini_wapi_seminfo (int argc, char **argv);
 
+/* Generic sharing */
+
+int mono_method_check_context_used (MonoMethod *method, MonoGenericContext *context) MONO_INTERNAL;
+int mono_class_check_context_used (MonoClass *class, MonoGenericContext *context) MONO_INTERNAL;
+
+gboolean mono_method_is_generic_impl (MonoMethod *method) MONO_INTERNAL;
+gboolean mono_method_is_generic_sharable_impl (MonoMethod *method) MONO_INTERNAL;
+
+MonoGenericContext* mono_make_shared_context (MonoCompile *cfg, MonoGenericContext *context) MONO_INTERNAL;
+
+MonoType* mini_get_basic_type_from_generic (MonoGenericSharingContext *gsctx, MonoType *type) MONO_INTERNAL;
+
+int mini_type_stack_size (MonoGenericSharingContext *gsctx, MonoType *t, int *align) MONO_INTERNAL;
+
 #endif /* __MONO_MINI_H__ */