Thu Jan 10 19:36:27 CET 2002 Paolo Molaro <lupus@ximian.com>
[mono.git] / mono / interpreter / interp.h
1
2 #include <glib.h>
3 #include <mono/metadata/loader.h>
4 #include <mono/metadata/object.h>
5
6 enum {
7         VAL_I32     = 0,
8         VAL_DOUBLE  = 1,
9         VAL_I64     = 2,
10         VAL_VALUET  = 3,
11         VAL_POINTER = 4,
12         VAL_NATI    = 0 + VAL_POINTER,
13         VAL_MP      = 1 + VAL_POINTER,
14         VAL_TP      = 2 + VAL_POINTER,
15         VAL_OBJ     = 3 + VAL_POINTER,
16         VAL_VALUETA = 8
17 };
18
19 #if SIZEOF_VOID_P == 4
20 typedef guint32 mono_u;
21 typedef gint32  mono_i;
22 #elif SIZEOF_VOID_P == 8
23 typedef guint64 mono_u;
24 typedef gint64  mono_i;
25 #endif
26
27 /*
28  * Value types are represented on the eval stack as pointers to the
29  * actual storage. The size field tells how much storage is allocated.
30  * A value type can't be larger than 16 MB.
31  */
32 typedef struct {
33         union {
34                 gint32 i;
35                 gint64 l;
36                 double f;
37                 /* native size integer and pointer types */
38                 gpointer p;
39                 mono_u nati;
40                 struct {
41                         gpointer vt;
42                         MonoClass *klass;
43                 } vt;
44         } data;
45         unsigned int type;
46 } stackval;
47
48 typedef struct _MonoInvocation MonoInvocation;
49
50 struct _MonoInvocation {
51         MonoInvocation *parent; /* parent */
52         MonoInvocation *child;
53         MonoMethod     *method; /* parent */
54         stackval       *retval; /* parent */
55         void           *obj;    /* this - parent */
56         char           *locals;
57         char           *args;
58         stackval       *stack_args; /* parent */
59         stackval       *stack;
60         /* exception info */
61         const unsigned char  *ip;
62         MonoException     *ex;
63         MonoExceptionClause *ex_handler;
64 };
65
66 void mono_init_icall (void);
67
68 void inline stackval_from_data (MonoType *type, stackval *result, const char *data);
69 void ves_exec_method (MonoInvocation *frame);
70
71 typedef void (*MonoFunc) ();
72 typedef void (*MonoPIFunc) (MonoFunc callme, void *retval, void *obj_this, stackval *arguments);
73
74 /*
75  * defined in an arch specific file.
76  */
77 MonoPIFunc mono_create_trampoline (MonoMethod *method, int runtime);
78 void *mono_create_method_pointer (MonoMethod *method);