Conversation
|
LGTM
What's our biggest benchmark with mutexes? Could compare |
I tried it on I remember when I did the tracing outputs above, that between the two side effects there was Based on single runs on that benchmark it went 11.4s → 11.0s, but this could be a total coincidence as well. I might do a complete rerun with this change on the traces paper benchmarks to get a wider view, but I don't expect there to be too big of a difference. |
|
LGTM as well! |
|
As an extra sanity check I reran the SAS21 benchmarks with this change merged in. The relative time differences are here:
So there is some general performance improvement, which is more pronounced on some benchmarks. |
As I mentioned in #211 (comment),
MCP2intends to group side effects from multiple analyses to the same global variable together. I guess the intent is to make onesidegcall to the solver with all theDomListLatticecomponents filled instead of doing multiplesidegcalls where each one has aDomListLatticewith just a single non-botcomponent.Before
When tracing some #183 things, I noticed that this doesn't seem to be happening. For example on this line with lockset {mutex1}:
analyzer/tests/regression/13-privatized/01-priv_nr.c
Line 13 in 4feae9f
The solver first gets a side effect from mutex analysis:
After which some "init", "side widen" and "destabilize" take place. And after that the solver gets a separate side effect from base analysis:
This isn't supposed to be happening because they both happen during the same
MCP2.assignevaluation: base side effects the unprotected value, mutex side effects the protecting locksets.Problem
Mutex analysis side effects the protecting locksets in
part_access, which is since #162 called byquery:analyzer/src/analyses/mutexAnalysis.ml
Lines 78 to 87 in 4feae9f
This query is made in the
ctxgiven to mutex analysis'sassign:analyzer/src/analyses/mutexAnalysis.ml
Lines 151 to 155 in 4feae9f
The
ctxfor theassignof mutex analysis is defined inMCP2to doaskviaqueryinMCP2:analyzer/src/analyses/mCP.ml
Lines 560 to 573 in 4feae9f
As the last snippet of code shows, whatever side effects that
querymakes, they don't get added into thesideslist inassign, which is what is later grouped. That's why the access side effects bypass this grouping. I checked back at #162 and this behavior was present even before that change, so that PR didn't introduce this.After
This is easily fixed by forbidding
sideginqueryand moving that part ofpart_accessaround to record the lockset with theassign'sctx, not thequeryone. Since access partitioning was refactored in #162, this has been a roundabout way to record the access anyway. No other queries usesideganyway.After these changes, the two side effects do get properly grouped:
I don't know whether this might slightly improve performance due to the solver not having to destabilize the same things multiple times.