X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=ghc%2Fcompiler%2Fghci%2FByteCodeFFI.lhs;h=dd55e4999ac6556694ea60c218926b1bae2c324f;hp=06c1aa1b654276be87f4cab4e62f3bde38466573;hb=c117f1be1a1923f5a87369d738cca562c3481fcc;hpb=be44e76beb4d5c1dcdc57cee65220d479117cb21 diff --git a/ghc/compiler/ghci/ByteCodeFFI.lhs b/ghc/compiler/ghci/ByteCodeFFI.lhs index 06c1aa1..dd55e49 100644 --- a/ghc/compiler/ghci/ByteCodeFFI.lhs +++ b/ghc/compiler/ghci/ByteCodeFFI.lhs @@ -98,6 +98,15 @@ mkMarshalCode_wrk cconv (r_offW, r_rep) addr_offW arg_offs_n_reps -- reversed because args are pushed L -> R onto C stack | (a_offW, a_rep) <- reverse arg_offs_n_reps ] + + arguments_size = bytes_per_word * length offsets_to_pushW +#if darwin_TARGET_OS + -- Darwin: align stack frame size to a multiple of 16 bytes + stack_frame_size = (arguments_size + 15) .&. complement 15 + stack_frame_pad = stack_frame_size - arguments_size +#else + stack_frame_size = arguments_size +#endif -- some helpers to assemble x86 insns. movl_offespmem_esi offB -- movl offB(%esp), %esi @@ -189,6 +198,13 @@ mkMarshalCode_wrk cconv (r_offW, r_rep) addr_offW arg_offs_n_reps -} ++ movl_offespmem_esi 32 +#if darwin_TARGET_OS + {- On Darwin, add some padding so that the stack stays aligned. -} + ++ (if stack_frame_pad /= 0 + then add_lit_esp (-stack_frame_pad) + else []) +#endif + {- For each arg in args_offs_n_reps, examine the associated CgRep to determine how many words there are. This gives a bunch of offsets on the H stack to copy to the C stack: @@ -216,7 +232,7 @@ mkMarshalCode_wrk cconv (r_offW, r_rep) addr_offW arg_offs_n_reps movl 28+4(%esp), %esi -} ++ (if cconv /= StdCallConv - then add_lit_esp (bytes_per_word * length offsets_to_pushW) + then add_lit_esp stack_frame_size else []) ++ movl_offespmem_esi 32