Skip to content
Snippets Groups Projects
Commit f43da5c8 authored by Stefan Schulze Frielinghaus's avatar Stefan Schulze Frielinghaus Committed by Marge Bot
Browse files

FFI: Revisit fix pass small ints in foreign call wrappers

Since commit be5d74ca small ints/words are passed according to their
natural size which obsoletes fix from commit 01f7052c.

Reverted 01f7052c but kept the introduced test case.
parent f7302f15
No related branches found
No related tags found
1 merge request!4949Marge Bot Batch MR - DO NOT TOUCH
......@@ -541,36 +541,15 @@ mkFExportCBits dflags c_nm maybe_target arg_htys res_hty is_IO_res_ty cc
SDoc, -- C type
Type, -- Haskell type
CmmType)] -- the CmmType
arg_info = [ let stg_type = showStgType ty
cmm_type = typeCmmType platform (getPrimTyOf ty)
stack_type
= if int_promote (typeTyCon ty)
then text "HsWord"
else stg_type
in
(arg_cname n stg_type stack_type,
arg_info = [ let stg_type = showStgType ty in
(arg_cname n stg_type,
stg_type,
ty,
cmm_type)
typeCmmType platform (getPrimTyOf ty))
| (ty,n) <- zip arg_htys [1::Int ..] ]
int_promote ty_con
| ty_con `hasKey` int8TyConKey = True
| ty_con `hasKey` int16TyConKey = True
| ty_con `hasKey` int32TyConKey
, platformWordSizeInBytes platform > 4
= True
| ty_con `hasKey` word8TyConKey = True
| ty_con `hasKey` word16TyConKey = True
| ty_con `hasKey` word32TyConKey
, platformWordSizeInBytes platform > 4
= True
| otherwise = False
arg_cname n stg_ty stack_ty
| libffi = parens (stg_ty) <> char '*' <>
parens (stack_ty <> char '*') <>
arg_cname n stg_ty
| libffi = char '*' <> parens (stg_ty <> char '*') <>
text "args" <> brackets (int (n-1))
| otherwise = text ('a':show n)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment