Commit 77c85a6
authored
Address severe performance regression in dataflow analysis (#1328)
Fixes #1327
#1309 introduced a severe performance regression in dataflow analysis,
as the result of running the dataflow analysis was no longer being
cached. This caused a >100X slowdown in our dataflow micro-benchmark!
(Which we really should have measured before landing #1309...)
This PR re-introduces the cache for analysis results (by tracking when
we have already run the analysis). This fix exposed some other bugs in
generic method inference where we weren't passing around the right
`TreePath` to enable discovery of appropriate assignment contexts and
containing methods; we fix those bugs here too.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* More precise nullness inference for generic method returns in JSpecify
mode by using invocation context when available.
* **Bug Fixes**
* Prevents redundant dataflow analyses by tracking already-run analyses;
cache invalidation resets this tracking.
* Behavior changes are internal only; public API remains unchanged.
* **Tests**
* Updated test setup and expected diagnostics to reflect refined generic
inference and nullability behavior.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->1 parent 38a7561 commit 77c85a6
4 files changed
Lines changed: 55 additions & 21 deletions
File tree
- nullaway/src
- main/java/com/uber/nullaway
- dataflow
- generics
- test/java/com/uber/nullaway/jspecify
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2720 | 2720 | | |
2721 | 2721 | | |
2722 | 2722 | | |
2723 | | - | |
2724 | | - | |
2725 | | - | |
2726 | | - | |
2727 | | - | |
2728 | | - | |
2729 | | - | |
2730 | | - | |
| 2723 | + | |
| 2724 | + | |
| 2725 | + | |
| 2726 | + | |
| 2727 | + | |
| 2728 | + | |
| 2729 | + | |
| 2730 | + | |
| 2731 | + | |
| 2732 | + | |
| 2733 | + | |
| 2734 | + | |
| 2735 | + | |
| 2736 | + | |
| 2737 | + | |
| 2738 | + | |
| 2739 | + | |
2731 | 2740 | | |
2732 | 2741 | | |
2733 | 2742 | | |
| |||
Lines changed: 12 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
43 | 45 | | |
44 | 46 | | |
45 | 47 | | |
| |||
93 | 95 | | |
94 | 96 | | |
95 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
96 | 104 | | |
97 | 105 | | |
98 | 106 | | |
| |||
161 | 169 | | |
162 | 170 | | |
163 | 171 | | |
164 | | - | |
| 172 | + | |
165 | 173 | | |
| 174 | + | |
166 | 175 | | |
167 | 176 | | |
168 | | - | |
| 177 | + | |
169 | 178 | | |
170 | 179 | | |
171 | 180 | | |
| |||
313 | 322 | | |
314 | 323 | | |
315 | 324 | | |
| 325 | + | |
316 | 326 | | |
317 | 327 | | |
318 | 328 | | |
| |||
Lines changed: 24 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
519 | 519 | | |
520 | 520 | | |
521 | 521 | | |
522 | | - | |
| 522 | + | |
523 | 523 | | |
524 | 524 | | |
525 | 525 | | |
| |||
551 | 551 | | |
552 | 552 | | |
553 | 553 | | |
| 554 | + | |
| 555 | + | |
554 | 556 | | |
555 | 557 | | |
556 | 558 | | |
| |||
560 | 562 | | |
561 | 563 | | |
562 | 564 | | |
| 565 | + | |
563 | 566 | | |
564 | 567 | | |
565 | 568 | | |
| |||
572 | 575 | | |
573 | 576 | | |
574 | 577 | | |
575 | | - | |
| 578 | + | |
576 | 579 | | |
577 | 580 | | |
578 | 581 | | |
| |||
935 | 938 | | |
936 | 939 | | |
937 | 940 | | |
938 | | - | |
| 941 | + | |
939 | 942 | | |
940 | 943 | | |
941 | 944 | | |
| |||
1080 | 1083 | | |
1081 | 1084 | | |
1082 | 1085 | | |
1083 | | - | |
| 1086 | + | |
1084 | 1087 | | |
1085 | 1088 | | |
1086 | 1089 | | |
| |||
1118 | 1121 | | |
1119 | 1122 | | |
1120 | 1123 | | |
| 1124 | + | |
1121 | 1125 | | |
1122 | 1126 | | |
1123 | 1127 | | |
| |||
1271 | 1275 | | |
1272 | 1276 | | |
1273 | 1277 | | |
1274 | | - | |
| 1278 | + | |
1275 | 1279 | | |
1276 | 1280 | | |
1277 | 1281 | | |
| |||
1280 | 1284 | | |
1281 | 1285 | | |
1282 | 1286 | | |
1283 | | - | |
| 1287 | + | |
1284 | 1288 | | |
1285 | 1289 | | |
1286 | 1290 | | |
| |||
1304 | 1308 | | |
1305 | 1309 | | |
1306 | 1310 | | |
1307 | | - | |
| 1311 | + | |
| 1312 | + | |
1308 | 1313 | | |
1309 | 1314 | | |
1310 | 1315 | | |
| |||
1475 | 1480 | | |
1476 | 1481 | | |
1477 | 1482 | | |
| 1483 | + | |
1478 | 1484 | | |
1479 | 1485 | | |
1480 | 1486 | | |
| |||
1556 | 1562 | | |
1557 | 1563 | | |
1558 | 1564 | | |
1559 | | - | |
| 1565 | + | |
| 1566 | + | |
1560 | 1567 | | |
1561 | 1568 | | |
1562 | 1569 | | |
| |||
1571 | 1578 | | |
1572 | 1579 | | |
1573 | 1580 | | |
| 1581 | + | |
1574 | 1582 | | |
1575 | 1583 | | |
1576 | 1584 | | |
1577 | 1585 | | |
1578 | 1586 | | |
1579 | 1587 | | |
1580 | 1588 | | |
| 1589 | + | |
1581 | 1590 | | |
1582 | 1591 | | |
1583 | 1592 | | |
| |||
1599 | 1608 | | |
1600 | 1609 | | |
1601 | 1610 | | |
| 1611 | + | |
1602 | 1612 | | |
1603 | 1613 | | |
1604 | | - | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
1605 | 1620 | | |
1606 | 1621 | | |
1607 | 1622 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1271 | 1271 | | |
1272 | 1272 | | |
1273 | 1273 | | |
1274 | | - | |
| 1274 | + | |
1275 | 1275 | | |
1276 | 1276 | | |
1277 | 1277 | | |
| |||
1299 | 1299 | | |
1300 | 1300 | | |
1301 | 1301 | | |
1302 | | - | |
| 1302 | + | |
1303 | 1303 | | |
1304 | 1304 | | |
1305 | 1305 | | |
| |||
0 commit comments