@@ -91,7 +91,7 @@ type SequentialT m = MonadStack '[
9191type UncachedSequentialT m =
9292 MonadStack '[
9393 AbstractCountT MailboxLabel BoundedCount ,
94- AbstractCountT SequentialCmp AbstractCount ,
94+ -- AbstractCountT SequentialCmp AbstractCount,
9595 JoinT
9696 ] m
9797
@@ -107,8 +107,8 @@ type InterAnalysisM m = (MonadSchemeStore m,
107107 -- To accurately track these, abstract counts related to components
108108 -- need to be tracked. And if component count > 1 then the label
109109 -- count needs to be marked infinite as well. (otherwise the result is unsound)
110- MapM CmpCountIn (CountMap' SequentialCmp AbstractCount ) m ,
111- MapM CmpCountOut (CountMap' SequentialCmp AbstractCount ) m ,
110+ -- MapM CmpCountIn (CountMap' SequentialCmp AbstractCount) m,
111+ -- MapM CmpCountOut (CountMap' SequentialCmp AbstractCount) m,
112112 WorkListM m SequentialCmp ,
113113 ComponentTrackingM m SequentialCmp ,
114114 DependsOn m SequentialCmp '[
@@ -117,8 +117,8 @@ type InterAnalysisM m = (MonadSchemeStore m,
117117 Pid Exp K ,
118118 CountIn ,
119119 CountOut ,
120- CmpCountIn ,
121- CmpCountOut
120+ CmpCountIn
121+ -- CmpCountOut
122122 ],
123123 -- MonadMailbox ActorVlu m,
124124 MonadMailbox' ActorRef PMB m ,
@@ -142,8 +142,12 @@ instance (CtxM m K, MonadActorLocal ActorVlu m, Monad m) => CtxM (LocalMailboxT
142142 withCtx f m = do
143143 ctx <- getCtx
144144 lowerM (withCtx (const (f ctx))) m
145- getCtx = do (AdrCtx callSites maxCallSites _) <- upperM getCtx
146- AdrCtx callSites maxCallSites . ActorCtx <$> getSelf
145+ getCtx = do ctx <- upperM getCtx
146+ case ctx of
147+ (AdrCtx callSites maxCallSites _) ->
148+ AdrCtx callSites maxCallSites . ActorCtx <$> getSelf
149+ InsensitiveCtx ->
150+ return InsensitiveCtx
147151
148152------------------------------------------------------------
149153-- Actor modular requirements
@@ -198,45 +202,47 @@ type LabelCount = CountMap' MailboxLabel BoundedCount
198202
199203-- | Add flow-sensitive counting of mailbox labels
200204counting :: (MonadAbstractCount MailboxLabel BoundedCount m ,
201- MonadAbstractCount SequentialCmp AbstractCount m ,
205+ -- MonadAbstractCount SequentialCmp AbstractCount m,
202206 MapM CountIn LabelCount m ,
203207 MapM CountOut LabelCount m ,
204- MapM CmpCountIn SeqCmpCount m ,
205- MapM CmpCountOut SeqCmpCount m ,
208+ -- MapM CmpCountIn SeqCmpCount m,
209+ -- MapM CmpCountOut SeqCmpCount m,
206210 MonadBottom m ,
207211 MonadCache m ,
212+ -- MonadIO m,
208213 Key m Cmp ~ SequentialCmp )
209214 => SequentialCmp
210215 -> (Cmp -> AroundT Cmp ActorVlu m ActorVlu )
211216 -> Cmp -> AroundT Cmp ActorVlu m ActorVlu
212217counting outerCmp inner cmp = do
213218 k <- upperM $ key cmp
214219 counts <- getCounts
215- cmpCounts <- getCounts
220+ -- cmpCounts <- getCounts
216221
217222 _ <- MapM. get (CountIn k) -- TODO: this seems to be necessary for a correct result, it could be related to dependency tracking which means that some things are not triggered correctly,
218223 -- if so this is just a bandaid...
219224 outCount <- fromMaybe CountMap. emptyCountMap <$> MapM. get (CountOut outerCmp)
220225
221226 -- TODO: it should actually be an invariant that the outCount is actually
222227 -- always smaller or equal, otherwise we are overwriting data.
223- -- Normally the semantics of the analysis ensure this, but this does not seem
228+ -- Normally the semantics of the analysis ensures this, but this does not seem
224229 -- to be the case here, perhaps due to branching? So for now always keep the biggest
225230 -- one which should be sound.
226231 if not (leq (CountingMap counts) outCount)
227232 then MapM. put (CountOut outerCmp) (CountingMap counts)
228233 else return ()
229234
230235 MapM. joinWith (CountIn k) (CountingMap counts)
231- MapM. joinWith (CmpCountIn k) (CountingMap cmpCounts)
236+ -- MapM.joinWith (CmpCountIn k) (CountingMap cmpCounts)
232237
238+ -- liftIO (putStrLn $ "Analyzing inner " ++ show cmp)
233239 v <- inner cmp
234240
235241 countOut <- maybe mbottom return =<< MapM. get (CountOut k)
236- cmpCountOut <- maybe mbottom return =<< MapM. get (CmpCountOut k)
242+ -- cmpCountOut <- maybe mbottom return =<< MapM.get (CmpCountOut k)
237243
238244 putCounts (getCountingMap countOut)
239- putCounts (getCountingMap cmpCountOut)
245+ -- putCounts (getCountingMap cmpCountOut)
240246 return v
241247
242248
@@ -253,25 +259,25 @@ type IntraT m = SequentialT (UncachedSequentialT (IntraAnalysisT SequentialCmp m
253259intra :: forall m . InterAnalysisM m => ActorRef -> SequentialCmp -> m ()
254260intra _ cmp = do
255261 countIn <- fromJust <$> MapM. get (CountIn cmp)
256- cmpCountIn <- fromJust <$> MapM. get (CmpCountIn cmp)
257- MapM. put (CmpCountIn cmp) (CountMap. increment cmp cmpCountIn)
262+ -- cmpCountIn <- fromJust <$> MapM.get (CmpCountIn cmp)
263+ -- MapM.put (CmpCountIn cmp) (CountMap.increment cmp cmpCountIn)
258264 result <- runFixT @ (IntraT m )
259265 (runAroundT
260266 (counting cmp)
261267 .
262268 (eval @ _ @ _ @ _ @ Partition @ MB ))
263269 cmp
264- & runAlloc VarAdr -- TODO: use the actual context
265- & runAlloc PtrAdr -- problem: current context is infinite
270+ & runAlloc ( const . flip VarAdr InsensitiveCtx ) -- TODO: use the actual context
271+ & runAlloc ( const . flip PtrAdr InsensitiveCtx ) -- problem: current context is infinite
266272 & runAbstractCountT @ MailboxLabel countIn
267- & runAbstractCountT @ SequentialCmp cmpCountIn
273+ -- & runAbstractCountT @SequentialCmp cmpCountIn
268274 & runJoinT
269275 & runIntraAnalysis cmp
270276 case result of
271277 BL. Bottom -> return ()
272- BL. Value ((( ) , count'), cmpCount ') -> do
278+ BL. Value (() , count') -> do
273279 MapM. put (CountOut cmp) count'
274- MapM. put (CmpCountOut cmp) cmpCount'
280+ -- MapM.put (CmpCountOut cmp) cmpCount'
275281
276282
277283-- | Inter-analysis
@@ -284,7 +290,7 @@ inter :: InterAnalysisM m
284290 -> m ()
285291inter labelCounts exp environment ref mb = do
286292 MapM. put (CountIn initialCmp) (CountingMap labelCounts)
287- MapM. put (CmpCountIn initialCmp) CountMap. emptyCountMap
293+ -- MapM.put (CmpCountIn initialCmp) CountMap.emptyCountMap
288294 iterateWL' initialCmp (intra ref)
289295 where initialCmp = ActorExp exp -- component to analyze
290296 <+> environment -- initial lexical environment
@@ -311,16 +317,16 @@ analyze labelCounts exp env ref = do
311317 & runWithMapping @ SequentialCmp @ SequentialRes
312318 & runWithMapping @ CountIn @ LabelCount
313319 & runWithMapping @ CountOut @ LabelCount
314- & runWithMapping @ CmpCountIn @ SeqCmpCount
320+ -- & runWithMapping @CmpCountIn @SeqCmpCount
315321 & runWithMapping @ CmpCountOut @ SeqCmpCount
316322 & runWithComponentTracking @ SequentialCmp
317- & runWithDependencyTracking @ SequentialCmp @ SequentialCmp
318- & runWithDependencyTracking @ SequentialCmp @ (SchemeAdr Exp K )
319- & runWithDependencyTracking @ SequentialCmp @ ActorRef
320- & runWithDependencyTracking @ SequentialCmp @ CountIn
321- & runWithDependencyTracking @ SequentialCmp @ CountOut
322- & runWithDependencyTracking @ SequentialCmp @ CmpCountIn
323- & runWithDependencyTracking @ SequentialCmp @ CmpCountOut
323+ & runWithDependencyTracingTracking @ SequentialCmp @ SequentialCmp
324+ & runWithDependencyTracingTracking @ SequentialCmp @ (SchemeAdr Exp K )
325+ & runWithDependencyTracingTracking @ SequentialCmp @ ActorRef
326+ & runWithDependencyTracingTracking @ SequentialCmp @ CountIn
327+ & runWithDependencyTracingTracking @ SequentialCmp @ CountOut
328+ & runWithDependencyTracingTracking @ SequentialCmp @ CmpCountIn
329+ & runWithDependencyTracingTracking @ SequentialCmp @ CmpCountOut
324330 -- & runWithWorklistProfilingT @SequentialCmp
325331 & runWithWorkList @ (LIFOWorklist SequentialCmp )
326332 & runDebugIntraAnalysis ref
@@ -329,6 +335,6 @@ analyze labelCounts exp env ref = do
329335
330336 MapM. put (ActorResOut ref) (extractVal res)
331337 MapM. put (CountMax ref) (maxCount res)
332- where extractVal (_ ::*:: res ::*:: _ ::*:: _ ::*:: _ ::*:: _ ) = ActorRes res
333- maxCount (_ ::*:: _ ::*:: _ ::*:: counter ::*:: _ ::*:: _ ) =
338+ where extractVal (_ ::*:: res ::*:: _ ::*:: _ ::*:: _) = ActorRes res
339+ maxCount (_ ::*:: _ ::*:: _ ::*:: counter ::*:: _) =
334340 foldr (Map. unionWith Count. max . getCountingMap) Map. empty $ Map. elems counter
0 commit comments