Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4b5905c

Browse files
committed
Dataflow: Risky! Remove fwdFlowLocalEntry.
This commit is a little bit risky, as it allows for some potentially bad join-orders. The best order starts with the delta and proceeds with the then functional `mid.getEnclosingCallable()` and `getLocalCallContext`. In this order `localFlowEntry` becomes superfluous. The standard order is however somewhat unwilling to choose this. If it picks `getLocalCallContext` and `getEnclosingCallable` as the first join, the result is really bad, but it appears that the existence of `localFlowEntry` at least means that it'll do `localFlowEntry`, `getEnclosingCallable`, `getLocalCallContext` in that order, which appears to be acceptable, although it isn't optimal. Without the `localFlowEntry` conjunct we end up with the worst case. We'll need to watch this particular join-ordering until we get better join-ordering directives.
1 parent 19a9285 commit 4b5905c

1 file changed

Lines changed: 26 additions & 32 deletions

File tree

java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl.qll

Lines changed: 26 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1945,33 +1945,36 @@ private module Stage4 {
19451945
argAp = apNone() and
19461946
ap = getApNil(node)
19471947
or
1948-
flowCand(node, _, unbind(config)) and
1949-
(
1950-
exists(Node mid, LocalCallContext localCC |
1951-
fwdFlowLocalEntry(mid, cc, argAp, ap, localCC, config) and
1952-
localFlowBigStep(mid, node, true, _, config, localCC)
1953-
)
1948+
exists(Node mid, Ap ap0, LocalCallContext localCC |
1949+
fwdFlow(mid, cc, argAp, ap0, config) and
1950+
localFlowEntry(mid, config) and
1951+
localCC = getLocalCallContext(cc, mid.getEnclosingCallable())
1952+
|
1953+
localFlowBigStep(mid, node, true, _, config, localCC) and
1954+
ap = ap0
19541955
or
1955-
exists(Node mid, ApNil nil, LocalCallContext localCC, AccessPathFront apf |
1956-
fwdFlowLocalEntry(mid, cc, argAp, nil, localCC, config) and
1956+
exists(AccessPathFront apf |
19571957
localFlowBigStep(mid, node, false, apf, config, localCC) and
1958+
ap0 instanceof ApNil and
19581959
apf = ap.(ApNil).getFront()
19591960
)
1960-
or
1961-
exists(Node mid |
1962-
fwdFlow(mid, _, _, ap, config) and
1963-
jumpStep(mid, node, config) and
1964-
cc = ccAny() and
1965-
argAp = apNone()
1966-
)
1967-
or
1968-
exists(Node mid, ApNil nil |
1969-
fwdFlow(mid, _, _, nil, config) and
1970-
additionalJumpStep(mid, node, config) and
1971-
cc = ccAny() and
1972-
argAp = apNone() and
1973-
ap = getApNil(node)
1974-
)
1961+
)
1962+
or
1963+
exists(Node mid |
1964+
fwdFlow(mid, _, _, ap, config) and
1965+
flowCand(node, _, unbind(config)) and
1966+
jumpStep(mid, node, config) and
1967+
cc = ccAny() and
1968+
argAp = apNone()
1969+
)
1970+
or
1971+
exists(Node mid, ApNil nil |
1972+
fwdFlow(mid, _, _, nil, config) and
1973+
flowCand(node, _, unbind(config)) and
1974+
additionalJumpStep(mid, node, config) and
1975+
cc = ccAny() and
1976+
argAp = apNone() and
1977+
ap = getApNil(node)
19751978
)
19761979
or
19771980
// store
@@ -2004,15 +2007,6 @@ private module Stage4 {
20042007
)
20052008
}
20062009

2007-
pragma[nomagic]
2008-
private predicate fwdFlowLocalEntry(
2009-
Node node, Cc cc, ApOption argAp, Ap ap, LocalCallContext localCC, Configuration config
2010-
) {
2011-
fwdFlow(node, cc, argAp, ap, config) and
2012-
localFlowEntry(node, config) and
2013-
localCC = getLocalCallContext(cc, node.getEnclosingCallable())
2014-
}
2015-
20162010
pragma[nomagic]
20172011
private predicate fwdFlowStore(
20182012
Node node, TypedContent tc, Ap ap0, Cc cc, ApOption argAp, Configuration config

0 commit comments

Comments
 (0)