Commit Graph

17887 Commits

Author SHA1 Message Date
Anders Schack-Mulligen
d324cd1844 Dataflow: Some qldoc. 2020-11-13 15:09:30 +01:00
Anders Schack-Mulligen
293429f821 Dataflow: Make a bunch of the interface predicates private. 2020-11-13 15:09:30 +01:00
Anders Schack-Mulligen
d028e6b334 Dataflow: Change some headUsesContent to getHead. 2020-11-13 15:09:30 +01:00
Anders Schack-Mulligen
aa66b9bb48 Dataflow: Align more predicates. 2020-11-13 15:09:30 +01:00
Anders Schack-Mulligen
6e6e5d6414 Dataflow: Renamings. 2020-11-13 15:09:29 +01:00
Anders Schack-Mulligen
786edbf045 Dataflow: Align on parameterMayFlowThrough.
This actually provides a decent pruning improvement in stages 3 and 4.
2020-11-13 15:09:29 +01:00
Anders Schack-Mulligen
15bf1b1026 Dataflow: Rename some stage 1 predicates. 2020-11-13 15:09:29 +01:00
Anders Schack-Mulligen
af54afa24b Dataflow: Add stage statistics. 2020-11-13 15:09:29 +01:00
Anders Schack-Mulligen
8b5e452728 Dataflow: Improve cons-cand relation.
Post-recursion we can filter the forward cons-candidates to only include
those that met a read step, and similarly restrict the reverse flow
cons-candidates to those that met a store step.
2020-11-13 15:09:29 +01:00
Anders Schack-Mulligen
e4fb41507b Dataflow: Reshuffle some predicates. 2020-11-13 15:09:29 +01:00
Anders Schack-Mulligen
5a1c0e9ec4 Dataflow: Get rid of early filter.
This constructs a few more tuples in Stage3::fwdFlow0, which are then
filtered in Stage3::fwdFlow. This is cleaner and appears faster.
2020-11-13 15:09:29 +01:00
Anders Schack-Mulligen
3e18e02d2c Dataflow: Refactor step predicate in fwdFlowRead. 2020-11-13 15:09:29 +01:00
Anders Schack-Mulligen
c5a2c261dc Dataflow: Refactor forward store step relation. 2020-11-13 15:09:29 +01:00
Anders Schack-Mulligen
b6f1ab6429 Dataflow: Refactor step relation in revFlowStore. 2020-11-13 15:09:29 +01:00
Anders Schack-Mulligen
12fe38bcb6 Dataflow: Reorder, rename, and add columns to store-flow. 2020-11-13 15:09:29 +01:00
Anders Schack-Mulligen
aa28fdb83d Dataflow: Align some qldoc. 2020-11-13 15:09:29 +01:00
Anders Schack-Mulligen
0a4c680e17 Dataflow: Align on localStep. 2020-11-13 15:09:29 +01:00
Anders Schack-Mulligen
4b5905c5e0 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.
2020-11-13 15:09:29 +01:00
Anders Schack-Mulligen
19a9285d00 Dataflow: Reshuffle a few conjuncts. 2020-11-13 15:09:29 +01:00
Anders Schack-Mulligen
7a95466241 Dataflow: Remove superfluous conjuncts. 2020-11-13 15:09:28 +01:00
Anders Schack-Mulligen
03ef9d00ec Dataflow: Refactor call contexts. 2020-11-13 15:09:28 +01:00
Anders Schack-Mulligen
dc2b2cc13f Dataflow: Some renamings. 2020-11-13 15:09:28 +01:00
Anders Schack-Mulligen
d037909c7b Dataflow: Minor reorderings and renamings. 2020-11-13 15:09:28 +01:00
Anders Schack-Mulligen
00d726de3f Dataflow: Refactor stage 4 read and stores. 2020-11-13 15:09:28 +01:00
Anders Schack-Mulligen
2afc572a34 Dataflow: Refactor stage 2 read and stores. 2020-11-13 15:09:28 +01:00
Anders Schack-Mulligen
b0e5925fea Dataflow: Refactor stage 3 conscand predicates. 2020-11-13 15:09:28 +01:00
Anders Schack-Mulligen
261ef0fbff Dataflow: Refactor forward stores and remove some useless conjuncts. 2020-11-13 15:09:28 +01:00
Anders Schack-Mulligen
628e0a795a Dataflow: A few variable renamings. 2020-11-13 15:09:28 +01:00
Anders Schack-Mulligen
bfd8a3d104 Dataflow: Rename stage 2 cons-cand predicates. 2020-11-13 15:09:28 +01:00
Anders Schack-Mulligen
0a60a3abb3 Dataflow: Align on ApNil. 2020-11-13 15:09:28 +01:00
Anders Schack-Mulligen
60b51011b9 Dataflow: Minor refactor of Stage2::revFlow. 2020-11-13 15:09:28 +01:00
Anders Schack-Mulligen
c054295347 Dataflow: Rename option type branches. 2020-11-13 15:09:28 +01:00
Anders Schack-Mulligen
7eeae49e06 Dataflow: Remove AccessPathFront column.
This column is functionally determined from the access path, and was
merely included to help with some join-orders that no longer appear
problematic.
2020-11-13 15:09:28 +01:00
Anders Schack-Mulligen
1fe423550f Dataflow: Stage comments and some formatting. 2020-11-13 15:09:27 +01:00
Anders Schack-Mulligen
586d52fac0 Dataflow: More renaming. 2020-11-13 15:09:27 +01:00
Anders Schack-Mulligen
3f25df902f Dataflow: Rename some types and variables. 2020-11-13 15:09:27 +01:00
Anders Schack-Mulligen
f3f968ce6d Dataflow: Rename predicates. 2020-11-13 15:09:27 +01:00
Anders Schack-Mulligen
aab5263c6a Dataflow: Add modules. 2020-11-13 15:09:22 +01:00
yoff
26286e534e Merge pull request #4174 from yoff/SharedDataflow_PointsToImpliesDataflow
Python: Dataflow, Test that `pointsTo` implies data flow
merging now, will fix `self` in a later PR
2020-11-10 10:25:29 +01:00
CodeQL CI
1e048d8045 Merge pull request #4609 from asgerf/js/destructuring-export
Approved by erik-krogh
2020-11-09 15:47:00 +00:00
Anders Schack-Mulligen
31ec79819e Merge pull request #4631 from luchua-bc/java-nfe-library
Java: Factor NumberFormatException out into a library file
2020-11-09 13:50:31 +01:00
yoff
3215f50b73 Merge pull request #4632 from RasmusWL/python-move-configurations-out-of-queries
Python: move configurations out of queries
2020-11-09 13:10:33 +01:00
luchua-bc
d765c7bbb2 Update qldoc 2020-11-09 11:23:48 +00:00
Asger Feldthaus
32c5bc4836 JS: Update test case output (new flow is correct) 2020-11-09 11:19:47 +00:00
Mathias Vorreiter Pedersen
25ba6ca160 Merge pull request #4637 from jbj/temp-objects-perf-fixup
C++: pragma[noinline] parameter index predicates
2020-11-09 10:12:50 +01:00
Rasmus Wriedt Larsen
fbe51c51bb Python: Add missing QLDoc 2020-11-09 09:05:08 +01:00
Jonas Jensen
b8b1f0c617 C++: pragma[noinline] parameter index predicates
A performance regression in `definitionByReferenceNodeFromArgument#ff`
was ultimately caused by a join on parameter indexes in
`DefinitionByReferenceNode.getArgument`. Joining on numbers in QL is
always fragile, and somehow the changes in #4432 had caused the join
order here to break.

