2010-05-01 Zoltan Varga <vargaz@gmail.com>
authorZoltan Varga <vargaz@gmail.com>
Fri, 30 Apr 2010 22:53:06 +0000 (22:53 -0000)
committerZoltan Varga <vargaz@gmail.com>
Fri, 30 Apr 2010 22:53:06 +0000 (22:53 -0000)
* 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.

svn path=/trunk/mono/; revision=156553

mono/mini/ChangeLog
mono/mini/aot-compiler.c
mono/mini/mini-amd64.c
mono/mini/mini-arm.c
mono/mini/mini-ppc.c
mono/mini/mini-x86.c
mono/mini/mini.c
mono/mini/mini.h

index 6a9a5529116291b099b8c53136248f97af31441a..5e811cc28bbf1f36b4c735c5f879373b94cf0f7b 100755 (executable)
@@ -1,3 +1,13 @@
+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
index 1d156ce8d388f606230a38df93f45750c9ca70e0..bc8ba55d505b71e536fe2e6ee88cb68a4ec7bbbd 100644 (file)
@@ -3851,7 +3851,7 @@ emit_trampolines (MonoAotCompile *acfg)
                        /* 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;
@@ -4975,23 +4975,6 @@ mono_aot_get_array_helper_from_wrapper (MonoMethod *method)
        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 {
index e331e9300251adbcb3e1f6df6e59e119cc339f01..883144c8dce47b406d108de8fdff1edf3c5dc653 100644 (file)
@@ -7068,7 +7068,7 @@ get_delegate_invoke_impl (gboolean has_target, guint32 param_count, guint32 *cod
 /*
  * 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*
@@ -7080,11 +7080,11 @@ mono_arch_get_delegate_invoke_impls (void)
        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;
index 0a72637f062ad53b5efd0e90572c5925241fab7c..4cfcfc70e2c442a7cd17b123f9bbd8c118543c75 100644 (file)
@@ -442,11 +442,11 @@ mono_arch_get_delegate_invoke_impls (void)
        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;
index 6c962bab95f38d31e8e65deb1a67816919d2108a..068c527458a50696dde48e19cb16e1f1cde8e315 100755 (executable)
@@ -488,11 +488,11 @@ mono_arch_get_delegate_invoke_impls (void)
        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;
index e0d784861f9d6e4bb1d8c572ac8bbc8c8409a971..6856ee3d9d928af24de3073aaeb7b799f68d6cd6 100644 (file)
@@ -5627,11 +5627,11 @@ mono_arch_get_delegate_invoke_impls (void)
        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;
index b48440161ea60fb40f18cf89736341e7ba0294df..397fcf0f0dae3d0627991e6fe75fb61a519962b9 100644 (file)
@@ -401,6 +401,34 @@ mono_jump_info_token_new (MonoMemPool *mp, MonoImage *image, guint32 token)
 {
        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; \
index 5d9c7658998c6b32fbdace3cfe338e28e1ac7f3e..e2ec3050f1a74fd3bb9a3c42c0d396f3ac2fa03c 100644 (file)
@@ -1396,16 +1396,30 @@ enum {
        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);
 
@@ -1550,7 +1564,6 @@ gpointer mono_aot_get_imt_thunk             (MonoVTable *vtable, MonoDomain *dom
 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;
@@ -1654,6 +1667,8 @@ MonoUnwindOp     *mono_create_unwind_op (int when,
 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,