mirror of
https://github.com/github/semantic.git
synced 2025-01-03 04:51:57 +03:00
Run nondeterminism locally in flow-sensitive analysis.
This commit is contained in:
parent
f0925ad0cf
commit
66d5a1dfe8
@ -89,10 +89,13 @@ convergingModules :: ( AbstractValue term address value m
|
||||
, Member (Env address) sig
|
||||
, Member (State (Heap address value)) sig
|
||||
, Carrier sig m
|
||||
, Effect sig
|
||||
)
|
||||
=> Open (Module term -> Evaluator term address value m address)
|
||||
convergingModules recur m = do
|
||||
c <- getConfiguration (moduleBody m)
|
||||
=> (Module (Either prelude term) -> Evaluator term address value (AltC Maybe (Eff m)) address)
|
||||
-> (Module (Either prelude term) -> Evaluator term address value m address)
|
||||
convergingModules recur m@(Module _ (Left _)) = raiseHandler runNonDet (recur m) >>= maybeM empty
|
||||
convergingModules recur m@(Module _ (Right term)) = do
|
||||
c <- getConfiguration term
|
||||
-- Convergence here is predicated upon an Eq instance, not α-equivalence
|
||||
cache <- converge lowerBound (\ prevCache -> isolateCache $ do
|
||||
putHeap (configurationHeap c)
|
||||
@ -104,8 +107,7 @@ convergingModules recur m = do
|
||||
-- that it doesn't "leak" to the calling context and diverge (otherwise this
|
||||
-- would never complete). We don’t need to use the values, so we 'gather' the
|
||||
-- nondeterministic values into @()@.
|
||||
-- FIXME: do we actually need to gather here?
|
||||
withOracle prevCache (recur m))
|
||||
withOracle prevCache (raiseHandler runNonDet (recur m)))
|
||||
address =<< maybe empty scatter (cacheLookup c cache)
|
||||
|
||||
-- | Iterate a monadic action starting from some initial seed until the results converge.
|
||||
|
Loading…
Reference in New Issue
Block a user