+2010-05-01 Zoltan Varga <vargaz@gmail.com>
+
+ * mini.h (MonoAotTrampInfo): Rename this to MonoTrampInfo, add patches/unwind
+ info fields.
+
+ * aot-compiler.c (mono_aot_tramp_info_create): Rename to mono_tramp_info_create,
+ add patches/unwind info arguments, move to mini.c.
+
+ * mini-<ARCH>.c aot-compiler.c: Update after the above changes.
+
2010-04-30 Zoltan Varga <vargaz@gmail.com>
* debugger-agent.c (type_commands): Add a new CMD_TYPE_GET_SOURCE_FILES_2
/* delegate_invoke_impl trampolines */
l = mono_arch_get_delegate_invoke_impls ();
while (l) {
- MonoAotTrampInfo *info = l->data;
+ MonoTrampInfo *info = l->data;
emit_trampoline (acfg, info->name, info->code, info->code_size, acfg->got_offset, NULL, NULL);
l = l->next;
return m;
}
-/*
- * mono_aot_tramp_info_create:
- *
- * Create a MonoAotTrampInfo structure from the arguments.
- */
-MonoAotTrampInfo*
-mono_aot_tramp_info_create (const char *name, guint8 *code, guint32 code_size)
-{
- MonoAotTrampInfo *info = g_new0 (MonoAotTrampInfo, 1);
-
- info->name = (char*)name;
- info->code = code;
- info->code_size = code_size;
-
- return info;
-}
-
#if !defined(DISABLE_AOT) && !defined(DISABLE_JIT)
typedef struct HashEntry {
/*
* mono_arch_get_delegate_invoke_impls:
*
- * Return a list of MonoAotTrampInfo structures for the delegate invoke impl
+ * Return a list of MonoTrampInfo structures for the delegate invoke impl
* trampolines.
*/
GSList*
int i;
code = get_delegate_invoke_impl (TRUE, 0, &code_len);
- res = g_slist_prepend (res, mono_aot_tramp_info_create (g_strdup ("delegate_invoke_impl_has_target"), code, code_len));
+ res = g_slist_prepend (res, mono_tramp_info_create (g_strdup ("delegate_invoke_impl_has_target"), code, code_len, NULL, NULL));
for (i = 0; i < MAX_ARCH_DELEGATE_PARAMS; ++i) {
code = get_delegate_invoke_impl (FALSE, i, &code_len);
- res = g_slist_prepend (res, mono_aot_tramp_info_create (g_strdup_printf ("delegate_invoke_impl_target_%d", i), code, code_len));
+ res = g_slist_prepend (res, mono_tramp_info_create (g_strdup_printf ("delegate_invoke_impl_target_%d", i), code, code_len, NULL, NULL));
}
return res;
int i;
code = get_delegate_invoke_impl (TRUE, 0, &code_len);
- res = g_slist_prepend (res, mono_aot_tramp_info_create (g_strdup ("delegate_invoke_impl_has_target"), code, code_len));
+ res = g_slist_prepend (res, mono_tramp_info_create (g_strdup ("delegate_invoke_impl_has_target"), code, code_len, NULL, NULL));
for (i = 0; i <= MAX_ARCH_DELEGATE_PARAMS; ++i) {
code = get_delegate_invoke_impl (FALSE, i, &code_len);
- res = g_slist_prepend (res, mono_aot_tramp_info_create (g_strdup_printf ("delegate_invoke_impl_target_%d", i), code, code_len));
+ res = g_slist_prepend (res, mono_tramp_info_create (g_strdup_printf ("delegate_invoke_impl_target_%d", i), code, code_len, NULL, NULL));
}
return res;
int i;
code = get_delegate_invoke_impl (TRUE, 0, &code_len, TRUE);
- res = g_slist_prepend (res, mono_aot_tramp_info_create (g_strdup ("delegate_invoke_impl_has_target"), code, code_len));
+ res = g_slist_prepend (res, mono_tramp_info_create (g_strdup ("delegate_invoke_impl_has_target"), code, code_len, NULL, NULL));
for (i = 0; i < MAX_ARCH_DELEGATE_PARAMS; ++i) {
code = get_delegate_invoke_impl (FALSE, i, &code_len, TRUE);
- res = g_slist_prepend (res, mono_aot_tramp_info_create (g_strdup_printf ("delegate_invoke_impl_target_%d", i), code, code_len));
+ res = g_slist_prepend (res, mono_tramp_info_create (g_strdup_printf ("delegate_invoke_impl_target_%d", i), code, code_len, NULL, NULL));
}
return res;
int i;
code = get_delegate_invoke_impl (TRUE, 0, &code_len);
- res = g_slist_prepend (res, mono_aot_tramp_info_create (g_strdup ("delegate_invoke_impl_has_target"), code, code_len));
+ res = g_slist_prepend (res, mono_tramp_info_create (g_strdup ("delegate_invoke_impl_has_target"), code, code_len, NULL, NULL));
for (i = 0; i < MAX_ARCH_DELEGATE_PARAMS; ++i) {
code = get_delegate_invoke_impl (FALSE, i, &code_len);
- res = g_slist_prepend (res, mono_aot_tramp_info_create (g_strdup_printf ("delegate_invoke_impl_target_%d", i), code, code_len));
+ res = g_slist_prepend (res, mono_tramp_info_create (g_strdup_printf ("delegate_invoke_impl_target_%d", i), code, code_len, NULL, NULL));
}
return res;
{
return mono_jump_info_token_new2 (mp, image, token, NULL);
}
+
+/*
+ * mono_tramp_info_create:
+ *
+ * Create a MonoTrampInfo structure from the arguments. This function assumes ownership
+ * of NAME, JI, and UNWIND_OPS.
+ */
+MonoTrampInfo*
+mono_tramp_info_create (const char *name, guint8 *code, guint32 code_size, MonoJumpInfo *ji, GSList *unwind_ops)
+{
+ MonoTrampInfo *info = g_new0 (MonoTrampInfo, 1);
+
+ info->name = (char*)name;
+ info->code = code;
+ info->code_size = code_size;
+ info->ji = ji;
+ info->unwind_ops = unwind_ops;
+
+ return info;
+}
+
+void
+mono_tramp_info_free (MonoTrampInfo *info)
+{
+ g_free (info->name);
+
+ // FIXME: ji + unwind_ops
+}
#define MONO_INIT_VARINFO(vi,id) do { \
(vi)->range.first_use.pos.bid = 0xffff; \
MINI_TOKEN_SOURCE_FIELD
};
-/*
- * This structures contains information about a trampoline function required by
- * the AOT compiler in full-aot mode.
- */
-typedef struct
-{
- guint8 *code;
- guint32 code_size;
- char *name;
-} MonoAotTrampInfo;
+ /*
+ * Information about a trampoline function.
+ */
+ typedef struct
+ {
+ /*
+ * The native code of the trampoline. Not owned by this structure.
+ */
+ guint8 *code;
+ guint32 code_size;
+ /*
+ * The name of the trampoline which can be used in AOT/xdebug. Owned by this
+ * structure.
+ */
+ char *name;
+ /*
+ * Patches required by the trampoline when aot-ing. Owned by this structure.
+ */
+ MonoJumpInfo *ji;
+ /*
+ * Unwind information. Owned by this structure.
+ */
+ GSList *unwind_ops;
+} MonoTrampInfo;
typedef void (*MonoInstFunc) (MonoInst *tree, gpointer data);
guint8* mono_aot_get_unwind_info (MonoJitInfo *ji, guint32 *unwind_info_len) MONO_INTERNAL;
guint32 mono_aot_method_hash (MonoMethod *method) MONO_INTERNAL;
char* mono_aot_wrapper_name (MonoMethod *method) MONO_INTERNAL;
-MonoAotTrampInfo* mono_aot_tramp_info_create (const char *name, guint8 *code, guint32 code_len) MONO_INTERNAL;
MonoMethod* mono_aot_get_array_helper_from_wrapper (MonoMethod *method) MONO_INTERNAL;
guint32 mono_aot_get_got_offset (MonoJumpInfo *ji) MONO_INTERNAL;
char* mono_aot_get_method_name (MonoCompile *cfg) MONO_INTERNAL;
void mono_emit_unwind_op (MonoCompile *cfg, int when,
int tag, int reg,
int val) MONO_INTERNAL;
+MonoTrampInfo* mono_tramp_info_create (const char *name, guint8 *code, guint32 code_size, MonoJumpInfo *ji, GSList *unwind_ops) MONO_INTERNAL;
+void mono_tramp_info_free (MonoTrampInfo *info) MONO_INTERNAL;
int mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_bblock, MonoBasicBlock *end_bblock,
MonoInst *return_var, GList *dont_inline, MonoInst **inline_args,