Skip to content

Commit d9a25a4

Browse files
committed
save
1 parent 006e8d4 commit d9a25a4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

gibbon-compiler/src/Gibbon/Passes/FollowPtrs.hs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ followPtrs (Prog ddefs fundefs mainExp) = do
5959
[] funArgs
6060
let in_locs = foldr (\loc acc -> if loc == scrt_loc then ((indir_ptrloc) : acc) else (loc : acc)) [] (inLocVars funTy)
6161
let out_locs = outLocVars funTy
62+
-- [VS: 09/14/2025]
63+
-- In case an output location, that's passed to the function call.
64+
-- for an SoA location, we cannot simply pass this directly.
65+
-- Since we do this by value, we need to update the SoA location,
66+
-- because bounds checking may have updated the value of the location.
67+
-- Note that we only need to update the non packed locations + the data constructor buffer.
68+
-- Other packed types will be updated by the function that traverses it.
69+
6270
let redir_dcon = fst $ fromJust $ L.find (isRedirectionTag . fst) dataCons
6371
let redir_bod = (if isPrinterName funName then LetE (wc,[],ProdTy[],PrimAppE PrintSym [LitSymE (toVar " ->r ")]) else id) $
6472
LetE (callv,endofs,out_ty,AppE funName (in_locs ++ out_locs) args) $

0 commit comments

Comments
 (0)