You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This replaces "if(x == null) result = false; else { tmp = x->@Clsid; result = (tmp == "A" || tmp == "B" || ...)
with (x != null && (x->@Clsid == "A" || x->@Clsid == "B" || ...))
Advantages:
* The ASSERT/ASSUME pair is more obvious when expressed as a single expression rather than a small if-block,
so when asserts are converted to assumes (e.g. for coverage testing) then the redundant assume can be
spotted and removed.
* By operating directly on a pointer rather than using a temporary (x->@Clsid == "A" rather than id = x->@Clsid; id == "A")
we enable symex's value-set filtering to discard no-longer-viable candidates for "x" (in the case where 'x' is a symbol,
not a general expression like x->y->@Clsid). This means there are more clean dereference operations (ones where there
is no possibility of reading a null, invalid or incorrectly-typed object), and less pessimistic aliasing assumptions
possibly causing goto-symex to explore in-fact-unreachable paths.
* By not creating a small if-block for every instanceof operation, we spare symex from a fork/join sequence with attendant
copying of data structures
Disadvantage:
* By not using a temporary for the class-identifier, we force symex to carry out the dereference multiple times (i.e.
x->@Clsid == "A" || x->@Clsid == "B" will become (x == &o1 ? o1 : o2).@Clsid == "A" || (x == &o1 ? o1 : o2).@Clsid == "B")
This could be expensive if either the alias set or the list of allowable types is long.
0 commit comments