mirror of
https://github.com/catseye/SixtyPical.git
synced 2025-02-18 13:31:08 +00:00
Use weaker version of updateRoutCtx in merge. All tests pass.
This commit is contained in:
parent
1aa03f7451
commit
264838b2ec
@ -127,11 +127,12 @@ mergeRoutCtxs nm routCtx calledRoutCtx calledRout@(Routine name outputs _) =
|
|||||||
-- Take 2 routine contexts -- one from each branch of an `if` -- and merge
|
-- Take 2 routine contexts -- one from each branch of an `if` -- and merge
|
||||||
-- them to create a new context for the remainder of the routine.
|
-- them to create a new context for the remainder of the routine.
|
||||||
--
|
--
|
||||||
-- TODO: this merge is "too sensitive" in a way that needs to be better
|
-- We use a weaker version of updateRoutCtx to build the merged context.
|
||||||
-- understood and documented. It is that it is using updateRoutCtx to
|
-- We do this because accessing a poisoned storage location from either
|
||||||
-- make the merged resultant context, but that routine raises an error
|
-- of the branch contexts is not an error at the merge point -- we simply
|
||||||
-- if the new usage is replacing a poisoned entry. It should be "more OK"
|
-- make the storage location poisoned in the resulting context. (If the
|
||||||
-- with replacing a poisoned entry, here.
|
-- poisoned location is accessed subsequently to the merge point, that is
|
||||||
|
-- of course still an error.)
|
||||||
--
|
--
|
||||||
mergeAlternateRoutCtxs nm routCtx1 routCtx2 =
|
mergeAlternateRoutCtxs nm routCtx1 routCtx2 =
|
||||||
let
|
let
|
||||||
@ -154,3 +155,14 @@ mergeAlternateRoutCtxs nm routCtx1 routCtx2 =
|
|||||||
updateRoutCtx nm location newUsage routCtxAccum
|
updateRoutCtx nm location newUsage routCtxAccum
|
||||||
in
|
in
|
||||||
Map.foldrWithKey (poison) routCtx1 routCtx2
|
Map.foldrWithKey (poison) routCtx1 routCtx2
|
||||||
|
where
|
||||||
|
-- a weaker version of updateRoutCtx, which does not error if
|
||||||
|
-- we access a poisoned source
|
||||||
|
updateRoutCtx nm dst (UpdatedWith src) routCtx =
|
||||||
|
let
|
||||||
|
s = untypedLocation src
|
||||||
|
d = untypedLocation dst
|
||||||
|
in
|
||||||
|
Map.insert d (UpdatedWith s) routCtx
|
||||||
|
updateRoutCtx nm dst (PoisonedWith src) routCtx =
|
||||||
|
Map.insert (untypedLocation dst) (PoisonedWith $ untypedLocation src) routCtx
|
||||||
|
Loading…
x
Reference in New Issue
Block a user