Instead of tweaking the join order in the slow predicate itself, I added
`pragma[noinline]` to one of the predicates involved in the join on
parameter indexes. This should prevent us from getting similar
performance problems in the future when we write code that joins on
parameter numbers. Joining on indexes is always risky, but it's even
more risky when one of the predicates in the join is inlined by the
compiler and expands to further joins.

I tested performance by running `CgiXss.ql` on a ChakraCore snapshot.
Tuple counts before (I interrupted execution after five minutes or so):

    (626s) Tuple counts for DataFlowUtil::definitionByReferenceNodeFromArgument#ff:
    58162      ~0%     {3} r1 = SCAN DataFlowUtil::DefinitionByReferenceNode#class#ff AS I OUTPUT I.<1>, -1, I.<0>
    26934      ~0%     {2} r2 = JOIN r1 WITH Instruction::IndexedInstruction#ff AS R ON FIRST 2 OUTPUT r1.<0>, r1.<2>
    26934      ~1%     {2} r3 = JOIN r2 WITH Instruction::SideEffectInstruction::getPrimaryInstruction_dispred#3#ff AS R ON FIRST 1 OUTPUT R.<1>, r2.<1>
    26850      ~1%     {2} r4 = JOIN r3 WITH Instruction::CallInstruction::getThisArgumentOperand_dispred#ff AS R ON FIRST 1 OUTPUT R.<1>, r3.<1>
    26850      ~0%     {2} r5 = JOIN r4 WITH Operand::Operand::getDef_dispred#3#ff AS R ON FIRST 1 OUTPUT R.<1>, r4.<1>
    26850      ~1%     {2} r6 = JOIN r5 WITH Instruction::Instruction::getUnconvertedResultExpression_dispred#ff AS R ON FIRST 1 OUTPUT R.<1>, r5.<1>
    58162      ~0%     {2} r7 = SCAN DataFlowUtil::DefinitionByReferenceNode#class#ff AS I OUTPUT I.<1>, I.<0>
    58162      ~4%     {3} r8 = JOIN r7 WITH Instruction::IndexedInstruction#ff AS R ON FIRST 1 OUTPUT R.<1>, r7.<1>, r7.<0>
    4026581120 ~0%     {4} r9 = JOIN r8 WITH Instruction::CallInstruction::getPositionalArgumentOperand_dispred#fff_102#join_rhs AS R ON FIRST 1 OUTPUT r8.<2>, R.<1>, r8.<1>, R.<2>
    31154      ~4%     {2} r10 = JOIN r9 WITH Instruction::SideEffectInstruction::getPrimaryInstruction_dispred#3#ff AS R ON FIRST 2 OUTPUT r9.<3>, r9.<2>
    31154      ~8%     {2} r11 = JOIN r10 WITH Operand::Operand::getDef_dispred#3#ff AS R ON FIRST 1 OUTPUT R.<1>, r10.<1>
    31154      ~0%     {2} r12 = JOIN r11 WITH Instruction::Instruction::getUnconvertedResultExpression_dispred#ff AS R ON FIRST 1 OUTPUT R.<1>, r11.<1>
    58004      ~0%     {2} r13 = r6 \/ r12
                       return r13

