Skip to content

Commit

Permalink
edits
Browse files Browse the repository at this point in the history
  • Loading branch information
vidsinghal committed Feb 16, 2024
1 parent cef8b0d commit 336a05f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
12 changes: 8 additions & 4 deletions gibbon-compiler/src/Gibbon/Passes/Cursorize.hs
Original file line number Diff line number Diff line change
Expand Up @@ -223,15 +223,19 @@ This is used to create bindings for input location variables.

-- Adding additional input arguments for the destination cursors to which outputs
-- are written.
outCurs = filter (\(LRM _ _ m _) -> m == Output) locVars
outCurTys = map (\_ -> CursorTy) outCurs --MutableCursorTy, in case of tail recursive functions.
outCursNonMutable = filter (\(LRM _ _ m mu) -> m == Output && mu == False) locVars
outCurTysNonMutable = map (\_ -> CursorTy) outCursNonMutable

outCursMutable = filter (\(LRM _ _ m mu) -> m == Output && mu == True) locVars
outCursTysMutable = map (\_ -> MutableCursorTy) outCursMutable

inRegs = map (\_ -> CursorTy) (inRegVars ty)
in_tys = inRegs ++ outRegs ++ outCurTys ++ (map unTy2 arrIns)
in_tys = inRegs ++ outRegs ++ outCurTysNonMutable ++ outCursTysMutable ++ (map unTy2 arrIns)

-- Packed types in the input now become (read-only) cursors.
newIns = map (constPacked CursorTy) in_tys

ty' = dbgTraceIt (sdoc (in_tys, outRegs, outCurTys, arrIns, ty, outLocVars ty)) (map stripTyLocs newIns, stripTyLocs newOut')
ty' = dbgTraceIt (sdoc (in_tys, outRegs, outCurTysNonMutable, outCursTysMutable, arrIns, ty, outLocVars ty)) (map stripTyLocs newIns, stripTyLocs newOut')

in ty'

Expand Down
1 change: 1 addition & 0 deletions gibbon-compiler/src/Gibbon/Pretty.hs
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ instance (Pretty l) => Pretty (UrTy l) where
ListTy el_ty1 -> text "List" <+> pprintWithStyle sty el_ty1
PtrTy -> text "Ptr"
CursorTy -> text "Cursor"
MutableCursorTy -> text "Cursor*"
ArenaTy -> case sty of
PPHaskell -> text "()"
PPInternal -> text "Arena"
Expand Down

0 comments on commit 336a05f

Please sign in to comment.