@@ -1071,8 +1071,8 @@ module Impl<FullStateConfigSig Config> {
1071
1071
1072
1072
Typ getTyp ( DataFlowType t ) ;
1073
1073
1074
- bindingset [ tc, tail]
1075
- Ap apCons ( TypedContent tc , Ap tail ) ;
1074
+ bindingset [ tc, t , tail]
1075
+ Ap apCons ( TypedContent tc , Typ t , Ap tail ) ;
1076
1076
1077
1077
/**
1078
1078
* An approximation of `Content` that corresponds to the precision level of
@@ -1263,7 +1263,7 @@ module Impl<FullStateConfigSig Config> {
1263
1263
// store
1264
1264
exists ( TypedContent tc , Typ t0 , Ap ap0 |
1265
1265
fwdFlowStore ( _, t0 , ap0 , tc , t , node , state , cc , summaryCtx , argAp ) and
1266
- ap = apCons ( tc , ap0 ) and
1266
+ ap = apCons ( tc , t0 , ap0 ) and
1267
1267
apa = getApprox ( ap )
1268
1268
)
1269
1269
or
@@ -1330,7 +1330,7 @@ module Impl<FullStateConfigSig Config> {
1330
1330
exists ( TypedContent tc |
1331
1331
fwdFlowStore ( _, t1 , tail , tc , t2 , _, _, _, _, _) and
1332
1332
tc .getContent ( ) = c and
1333
- cons = apCons ( tc , tail )
1333
+ cons = apCons ( tc , t1 , tail )
1334
1334
)
1335
1335
}
1336
1336
@@ -1423,9 +1423,9 @@ module Impl<FullStateConfigSig Config> {
1423
1423
}
1424
1424
1425
1425
pragma [ nomagic]
1426
- private predicate storeStepFwd ( NodeEx node1 , Ap ap1 , TypedContent tc , NodeEx node2 , Ap ap2 ) {
1427
- fwdFlowStore ( node1 , _ , ap1 , tc , _, node2 , _, _, _, _) and
1428
- ap2 = apCons ( tc , ap1 ) and
1426
+ private predicate storeStepFwd ( NodeEx node1 , Typ t1 , Ap ap1 , TypedContent tc , NodeEx node2 , Ap ap2 ) {
1427
+ fwdFlowStore ( node1 , t1 , ap1 , tc , _, node2 , _, _, _, _) and
1428
+ ap2 = apCons ( tc , t1 , ap1 ) and
1429
1429
readStepFwd ( _, ap2 , tc .getContent ( ) , _, _)
1430
1430
}
1431
1431
@@ -1563,7 +1563,7 @@ module Impl<FullStateConfigSig Config> {
1563
1563
or
1564
1564
// store
1565
1565
exists ( Ap ap0 , Content c |
1566
- revFlowStore ( ap0 , c , ap , node , state , _, _, returnCtx , returnAp ) and
1566
+ revFlowStore ( ap0 , c , ap , _ , node , state , _, _, returnCtx , returnAp ) and
1567
1567
revFlowConsCand ( ap0 , c , ap )
1568
1568
)
1569
1569
or
@@ -1602,11 +1602,11 @@ module Impl<FullStateConfigSig Config> {
1602
1602
1603
1603
pragma [ nomagic]
1604
1604
private predicate revFlowStore (
1605
- Ap ap0 , Content c , Ap ap , NodeEx node , FlowState state , TypedContent tc , NodeEx mid ,
1605
+ Ap ap0 , Content c , Ap ap , Typ t , NodeEx node , FlowState state , TypedContent tc , NodeEx mid ,
1606
1606
ReturnCtx returnCtx , ApOption returnAp
1607
1607
) {
1608
1608
revFlow ( mid , state , returnCtx , returnAp , ap0 ) and
1609
- storeStepFwd ( node , ap , tc , mid , ap0 ) and
1609
+ storeStepFwd ( node , t , ap , tc , mid , ap0 ) and
1610
1610
tc .getContent ( ) = c
1611
1611
}
1612
1612
@@ -1676,7 +1676,7 @@ module Impl<FullStateConfigSig Config> {
1676
1676
) {
1677
1677
exists ( Ap ap2 |
1678
1678
PrevStage:: storeStepCand ( node1 , _, tc , c , node2 , contentType , containerType ) and
1679
- revFlowStore ( ap2 , c , ap1 , node1 , _, tc , node2 , _, _) and
1679
+ revFlowStore ( ap2 , c , ap1 , _ , node1 , _, tc , node2 , _, _) and
1680
1680
revFlowConsCand ( ap2 , c , ap1 )
1681
1681
)
1682
1682
}
@@ -1685,7 +1685,7 @@ module Impl<FullStateConfigSig Config> {
1685
1685
exists ( Ap ap1 , Ap ap2 |
1686
1686
revFlow ( node2 , _, _, _, pragma [ only_bind_into ] ( ap2 ) ) and
1687
1687
readStepFwd ( node1 , ap1 , c , node2 , ap2 ) and
1688
- revFlowStore ( ap1 , c , pragma [ only_bind_into ] ( ap2 ) , _, _, _, _, _, _)
1688
+ revFlowStore ( ap1 , c , pragma [ only_bind_into ] ( ap2 ) , _, _, _, _, _, _, _ )
1689
1689
)
1690
1690
}
1691
1691
@@ -1699,21 +1699,26 @@ module Impl<FullStateConfigSig Config> {
1699
1699
pragma [ nomagic]
1700
1700
predicate revFlowAp ( NodeEx node , Ap ap ) { revFlow ( node , _, _, _, ap ) }
1701
1701
1702
- private predicate fwdConsCand ( TypedContent tc , Ap ap ) { storeStepFwd ( _, ap , tc , _, _) }
1702
+ private predicate fwdConsCand ( TypedContent tc , Typ t , Ap ap ) { storeStepFwd ( _, t , ap , tc , _, _) }
1703
1703
1704
- private predicate revConsCand ( TypedContent tc , Ap ap ) { storeStepCand ( _, ap , tc , _, _, _, _) }
1704
+ private predicate revConsCand ( TypedContent tc , Typ t , Ap ap ) {
1705
+ exists ( Ap ap2 , Content c |
1706
+ revFlowStore ( ap2 , c , ap , t , _, _, tc , _, _, _) and
1707
+ revFlowConsCand ( ap2 , c , ap )
1708
+ )
1709
+ }
1705
1710
1706
1711
private predicate validAp ( Ap ap ) {
1707
1712
revFlow ( _, _, _, _, ap ) and ap instanceof ApNil
1708
1713
or
1709
- exists ( TypedContent head , Ap tail |
1710
- consCand ( head , tail ) and
1711
- ap = apCons ( head , tail )
1714
+ exists ( TypedContent head , Typ t , Ap tail |
1715
+ consCand ( head , t , tail ) and
1716
+ ap = apCons ( head , t , tail )
1712
1717
)
1713
1718
}
1714
1719
1715
- additional predicate consCand ( TypedContent tc , Ap ap ) {
1716
- revConsCand ( tc , ap ) and
1720
+ additional predicate consCand ( TypedContent tc , Typ t , Ap ap ) {
1721
+ revConsCand ( tc , t , ap ) and
1717
1722
validAp ( ap )
1718
1723
}
1719
1724
@@ -1766,8 +1771,8 @@ module Impl<FullStateConfigSig Config> {
1766
1771
) {
1767
1772
fwd = true and
1768
1773
nodes = count ( NodeEx node | fwdFlow ( node , _, _, _, _, _, _) ) and
1769
- fields = count ( TypedContent f0 | fwdConsCand ( f0 , _) ) and
1770
- conscand = count ( TypedContent f0 , Ap ap | fwdConsCand ( f0 , ap ) ) and
1774
+ fields = count ( TypedContent f0 | fwdConsCand ( f0 , _, _ ) ) and
1775
+ conscand = count ( TypedContent f0 , Typ t , Ap ap | fwdConsCand ( f0 , t , ap ) ) and
1771
1776
states = count ( FlowState state | fwdFlow ( _, state , _, _, _, _, _) ) and
1772
1777
tuples =
1773
1778
count ( NodeEx n , FlowState state , Cc cc , ParamNodeOption summaryCtx , ApOption argAp , Typ t , Ap ap |
@@ -1776,8 +1781,8 @@ module Impl<FullStateConfigSig Config> {
1776
1781
or
1777
1782
fwd = false and
1778
1783
nodes = count ( NodeEx node | revFlow ( node , _, _, _, _) ) and
1779
- fields = count ( TypedContent f0 | consCand ( f0 , _) ) and
1780
- conscand = count ( TypedContent f0 , Ap ap | consCand ( f0 , ap ) ) and
1784
+ fields = count ( TypedContent f0 | consCand ( f0 , _, _ ) ) and
1785
+ conscand = count ( TypedContent f0 , Typ t , Ap ap | consCand ( f0 , t , ap ) ) and
1781
1786
states = count ( FlowState state | revFlow ( _, state , _, _, _) ) and
1782
1787
tuples =
1783
1788
count ( NodeEx n , FlowState state , ReturnCtx returnCtx , ApOption retAp , Ap ap |
@@ -1895,8 +1900,8 @@ module Impl<FullStateConfigSig Config> {
1895
1900
1896
1901
Typ getTyp ( DataFlowType t ) { any ( ) }
1897
1902
1898
- bindingset [ tc, tail]
1899
- Ap apCons ( TypedContent tc , Ap tail ) { result = true and exists ( tc ) and exists ( tail ) }
1903
+ bindingset [ tc, t , tail]
1904
+ Ap apCons ( TypedContent tc , Typ t , Ap tail ) { result = true and exists ( tc ) and exists ( t ) and exists ( tail ) }
1900
1905
1901
1906
class ApHeadContent = Unit ;
1902
1907
@@ -2165,8 +2170,8 @@ module Impl<FullStateConfigSig Config> {
2165
2170
2166
2171
Typ getTyp ( DataFlowType t ) { result = t }
2167
2172
2168
- bindingset [ tc, tail]
2169
- Ap apCons ( TypedContent tc , Ap tail ) { result .getAHead ( ) = tc and exists ( tail ) }
2173
+ bindingset [ tc, t , tail]
2174
+ Ap apCons ( TypedContent tc , Typ t , Ap tail ) { result .getAHead ( ) = tc and exists ( t ) and exists ( tail ) }
2170
2175
2171
2176
class ApHeadContent = ContentApprox ;
2172
2177
@@ -2249,8 +2254,8 @@ module Impl<FullStateConfigSig Config> {
2249
2254
2250
2255
Typ getTyp ( DataFlowType t ) { result = t }
2251
2256
2252
- bindingset [ tc, tail]
2253
- Ap apCons ( TypedContent tc , Ap tail ) { result .getHead ( ) = tc and exists ( tail ) }
2257
+ bindingset [ tc, t , tail]
2258
+ Ap apCons ( TypedContent tc , Typ t , Ap tail ) { result .getHead ( ) = tc and exists ( t ) and exists ( tail ) }
2254
2259
2255
2260
class ApHeadContent = Content ;
2256
2261
@@ -2373,7 +2378,7 @@ module Impl<FullStateConfigSig Config> {
2373
2378
*/
2374
2379
private predicate expensiveLen2unfolding ( TypedContent tc ) {
2375
2380
exists ( int tails , int nodes , int apLimit , int tupleLimit |
2376
- tails = strictcount ( AccessPathFront apf | Stage4:: consCand ( tc , apf ) ) and
2381
+ tails = strictcount ( DataFlowType t , AccessPathFront apf | Stage4:: consCand ( tc , t , apf ) ) and
2377
2382
nodes =
2378
2383
strictcount ( NodeEx n , FlowState state |
2379
2384
Stage4:: revFlow ( n , state , any ( AccessPathFrontHead apf | apf .getHead ( ) = tc ) )
@@ -2390,11 +2395,11 @@ module Impl<FullStateConfigSig Config> {
2390
2395
private newtype TAccessPathApprox =
2391
2396
TNil ( DataFlowType t ) or
2392
2397
TConsNil ( TypedContent tc , DataFlowType t ) {
2393
- Stage4:: consCand ( tc , TFrontNil ( t ) ) and
2398
+ Stage4:: consCand ( tc , t , TFrontNil ( t ) ) and
2394
2399
not expensiveLen2unfolding ( tc )
2395
2400
} or
2396
2401
TConsCons ( TypedContent tc1 , TypedContent tc2 , int len ) {
2397
- Stage4:: consCand ( tc1 , TFrontHead ( tc2 ) ) and
2402
+ Stage4:: consCand ( tc1 , _ , TFrontHead ( tc2 ) ) and
2398
2403
len in [ 2 .. accessPathLimit ( ) ] and
2399
2404
not expensiveLen2unfolding ( tc1 )
2400
2405
} or
@@ -2421,8 +2426,8 @@ module Impl<FullStateConfigSig Config> {
2421
2426
2422
2427
abstract AccessPathFront getFront ( ) ;
2423
2428
2424
- /** Gets the access path obtained by popping `head` from this path, if any . */
2425
- abstract AccessPathApprox pop ( TypedContent head ) ;
2429
+ /** Holds if this is a representation of `head` followed by the `typ,tail` pair . */
2430
+ abstract predicate isCons ( TypedContent head , DataFlowType typ , AccessPathApprox tail ) ;
2426
2431
}
2427
2432
2428
2433
private class AccessPathApproxNil extends AccessPathApprox , TNil {
@@ -2440,7 +2445,7 @@ module Impl<FullStateConfigSig Config> {
2440
2445
2441
2446
override AccessPathFront getFront ( ) { result = TFrontNil ( t ) }
2442
2447
2443
- override AccessPathApprox pop ( TypedContent head ) { none ( ) }
2448
+ override predicate isCons ( TypedContent head , DataFlowType typ , AccessPathApprox tail ) { none ( ) }
2444
2449
}
2445
2450
2446
2451
abstract private class AccessPathApproxCons extends AccessPathApprox { }
@@ -2464,7 +2469,7 @@ module Impl<FullStateConfigSig Config> {
2464
2469
2465
2470
override AccessPathFront getFront ( ) { result = TFrontHead ( tc ) }
2466
2471
2467
- override AccessPathApprox pop ( TypedContent head ) { head = tc and result = TNil ( t ) }
2472
+ override predicate isCons ( TypedContent head , DataFlowType typ , AccessPathApprox tail ) { head = tc and typ = t and tail = TNil ( t ) }
2468
2473
}
2469
2474
2470
2475
private class AccessPathApproxConsCons extends AccessPathApproxCons , TConsCons {
@@ -2488,15 +2493,16 @@ module Impl<FullStateConfigSig Config> {
2488
2493
2489
2494
override AccessPathFront getFront ( ) { result = TFrontHead ( tc1 ) }
2490
2495
2491
- override AccessPathApprox pop ( TypedContent head ) {
2496
+ override predicate isCons ( TypedContent head , DataFlowType typ , AccessPathApprox tail ) {
2492
2497
head = tc1 and
2498
+ typ = tc2 .getContainerType ( ) and
2493
2499
(
2494
- result = TConsCons ( tc2 , _, len - 1 )
2500
+ tail = TConsCons ( tc2 , _, len - 1 )
2495
2501
or
2496
2502
len = 2 and
2497
- result = TConsNil ( tc2 , _)
2503
+ tail = TConsNil ( tc2 , _)
2498
2504
or
2499
- result = TCons1 ( tc2 , len - 1 )
2505
+ tail = TCons1 ( tc2 , len - 1 )
2500
2506
)
2501
2507
}
2502
2508
}
@@ -2521,32 +2527,30 @@ module Impl<FullStateConfigSig Config> {
2521
2527
2522
2528
override AccessPathFront getFront ( ) { result = TFrontHead ( tc ) }
2523
2529
2524
- override AccessPathApprox pop ( TypedContent head ) {
2530
+ override predicate isCons ( TypedContent head , DataFlowType typ , AccessPathApprox tail ) {
2525
2531
head = tc and
2526
2532
(
2527
- exists ( TypedContent tc2 | Stage4:: consCand ( tc , TFrontHead ( tc2 ) ) |
2528
- result = TConsCons ( tc2 , _, len - 1 )
2533
+ exists ( TypedContent tc2 | Stage4:: consCand ( tc , typ , TFrontHead ( tc2 ) ) |
2534
+ tail = TConsCons ( tc2 , _, len - 1 )
2529
2535
or
2530
2536
len = 2 and
2531
- result = TConsNil ( tc2 , _)
2537
+ tail = TConsNil ( tc2 , _)
2532
2538
or
2533
- result = TCons1 ( tc2 , len - 1 )
2539
+ tail = TCons1 ( tc2 , len - 1 )
2534
2540
)
2535
2541
or
2536
2542
exists ( DataFlowType t |
2537
2543
len = 1 and
2538
- Stage4:: consCand ( tc , TFrontNil ( t ) ) and
2539
- result = TNil ( t )
2544
+ Stage4:: consCand ( tc , t , TFrontNil ( t ) ) and
2545
+ typ = t and
2546
+ tail = TNil ( t )
2540
2547
)
2541
2548
)
2542
2549
}
2543
2550
}
2544
2551
2545
- /** Gets the access path obtained by popping `tc` from `ap`, if any. */
2546
- private AccessPathApprox pop ( TypedContent tc , AccessPathApprox apa ) { result = apa .pop ( tc ) }
2547
-
2548
- /** Gets the access path obtained by pushing `tc` onto `ap`. */
2549
- private AccessPathApprox push ( TypedContent tc , AccessPathApprox apa ) { apa = pop ( tc , result ) }
2552
+ /** Gets the access path obtained by pushing `tc` onto the `t,apa` pair. */
2553
+ private AccessPathApprox push ( TypedContent tc , DataFlowType t , AccessPathApprox apa ) { result .isCons ( tc , t , apa ) }
2550
2554
2551
2555
private newtype TAccessPathApproxOption =
2552
2556
TAccessPathApproxNone ( ) or
@@ -2578,8 +2582,8 @@ module Impl<FullStateConfigSig Config> {
2578
2582
2579
2583
Typ getTyp ( DataFlowType t ) { result = t }
2580
2584
2581
- bindingset [ tc, tail]
2582
- Ap apCons ( TypedContent tc , Ap tail ) { result = push ( tc , tail ) }
2585
+ bindingset [ tc, t , tail]
2586
+ Ap apCons ( TypedContent tc , Typ t , Ap tail ) { result = push ( tc , t , tail ) }
2583
2587
2584
2588
class ApHeadContent = Content ;
2585
2589
@@ -2710,8 +2714,8 @@ module Impl<FullStateConfigSig Config> {
2710
2714
tc = apa .getHead ( ) and
2711
2715
len = apa .len ( ) and
2712
2716
result =
2713
- strictcount ( AccessPathFront apf |
2714
- Stage5:: consCand ( tc , any ( AccessPathApprox ap | ap .getFront ( ) = apf and ap .len ( ) = len - 1 ) )
2717
+ strictcount ( DataFlowType t , AccessPathFront apf |
2718
+ Stage5:: consCand ( tc , t , any ( AccessPathApprox ap | ap .getFront ( ) = apf and ap .len ( ) = len - 1 ) )
2715
2719
)
2716
2720
)
2717
2721
}
@@ -2738,9 +2742,9 @@ module Impl<FullStateConfigSig Config> {
2738
2742
}
2739
2743
2740
2744
private AccessPathApprox getATail ( AccessPathApprox apa ) {
2741
- exists ( TypedContent head |
2742
- apa .pop ( head ) = result and
2743
- Stage5:: consCand ( head , result )
2745
+ exists ( TypedContent head , DataFlowType t |
2746
+ apa .isCons ( head , t , result ) and
2747
+ Stage5:: consCand ( head , t , result )
2744
2748
)
2745
2749
}
2746
2750
@@ -2962,7 +2966,7 @@ module Impl<FullStateConfigSig Config> {
2962
2966
override TypedContent getHead ( ) { result = head1 }
2963
2967
2964
2968
override AccessPath getTail ( ) {
2965
- Stage5:: consCand ( head1 , result .getApprox ( ) ) and
2969
+ Stage5:: consCand ( head1 , head2 . getContainerType ( ) , result .getApprox ( ) ) and
2966
2970
result .getHead ( ) = head2 and
2967
2971
result .length ( ) = len - 1
2968
2972
}
@@ -2994,7 +2998,7 @@ module Impl<FullStateConfigSig Config> {
2994
2998
override TypedContent getHead ( ) { result = head }
2995
2999
2996
3000
override AccessPath getTail ( ) {
2997
- Stage5:: consCand ( head , result .getApprox ( ) ) and result .length ( ) = len - 1
3001
+ Stage5:: consCand ( head , _ , result .getApprox ( ) ) and result .length ( ) = len - 1
2998
3002
}
2999
3003
3000
3004
override AccessPathFrontHead getFront ( ) { result = TFrontHead ( head ) }
0 commit comments