2010-06-15 Zoltan Varga <vargaz@gmail.com>
authorZoltan Varga <vargaz@gmail.com>
Tue, 15 Jun 2010 18:37:13 +0000 (18:37 -0000)
committerZoltan Varga <vargaz@gmail.com>
Tue, 15 Jun 2010 18:37:13 +0000 (18:37 -0000)
* tramp-x86.c (mono_arch_create_generic_trampoline): Emit unwind info for
these trampolines.

* mini-x86.c (mono_arch_get_cie_program): Implement this for x86.

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

mono/mini/ChangeLog
mono/mini/mini-x86.c
mono/mini/tramp-x86.c
mono/mini/unwind.c

index 0aed0e114e99355ca60172fda544b55b7fc72c78..305c5812269e809e41636f26c0ff567b2bd9a6f5 100755 (executable)
@@ -1,5 +1,10 @@
 2010-06-15  Zoltan Varga  <vargaz@gmail.com>
 
+       * tramp-x86.c (mono_arch_create_generic_trampoline): Emit unwind info for
+       these trampolines.
+
+       * mini-x86.c (mono_arch_get_cie_program): Implement this for x86.
+
        * mini-llvm.c: Fix compilation with llvm 2.6.
 
        * mini-amd64.c (CallInfo): Fix the position of the vret_arg_index field.
index 61a13b77b5c4629e3b9f2a7e84060abd04b24cf7..0c1372a3b17e771ae978c7a39866827a73073b84 100644 (file)
@@ -5292,6 +5292,17 @@ mono_arch_find_static_call_vtable (mgreg_t *regs, guint8 *code)
        return (MonoVTable*) regs [MONO_ARCH_RGCTX_REG];
 }
 
+GSList*
+mono_arch_get_cie_program (void)
+{
+       GSList *l = NULL;
+
+       mono_add_unwind_op_def_cfa (l, (guint8*)NULL, (guint8*)NULL, X86_ESP, 4);
+       mono_add_unwind_op_offset (l, (guint8*)NULL, (guint8*)NULL, X86_NREG, -4);
+
+       return l;
+}
+
 MonoInst*
 mono_arch_emit_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args)
 {
index ac088b379fb0121058346798bd725893fe1156ad..6d1d2d8257c2809b52e30626ad348c6a712f8f78 100644 (file)
@@ -230,6 +230,8 @@ mono_arch_create_generic_trampoline (MonoTrampolineType tramp_type, MonoTrampInf
        GSList *unwind_ops = NULL;
        MonoJumpInfo *ji = NULL;
 
+       unwind_ops = mono_arch_get_cie_program ();
+
        code = buf = mono_global_codeman_reserve (256);
 
        /* Note that there is a single argument to the trampoline
@@ -348,6 +350,8 @@ mono_arch_create_generic_trampoline (MonoTrampolineType tramp_type, MonoTrampInf
        x86_breakpoint (buf);*/
 #endif
 
+       mono_add_unwind_op_def_cfa (unwind_ops, code, buf, X86_ESP, ((pushed_args + 2) * 4));
+
        if (aot) {
                char *icall_name = g_strdup_printf ("trampoline_func_%d", tramp_type);
                code = mono_arch_emit_load_aotconst (buf, code, &ji, MONO_PATCH_INFO_JIT_ICALL_ADDR, icall_name);
index 2c0397b5c8672a1e29b18db9a614d1461d95f993..04d145b6c19f6be6cd50955519c526b398c01815 100644 (file)
@@ -961,7 +961,7 @@ mono_unwind_decode_fde (guint8 *fde, guint32 *out_len, guint32 *code_len, MonoJi
 GSList*
 mono_unwind_get_cie_program (void)
 {
-#ifdef TARGET_AMD64
+#if defined(TARGET_AMD64) || defined(TARGET_X86)
        return mono_arch_get_cie_program ();
 #elif defined(TARGET_POWERPC)
        GSList *l = NULL;