[jit] Allocate the thunks area next to the method code if the backend can compute...
[mono.git] / mono / mini / unwind.c
index 2aa24d40eb9bc0dd8707282925cecf7f5ed2a2f6..17bf3ad8962d35d90c07c8602049fe59a2b73a9b 100644 (file)
@@ -68,16 +68,11 @@ static int map_hw_reg_to_dwarf_reg [] = {
        72, 73, 74, 75, 76, 77, 78, 79,
 };
 #elif defined (TARGET_X86)
-#ifdef __APPLE__
 /*
- * LLVM seems to generate unwind info where esp is encoded as 5, and ebp as 4, ie see this line:
- *   def ESP : RegisterWithSubRegs<"esp", [SP]>, DwarfRegNum<[-2, 5, 4]>;
- * in lib/Target/X86/X86RegisterInfo.td in the llvm sources.
+ * ebp and esp are swapped:
+ * http://lists.cs.uiuc.edu/pipermail/lldb-dev/2014-January/003101.html
  */
 static int map_hw_reg_to_dwarf_reg [] = { 0, 1, 2, 3, 5, 4, 6, 7, 8 };
-#else
-static int map_hw_reg_to_dwarf_reg [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
-#endif
 /* + 1 is for IP */
 #define NUM_REGS X86_NREG + 1
 #define DWARF_DATA_ALIGN (-4)
@@ -925,6 +920,8 @@ mono_unwind_decode_fde (guint8 *fde, guint32 *out_len, guint32 *code_len, MonoJi
         * http://refspecs.freestandards.org/LSB_3.0.0/LSB-Core-generic/LSB-Core-generic/ehframechpt.html
         */
 
+       /* This is generated by JITDwarfEmitter::EmitEHFrame () */
+
        *type_info = NULL;
        *this_reg = -1;
        *this_offset = -1;
@@ -1092,7 +1089,7 @@ mono_unwind_decode_llvm_mono_fde (guint8 *fde, int fde_len, guint8 *cie, guint8
        res->this_reg = -1;
        res->this_offset = -1;
 
-       /* fde points to data emitted by LLVM in DwarfException::EmitMonoEHFrame () */
+       /* fde points to data emitted by LLVM in DwarfMonoException::EmitMonoEHFrame () */
        p = fde;
        has_aug = *p;
        p ++;