Skip to content

Commit eb246f6

Browse files
Performance experiment - add getFunctionFIle for better join order
1 parent 71dec0b commit eb246f6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

python/ql/src/Functions/SignatureOverriddenMethod.ql

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,9 @@ predicate callMatchesSignature(Function func, Call call) {
202202
)
203203
}
204204

205+
pragma[nomagic]
206+
private File getFunctionFile(Function f) { result = f.getLocation().getFile() }
207+
205208
/** Gets a call which matches the signature of `base`, but not of overridden `sub`. */
206209
Call getASignatureMismatchWitness(Function base, Function sub) {
207210
callViableForEitherOverride(base, sub, result) and
@@ -224,17 +227,17 @@ Call chooseASignatureMismatchWitnessInFile(Function base, Function sub, File fil
224227
Call chooseASignatureMismatchWitness(Function base, Function sub) {
225228
exists(getASignatureMismatchWitness(base, sub)) and
226229
(
227-
result = chooseASignatureMismatchWitnessInFile(base, sub, base.getLocation().getFile())
230+
result = chooseASignatureMismatchWitnessInFile(base, sub, getFunctionFile(base))
228231
or
229232
not exists(Call c |
230233
c = getASignatureMismatchWitness(base, sub) and
231234
c.getLocation().getFile() = base.getLocation().getFile()
232235
) and
233-
result = chooseASignatureMismatchWitnessInFile(base, sub, sub.getLocation().getFile())
236+
result = chooseASignatureMismatchWitnessInFile(base, sub, getFunctionFile(sub))
234237
or
235238
not exists(Call c |
236239
c = getASignatureMismatchWitness(base, sub) and
237-
c.getLocation().getFile() = [base, sub].getLocation().getFile()
240+
c.getLocation().getFile() = getFunctionFile([base, sub])
238241
) and
239242
result =
240243
min(Call c |

0 commit comments

Comments
 (0)