In Test/System.Windows.Forms:
[mono-project.git] / mono / interpreter / interp.h
blob18cc9f245d9447326ab1d1e0b6e70b7223b840c9
1 #include <setjmp.h>
2 #include <glib.h>
3 #include <mono/metadata/loader.h>
4 #include <mono/metadata/object.h>
5 #include <mono/metadata/domain-internals.h>
6 #include <mono/metadata/class-internals.h>
7 #include "config.h"
9 enum {
10 VAL_I32 = 0,
11 VAL_DOUBLE = 1,
12 VAL_I64 = 2,
13 VAL_VALUET = 3,
14 VAL_POINTER = 4,
15 VAL_NATI = 0 + VAL_POINTER,
16 VAL_MP = 1 + VAL_POINTER,
17 VAL_TP = 2 + VAL_POINTER,
18 VAL_OBJ = 3 + VAL_POINTER
21 #if SIZEOF_VOID_P == 4
22 typedef guint32 mono_u;
23 typedef gint32 mono_i;
24 #elif SIZEOF_VOID_P == 8
25 typedef guint64 mono_u;
26 typedef gint64 mono_i;
27 #endif
30 * Value types are represented on the eval stack as pointers to the
31 * actual storage. The size field tells how much storage is allocated.
32 * A value type can't be larger than 16 MB.
34 typedef struct {
35 union {
36 gint32 i;
37 gint64 l;
38 double f;
39 /* native size integer and pointer types */
40 gpointer p;
41 mono_u nati;
42 gpointer vt;
43 } data;
44 #if defined(__ppc__) || defined(__powerpc__)
45 int pad;
46 #endif
47 } stackval;
49 typedef struct _MonoInvocation MonoInvocation;
51 typedef void (*MonoFunc) (void);
52 typedef void (*MonoPIFunc) (MonoFunc callme, void *retval, void *obj_this, stackval *arguments);
54 /*
55 * Structure representing a method transformed for the interpreter
56 * This is domain specific
58 typedef struct
60 guint32 locals_size;
61 guint32 args_size;
62 guint32 stack_size;
63 guint32 vt_stack_size;
64 guint32 alloca_size;
65 unsigned short *code;
66 unsigned short *new_body_start; /* after all STINARG instrs */
67 MonoMethod *method;
68 MonoPIFunc func;
69 int num_clauses;
70 MonoExceptionClause *clauses;
71 void **data_items;
72 int transformed;
73 guint32 *arg_offsets;
74 guint32 *local_offsets;
75 unsigned int param_count;
76 unsigned int hasthis;
77 unsigned int valuetype;
78 } RuntimeMethod;
80 struct _MonoInvocation {
81 MonoInvocation *parent; /* parent */
82 RuntimeMethod *runtime_method; /* parent */
83 MonoMethod *method; /* parent */
84 stackval *retval; /* parent */
85 void *obj; /* this - parent */
86 char *args;
87 stackval *stack_args; /* parent */
88 stackval *stack;
89 stackval *sp; /* For GC stack marking */
90 /* exception info */
91 unsigned char invoke_trap;
92 const unsigned short *ip;
93 MonoException *ex;
94 MonoExceptionClause *ex_handler;
97 typedef struct {
98 MonoDomain *domain;
99 MonoInvocation *base_frame;
100 MonoInvocation *current_frame;
101 MonoInvocation *env_frame;
102 jmp_buf *current_env;
103 unsigned char search_for_handler;
104 unsigned char managed_code;
105 } ThreadContext;
107 void mono_init_icall (void);
109 MonoException *
110 mono_interp_transform_method (RuntimeMethod *runtime_method, ThreadContext *context);
112 MonoDelegate*
113 mono_interp_ftnptr_to_delegate (MonoClass *klass, gpointer ftn);
115 void
116 mono_interp_transform_init (void);
118 void inline stackval_from_data (MonoType *type, stackval *result, char *data, gboolean pinvoke);
119 void inline stackval_to_data (MonoType *type, stackval *val, char *data, gboolean pinvoke);
120 void ves_exec_method (MonoInvocation *frame);
123 * defined in an arch specific file.
125 MonoPIFunc
126 mono_arch_create_trampoline (MonoMethodSignature *sig, gboolean string_ctor);
128 RuntimeMethod *
129 mono_interp_get_runtime_method (MonoMethod *method);
131 void *mono_arch_create_method_pointer (MonoMethod *method);
133 extern int mono_interp_traceopt;