@@ -1406,6 +1406,9 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
1406
1406
bindingset [ node, state, t0, ap]
1407
1407
predicate filter ( NodeEx node , FlowState state , Typ t0 , Ap ap , Typ t ) ;
1408
1408
1409
+ bindingset [ node, ap, isStoreStep]
1410
+ predicate stepFilter ( NodeEx node , Ap ap , boolean isStoreStep ) ;
1411
+
1409
1412
bindingset [ typ, contentType]
1410
1413
predicate typecheckStore ( Typ typ , DataFlowType contentType ) ;
1411
1414
@@ -2842,11 +2845,12 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
2842
2845
2843
2846
private predicate localStep (
2844
2847
StagePathNodeImpl pn1 , NodeEx node , FlowState state , Cc cc , ParamNodeOption summaryCtx ,
2845
- TypOption argT , ApOption argAp , Typ t , Ap ap , string label
2848
+ TypOption argT , ApOption argAp , Typ t , Ap ap , string label , boolean isStoreStep
2846
2849
) {
2847
2850
exists ( NodeEx mid , FlowState state0 , Typ t0 , LocalCc localCc |
2848
2851
pn1 = TStagePathNodeMid ( mid , state0 , cc , summaryCtx , argT , argAp , t0 , ap ) and
2849
- localCc = getLocalCc ( cc )
2852
+ localCc = getLocalCc ( cc ) and
2853
+ isStoreStep = false
2850
2854
|
2851
2855
localStep ( mid , state0 , node , state , true , _, localCc , label ) and
2852
2856
t = t0
@@ -2860,25 +2864,28 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
2860
2864
pn1 = TStagePathNodeMid ( mid , state , cc , summaryCtx , argT , argAp , t0 , ap0 ) and
2861
2865
fwdFlowStore ( mid , t0 , ap0 , c , t , node , state , cc , summaryCtx , argT , argAp ) and
2862
2866
ap = apCons ( c , t0 , ap0 ) and
2863
- label = ""
2867
+ label = "" and
2868
+ isStoreStep = true
2864
2869
)
2865
2870
or
2866
2871
// read
2867
2872
exists ( NodeEx mid , Typ t0 , Ap ap0 , Content c |
2868
2873
pn1 = TStagePathNodeMid ( mid , state , cc , summaryCtx , argT , argAp , t0 , ap0 ) and
2869
2874
fwdFlowRead ( t0 , ap0 , c , mid , node , state , cc , summaryCtx , argT , argAp ) and
2870
2875
fwdFlowConsCand ( t0 , ap0 , c , t , ap ) and
2871
- label = ""
2876
+ label = "" and
2877
+ isStoreStep = false
2872
2878
)
2873
2879
}
2874
2880
2875
2881
private predicate localStep ( StagePathNodeImpl pn1 , StagePathNodeImpl pn2 , string label ) {
2876
2882
exists (
2877
2883
NodeEx node , FlowState state , Cc cc , ParamNodeOption summaryCtx , TypOption argT ,
2878
- ApOption argAp , Typ t0 , Ap ap
2884
+ ApOption argAp , Typ t0 , Ap ap , boolean isStoreStep
2879
2885
|
2880
- localStep ( pn1 , node , state , cc , summaryCtx , argT , argAp , t0 , ap , label ) and
2881
- pn2 = typeStrengthenToStagePathNode ( node , state , cc , summaryCtx , argT , argAp , t0 , ap )
2886
+ localStep ( pn1 , node , state , cc , summaryCtx , argT , argAp , t0 , ap , label , isStoreStep ) and
2887
+ pn2 = typeStrengthenToStagePathNode ( node , state , cc , summaryCtx , argT , argAp , t0 , ap ) and
2888
+ stepFilter ( node , ap , isStoreStep )
2882
2889
)
2883
2890
or
2884
2891
summaryStep ( pn1 , pn2 , label )
@@ -2971,7 +2978,8 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
2971
2978
ApOption argAp , Typ t0 , Ap ap
2972
2979
|
2973
2980
nonLocalStep ( pn1 , node , state , cc , summaryCtx , argT , argAp , t0 , ap , label ) and
2974
- pn2 = typeStrengthenToStagePathNode ( node , state , cc , summaryCtx , argT , argAp , t0 , ap )
2981
+ pn2 = typeStrengthenToStagePathNode ( node , state , cc , summaryCtx , argT , argAp , t0 , ap ) and
2982
+ stepFilter ( node , ap , false )
2975
2983
)
2976
2984
}
2977
2985
@@ -2989,7 +2997,8 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
2989
2997
ApOption argAp , Typ t0 , Ap ap , StagePathNodeImpl out0
2990
2998
|
2991
2999
fwdFlowThroughStep2 ( arg , par , ret , node , cc , state , summaryCtx , argT , argAp , t0 , ap ) and
2992
- out0 = typeStrengthenToStagePathNode ( node , state , cc , summaryCtx , argT , argAp , t0 , ap )
3000
+ out0 = typeStrengthenToStagePathNode ( node , state , cc , summaryCtx , argT , argAp , t0 , ap ) and
3001
+ stepFilter ( node , ap , false )
2993
3002
|
2994
3003
out = out0 or out = out0 .( StagePathNodeMid ) .projectToSink ( _)
2995
3004
)
@@ -3181,6 +3190,9 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
3181
3190
)
3182
3191
}
3183
3192
3193
+ bindingset [ node, ap, isStoreStep]
3194
+ predicate stepFilter ( NodeEx node , Ap ap , boolean isStoreStep ) { any ( ) }
3195
+
3184
3196
bindingset [ typ, contentType]
3185
3197
predicate typecheckStore ( Typ typ , DataFlowType contentType ) { any ( ) }
3186
3198
@@ -3459,6 +3471,9 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
3459
3471
)
3460
3472
}
3461
3473
3474
+ bindingset [ node, ap, isStoreStep]
3475
+ predicate stepFilter ( NodeEx node , Ap ap , boolean isStoreStep ) { any ( ) }
3476
+
3462
3477
bindingset [ typ, contentType]
3463
3478
predicate typecheckStore ( Typ typ , DataFlowType contentType ) { any ( ) }
3464
3479
}
@@ -3543,10 +3558,15 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
3543
3558
private predicate clear ( NodeEx node , Ap ap ) {
3544
3559
// When `node` is the target of a store, we interpret `clearsContent` as
3545
3560
// only pertaining to _earlier_ store steps. In this case, we need to postpone
3546
- // checking `clearsContent` to the `pathStep` predicate
3561
+ // checking `clearsContent` to the step creation.
3547
3562
clearContent ( node , ap .getHead ( ) , false )
3548
3563
}
3549
3564
3565
+ pragma [ nomagic]
3566
+ private predicate clearExceptStore ( NodeEx node , Ap ap ) {
3567
+ clearContent ( node , ap .getHead ( ) , true )
3568
+ }
3569
+
3550
3570
pragma [ nomagic]
3551
3571
private predicate expectsContentCand ( NodeEx node , Ap ap ) {
3552
3572
exists ( Content c |
@@ -3569,6 +3589,11 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
3569
3589
)
3570
3590
}
3571
3591
3592
+ bindingset [ node, ap, isStoreStep]
3593
+ predicate stepFilter ( NodeEx node , Ap ap , boolean isStoreStep ) {
3594
+ if clearExceptStore ( node , ap ) then isStoreStep = true else any ( )
3595
+ }
3596
+
3572
3597
bindingset [ typ, contentType]
3573
3598
predicate typecheckStore ( Typ typ , DataFlowType contentType ) {
3574
3599
// We need to typecheck stores here, since reverse flow through a getter
@@ -3829,6 +3854,16 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
3829
3854
exists ( ap )
3830
3855
}
3831
3856
3857
+ pragma [ nomagic]
3858
+ private predicate clearExceptStore ( NodeEx node , Ap ap ) {
3859
+ Stage4Param:: clearContent ( node , ap .getHead ( ) , true )
3860
+ }
3861
+
3862
+ bindingset [ node, ap, isStoreStep]
3863
+ predicate stepFilter ( NodeEx node , Ap ap , boolean isStoreStep ) {
3864
+ if clearExceptStore ( node , ap ) then isStoreStep = true else any ( )
3865
+ }
3866
+
3832
3867
bindingset [ typ, contentType]
3833
3868
predicate typecheckStore ( Typ typ , DataFlowType contentType ) {
3834
3869
compatibleTypesFilter ( typ , contentType )
0 commit comments