1 #ifndef __MONO_MINI_INTERPRETER_INTERNALS_H__
2 #define __MONO_MINI_INTERPRETER_INTERNALS_H__
6 #include <mono/metadata/loader.h>
7 #include <mono/metadata/object.h>
8 #include <mono/metadata/domain-internals.h>
9 #include <mono/metadata/class-internals.h>
10 #include <mono/metadata/debug-internals.h>
13 #define MINT_TYPE_I1 0
14 #define MINT_TYPE_U1 1
15 #define MINT_TYPE_I2 2
16 #define MINT_TYPE_U2 3
17 #define MINT_TYPE_I4 4
18 #define MINT_TYPE_I8 5
19 #define MINT_TYPE_R4 6
20 #define MINT_TYPE_R8 7
23 #define MINT_TYPE_VT 10
25 #define BOX_NOT_CLEAR_VT_SP 0x4000
27 #define MINT_VT_ALIGNMENT 8
35 VAL_NATI
= 0 + VAL_POINTER
,
36 VAL_MP
= 1 + VAL_POINTER
,
37 VAL_TP
= 2 + VAL_POINTER
,
38 VAL_OBJ
= 3 + VAL_POINTER
45 #if SIZEOF_VOID_P == 4
46 typedef guint32 mono_u
;
47 typedef gint32 mono_i
;
48 #elif SIZEOF_VOID_P == 8
49 typedef guint64 mono_u
;
50 typedef gint64 mono_i
;
54 * Value types are represented on the eval stack as pointers to the
55 * actual storage. The size field tells how much storage is allocated.
56 * A value type can't be larger than 16 MB.
69 MonoObject
* volatile o
;
73 /* native size integer and pointer types */
78 #if defined(__ppc__) || defined(__powerpc__)
83 typedef struct _InterpFrame InterpFrame
;
85 typedef void (*MonoFuncV
) (void);
86 typedef void (*MonoPIFunc
) (void *callme
, void *margs
);
89 * Structure representing a method transformed for the interpreter
90 * This is domain specific
92 typedef struct _InterpMethod
94 /* NOTE: These first two elements (method and
95 next_jit_code_hash) must be in the same order and at the
96 same offset as in MonoJitInfo, because of the jit_code_hash
97 internal hash table in MonoDomain. */
99 struct _InterpMethod
*next_jit_code_hash
;
101 guint32 total_locals_size
;
103 guint32 vt_stack_size
;
105 unsigned int init_locals
: 1;
106 unsigned int vararg
: 1;
107 unsigned int needs_thread_attach
: 1;
108 unsigned short *code
;
111 MonoExceptionClause
*clauses
;
114 guint32
*local_offsets
;
115 guint32
*exvar_offsets
;
116 unsigned int param_count
;
117 unsigned int hasthis
;
118 gpointer jit_wrapper
;
120 MonoMethodSignature
*jit_sig
;
122 gpointer llvmonly_unbox_entry
;
124 MonoType
**param_types
;
127 MonoProfilerCallInstrumentationFlags prof_flags
;
130 struct _InterpFrame
{
131 InterpFrame
*parent
; /* parent */
132 InterpMethod
*imethod
; /* parent */
133 stackval
*retval
; /* parent */
134 stackval
*stack_args
; /* parent */
137 * For GC tracking of local objrefs in exec_method ().
138 * Storing into this field will keep the object pinned
139 * until the objref can be stored into stackval->data.o.
142 MonoObject
* volatile o
;
145 const unsigned short *ip
;
149 #define frame_locals(frame) (((guchar*)((frame)->stack)) + (frame)->imethod->stack_size + (frame)->imethod->vt_stack_size)
152 /* Resume state for resuming execution in mixed mode */
153 gboolean has_resume_state
;
154 /* Frame to resume execution at */
155 InterpFrame
*handler_frame
;
156 /* IP to resume execution at */
157 const guint16
*handler_ip
;
158 /* Clause that we are resuming to */
159 MonoJitExceptionInfo
*handler_ei
;
163 gint64 transform_time
;
164 gint32 inlined_methods
;
165 gint32 inline_failures
;
168 extern MonoInterpStats mono_interp_stats
;
170 extern int mono_interp_traceopt
;
171 extern int mono_interp_opt
;
172 extern GSList
*mono_interp_jit_classes
;
175 mono_interp_transform_method (InterpMethod
*imethod
, ThreadContext
*context
, MonoError
*error
);
178 mono_interp_transform_init (void);
181 mono_interp_get_imethod (MonoDomain
*domain
, MonoMethod
*method
, MonoError
*error
);
184 mono_interp_print_code (InterpMethod
*imethod
);
187 mint_type(MonoType
*type_
)
189 MonoType
*type
= mini_native_type_replace_type (type_
);
193 switch (type
->type
) {
197 case MONO_TYPE_BOOLEAN
:
209 #if SIZEOF_VOID_P == 4
223 case MONO_TYPE_STRING
:
224 case MONO_TYPE_SZARRAY
:
225 case MONO_TYPE_CLASS
:
226 case MONO_TYPE_OBJECT
:
227 case MONO_TYPE_ARRAY
:
229 case MONO_TYPE_VALUETYPE
:
230 if (m_class_is_enumtype (type
->data
.klass
)) {
231 type
= mono_class_enum_basetype_internal (type
->data
.klass
);
235 case MONO_TYPE_TYPEDBYREF
:
237 case MONO_TYPE_GENERICINST
:
238 type
= m_class_get_byval_arg (type
->data
.generic_class
->container_class
);
241 g_warning ("got type 0x%02x", type
->type
);
242 g_assert_not_reached ();
247 #endif /* __MONO_MINI_INTERPRETER_INTERNALS_H__ */