Skip to content

Commit a66a6da

Browse files
committed
Inferlocations will need fixing keeping shortcut pointers in mind
1 parent 8d28fcd commit a66a6da

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

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

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,11 @@ convertTy ddefs useSoA ty = case useSoA of
200200
PackedTy tycon _ -> do
201201
dconBuff <- freshLocVar "loc"
202202
let dcons = getConOrdering ddefs tycon
203-
let dcons' = concatMap (\dcon -> if ('^' `elem` dcon)
204-
then []
205-
else [dcon]
206-
) dcons
207-
locsForFields <- convertTyHelperSoAParent tycon ddefs dcons'
203+
-- let dcons' = concatMap (\dcon -> if ('^' `elem` dcon)
204+
-- then []
205+
-- else [dcon]
206+
-- ) dcons
207+
locsForFields <- convertTyHelperSoAParent tycon ddefs dcons
208208
let soaLocation = SoA (unwrapLocVar dconBuff) locsForFields
209209
dbgTrace minChatLvl "Print ty: " dbgTrace minChatLvl (sdoc (PackedTy tycon soaLocation)) dbgTrace minChatLvl "End ty.\n" return $ PackedTy tycon soaLocation
210210
_ -> traverse (const (freshLocVar "loc")) ty
@@ -251,6 +251,8 @@ convertTyHelperSoAChild tycon ddefs dcon = do
251251
let soaLocation = SoA (unwrapLocVar dconBuff) locsForFields
252252
return (flds ++ [((dcon, idx), soaLocation)], idx + 1)
253253

254+
CursorTy -> return (flds, idx+1)
255+
CursorArrayTy _ -> return (flds, idx+1)
254256
_ -> do
255257
info <- convertTyHelperGetLocForField' dcon idx (show f)
256258
return (flds ++ [info], idx + 1)
@@ -462,7 +464,7 @@ fixType_ ty =
462464
getFieldLocs :: LocVar -> [((DataCon, FieldIndex), LocVar)]
463465
getFieldLocs loc = case loc of
464466
SoA dcon fieldLocs -> fieldLocs
465-
Single lc -> error "InferLocations : getFieldLocs : Did not expect a non SoA location!"
467+
Single lc -> error $ "InferLocations : getFieldLocs : Did not expect a non SoA location!" ++ show loc
466468

467469

468470
makeSoARegion :: LocVar -> TiM Region
@@ -1185,6 +1187,9 @@ inferExp ddefs env@FullEnv{dataDefs} ex0 dest =
11851187
PackedTy tycon _ -> if tycon == tyConOfDataCon
11861188
then (w ++ [Just idx], f)
11871189
else (w, f ++ [Just idx])
1190+
-- redirections, indirections, shortcut pointers...
1191+
CursorTy -> (w ++ [Just idx], f)
1192+
CursorArrayTy _ -> (w ++ [Just idx], f)
11881193
_ -> (w, f ++ [Just idx])
11891194
) ([], []) (zip ls' [0..length(ls')])
11901195
-- dbgTrace minChatLvl "Print tuple line: 1023" dbgTrace minChatLvl (sdoc (idxsWriteDconBuf, idxsFields)) dbgTrace minChatLvl "End line 1023\n"
@@ -1212,7 +1217,7 @@ inferExp ddefs env@FullEnv{dataDefs} ex0 dest =
12121217
fieldLocVars = P.map (\(Just idx) -> let fldloc = lookup (k, idx) fieldLocs
12131218
in case fldloc of
12141219
Just location -> Just location
1215-
Nothing -> error $ "inferExp: fieldLocVars did not expect Nothing! Datacon: " ++ k ++ "," ++ show idxsFields' ++ ", fieldLocs: " ++ show fieldLocs
1220+
Nothing -> error $ "inferExp: fieldLocVars did not expect Nothing! Datacon: " ++ show (k, idx) ++ " ," ++ show idxsFields' ++ ", fieldLocs: " ++ show fieldLocs
12161221
) idxsFields'
12171222
fieldConstraints = (mapMaybe afterVar $ zip3
12181223
dcArgFields

0 commit comments

Comments
 (0)