summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marlow <simonmar@microsoft.com>2008-05-14 09:27:42 +0000
committerSimon Marlow <simonmar@microsoft.com>2008-05-14 09:27:42 +0000
commitb515d109750e00630dfaf6055a1ded8dfd61b415 (patch)
treed61004df88557127e22f3ab18030ccf60af287e2
parentbca74f3e6bde807d688e39e6de28112ebcb4fa49 (diff)
downloadhaskell-b515d109750e00630dfaf6055a1ded8dfd61b415.tar.gz
FIX #1288: GHCi wasn't adding the @n suffix to stdcalls on Windows
-rw-r--r--compiler/ghci/ByteCodeGen.lhs15
1 files changed, 13 insertions, 2 deletions
diff --git a/compiler/ghci/ByteCodeGen.lhs b/compiler/ghci/ByteCodeGen.lhs
index d395aa06c1..bd292810ad 100644
--- a/compiler/ghci/ByteCodeGen.lhs
+++ b/compiler/ghci/ByteCodeGen.lhs
@@ -950,9 +950,10 @@ generateCCall d0 s p (CCallSpec target cconv _) fn args_r_to_l
code_n_reps <- pargs d0 args_r_to_l
let
(pushs_arg, a_reps_pushed_r_to_l) = unzip code_n_reps
+ a_reps_sizeW = sum (map primRepSizeW a_reps_pushed_r_to_l)
push_args = concatOL pushs_arg
- d_after_args = d0 + sum (map primRepSizeW a_reps_pushed_r_to_l)
+ d_after_args = d0 + a_reps_sizeW
a_reps_pushed_RAW
| null a_reps_pushed_r_to_l || head a_reps_pushed_r_to_l /= VoidRep
= panic "ByteCodeGen.generateCCall: missing or invalid World token?"
@@ -1009,8 +1010,18 @@ generateCCall d0 s p (CCallSpec target cconv _) fn args_r_to_l
DynamicTarget
-> return (False, panic "ByteCodeGen.generateCCall(dyn)")
StaticTarget target
- -> do res <- ioToBc (lookupStaticPtr target)
+ -> do res <- ioToBc (lookupStaticPtr stdcall_adj_target)
return (True, res)
+ where
+ stdcall_adj_target
+#ifdef mingw32_TARGET_OS
+ | StdCallConv <- cconv
+ = mkFastString (unpackFS target ++ '@':show size)
+#endif
+ | otherwise
+ = target
+ size = a_reps_sizeW * wORD_SIZE
+
-- in
(is_static, static_target_addr) <- get_target_info
let