Tuple counts after:

    (0s) Tuple counts for DataFlowUtil::definitionByReferenceNodeFromArgument#ff:
    385785  ~6%     {2} r1 = SCAN DataFlowUtil::DefinitionByReferenceNode#class#ff AS I OUTPUT I.<1>, I.<0>
    385785  ~0%     {3} r2 = JOIN r1 WITH Instruction::IndexedInstruction#ff AS R ON FIRST 1 OUTPUT r1.<0>, r1.<1>, R.<1>
    385785  ~1%     {3} r3 = JOIN r2 WITH Instruction::SideEffectInstruction::getPrimaryInstruction_dispred#3#ff AS R ON FIRST 1 OUTPUT R.<1>, r2.<2>, r2.<1>
    198736  ~4%     {2} r4 = JOIN r3 WITH Instruction::CallInstruction::getPositionalArgument#fff AS R ON FIRST 2 OUTPUT R.<2>, r3.<2>
    198736  ~0%     {2} r5 = JOIN r4 WITH Instruction::Instruction::getUnconvertedResultExpression_dispred#ff AS R ON FIRST 1 OUTPUT R.<1>, r4.<1>
    385785  ~1%     {3} r6 = SCAN DataFlowUtil::DefinitionByReferenceNode#class#ff AS I OUTPUT I.<1>, -1, I.<0>
    186891  ~1%     {2} r7 = JOIN r6 WITH Instruction::IndexedInstruction#ff AS R ON FIRST 2 OUTPUT r6.<0>, r6.<2>
    186891  ~2%     {2} r8 = JOIN r7 WITH Instruction::SideEffectInstruction::getPrimaryInstruction_dispred#3#ff AS R ON FIRST 1 OUTPUT R.<1>, r7.<1>
    183201  ~3%     {2} r9 = JOIN r8 WITH Instruction::CallInstruction::getThisArgumentOperand_dispred#ff AS R ON FIRST 1 OUTPUT R.<1>, r8.<1>
    183201  ~0%     {2} r10 = JOIN r9 WITH Operand::Operand::getDef_dispred#3#ff AS R ON FIRST 1 OUTPUT R.<1>, r9.<1>
    175449  ~8%     {2} r11 = JOIN r10 WITH Instruction::Instruction::getUnconvertedResultExpression_dispred#ff AS R ON FIRST 1 OUTPUT R.<1>, r10.<1>
    374185  ~3%     {2} r12 = r5 \/ r11
                    return r12
2020-11-09 09:01:22 +01:00
Rasmus Wriedt Larsen
ed0e4f8425 Python: reasoning about => detecting
Co-authored-by: yoff <lerchedahl@gmail.com>
2020-11-09 09:01:04 +01:00
luchua-bc
d568eb635f Update qldoc 2020-11-06 15:33:26 +00:00
yoff
45317bcec9 Update python/ql/test/library-tests/PointsTo/new/code/w_function_values.py
Co-authored-by: Rasmus Wriedt Larsen <rasmuswriedtlarsen@gmail.com>
2020-11-06 15:03:20 +01:00