Fix some compiler warning that SUSE takes seriously.
[mono-project/dkf.git] / mono / interpreter / interp.h
blob0953e5a54cfb93f1448dd9a80a815952469127bb
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 _RuntimeMethod
60 /* NOTE: These first two elements (method and
61 next_jit_code_hash) must be in the same order and at the
62 same offset as in MonoJitInfo, because of the jit_code_hash
63 internal hash table in MonoDomain. */
64 MonoMethod *method;
65 struct _RuntimeMethod *next_jit_code_hash;
66 guint32 locals_size;
67 guint32 args_size;
68 guint32 stack_size;
69 guint32 vt_stack_size;
70 guint32 alloca_size;
71 unsigned short *code;
72 unsigned short *new_body_start; /* after all STINARG instrs */
73 MonoPIFunc func;
74 int num_clauses;
75 MonoExceptionClause *clauses;
76 void **data_items;
77 int transformed;
78 guint32 *arg_offsets;
79 guint32 *local_offsets;
80 unsigned int param_count;
81 unsigned int hasthis;
82 unsigned int valuetype;
83 } RuntimeMethod;
85 struct _MonoInvocation {
86 MonoInvocation *parent; /* parent */
87 RuntimeMethod *runtime_method; /* parent */
88 MonoMethod *method; /* parent */
89 stackval *retval; /* parent */
90 void *obj; /* this - parent */
91 char *args;
92 stackval *stack_args; /* parent */
93 stackval *stack;
94 stackval *sp; /* For GC stack marking */
95 /* exception info */
96 unsigned char invoke_trap;
97 const unsigned short *ip;
98 MonoException *ex;
99 MonoExceptionClause *ex_handler;
102 typedef struct {
103 MonoDomain *domain;
104 MonoInvocation *base_frame;
105 MonoInvocation *current_frame;
106 MonoInvocation *env_frame;
107 jmp_buf *current_env;
108 unsigned char search_for_handler;
109 unsigned char managed_code;
110 } ThreadContext;
112 void mono_init_icall (void);
114 MonoException *
115 mono_interp_transform_method (RuntimeMethod *runtime_method, ThreadContext *context);
117 MonoDelegate*
118 mono_interp_ftnptr_to_delegate (MonoClass *klass, gpointer ftn);
120 void
121 mono_interp_transform_init (void);
123 void inline stackval_from_data (MonoType *type, stackval *result, char *data, gboolean pinvoke);
124 void inline stackval_to_data (MonoType *type, stackval *val, char *data, gboolean pinvoke);
125 void ves_exec_method (MonoInvocation *frame);
128 * defined in an arch specific file.
130 MonoPIFunc
131 mono_arch_create_trampoline (MonoMethodSignature *sig, gboolean string_ctor);
133 RuntimeMethod *
134 mono_interp_get_runtime_method (MonoMethod *method);
136 void *mono_arch_create_method_pointer (MonoMethod *method);
138 extern int mono_interp_traceopt;