Commit Graph

3471 Commits

Author SHA1 Message Date
Nick Rolfe
1e1eb7ee33 Replace getEncodedFile with shared getFileBySourceArchiveName predicate
While also making it work with paths for databases created on Windows.
2020-11-10 13:55:27 +00:00
Anders Schack-Mulligen
89ef6ea4eb C++/C#/Java/JavaScript/Python: Autoformat set literals. 2020-11-10 13:32:27 +01:00
Tom Hvitved
697b0ba4c1 C#: Address review comments 2020-11-10 10:42:05 +01:00
Robert Marsh
c00587d2cb C++/C#: Conflated memory as IR dump annotation
Removes the IR consistency checks for conflated memory and marks
instructions that have a conflated result with a percent sign (%)
instead. This avoids reimplementing part of the alias analysis logic
in the consistency check.
2020-11-09 14:55:47 -08: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
Tom Hvitved
10ab3304c1 Merge pull request #4575 from hvitved/csharp/cfg/post-dominance
C#: Restrict post-dominance to normal execution
2020-11-05 15:31:13 +01:00
Robert Marsh
2f204869e7 Merge pull request #4604 from criemen/ir-block-sort-order
C++, C# IR: Stabilize sort order for basic blocks.
2020-11-04 18:22:23 -05:00
Tom Hvitved
1ba9e29a40 C#: Precise data flow for EntityFramework(Core) 2020-11-04 19:48:03 +01:00
Tom Hvitved
b5063bbcb5 Merge pull request #4495 from hvitved/csharp/dataflow/summaries
C#: Shared interface/implementation for flow summaries
2020-11-04 17:02:19 +01:00
Cornelius Riemenschneider
44d6584fa2 C++, C#: Auto-format. 2020-11-04 16:26:56 +01:00
Cornelius Riemenschneider
a13947424a C++, C# IR: Stabilize sort order for basic blocks. 2020-11-04 16:26:56 +01:00
Tom Hvitved
c5abf29dfc C#: Update flow-summary test 2020-11-03 20:28:42 +01:00
Dave Bartolomeo
f0b9794907 Merge remote-tracking branch 'upstream/main' into work 2020-11-03 11:33:44 -05:00
Tom Hvitved
438b8dd273 C#: Fix typos 2020-11-03 14:57:07 +01:00
Tom Hvitved
f4d1d73bcd C#: Shared interface/implementation for flow summaries 2020-11-03 13:47:28 +01:00
Anders Schack-Mulligen
2971784f9c Dataflow: Add missing qldoc and sync. 2020-11-03 09:21:48 +01:00
Anders Schack-Mulligen
7eb64aa998 Dataflow: Code review fixes. 2020-11-03 09:16:20 +01:00
Anders Schack-Mulligen
1ae76a80aa Dataflow: Fix qldoc. 2020-11-03 09:16:20 +01:00
Anders Schack-Mulligen
d5be4d7b92 Dataflow: Add support reverse partial flow exploration. 2020-11-03 09:16:19 +01:00
Dave Bartolomeo
e9d1f0dacf Merge remote-tracking branch 'upstream/main' into work 2020-11-02 17:31:15 -05:00
Robert Marsh
0e4d69709f C++/C#: autoformat 2020-11-02 14:00:53 -08:00
Tom Hvitved
e89a463b25 C#: Fix bad join-order in commonSubTypeGeneral/2 2020-11-01 20:08:14 +01:00
Dave Bartolomeo
42373417e2 Merge from main 2020-10-30 12:02:56 -04:00
Tom Hvitved
6723e5b31c C#: Restrict post-dominance to normal execution 2020-10-30 09:14:12 +01:00
Robert Marsh
7e8770d731 C#: Remove reference to InitializeNonLocal in IR 2020-10-29 16:08:23 -07:00
Tom Hvitved
51f71d4e1d C#: Fix CFG for assertions with multiple assertion arguments 2020-10-29 15:44:13 +01:00
Tamás Vajk
64dcfbd7fc Merge pull request #4484 from tamasvajk/feature/custom-assert-methods
C#: Add support for custom assert methods (DoesNotReturnIfAttribute)
2020-10-29 09:10:09 +01:00
Dave Bartolomeo
7a2c59c194 Merge from main 2020-10-28 15:35:46 -04:00
Tamas Vajk
410af42d2b C#: Adjust PR feedback on assertion methods 2020-10-28 15:09:50 +01:00
Tamás Vajk
59d9be48a7 Merge pull request #4438 from tamasvajk/feature/ast-fixes
C#: Fixes for AST printing
2020-10-28 14:52:24 +01:00
Tom Hvitved
2fea6f05f1 Merge pull request #4489 from hvitved/csharp/cil-to-string
C#: Simplify `toString()` for CIL entities
2020-10-28 12:56:10 +01:00
Tamas Vajk
1830eea50a C#: Cleanup TypeMentions in AST printing 2020-10-28 12:34:12 +01:00
Tamas Vajk
444b100c51 Minor fix in definitions.qll 2020-10-28 12:23:12 +01:00
Tamas Vajk
a9e93e5681 C#: Fix GenericType locations in jump-to-definition 2020-10-28 12:07:27 +01:00
Tamas Vajk
9cc7424cd0 C#: Simplify TypeMentions in PrintAST 2020-10-28 11:28:06 +01:00
Tom Hvitved
28607927ee C#: Update CIL tests 2020-10-28 10:57:01 +01:00
Tamás Vajk
7c3964a388 Merge pull request #4543 from tamasvajk/feature/configureawait
C#: Add flow summary for 'Task.ConfigureAwait()'
2020-10-28 10:42:44 +01:00
Tamas Vajk
7a1e1996e4 C#: Remove unneded class from CompilerServices.qll 2020-10-28 08:42:20 +01:00
Tom Hvitved
de4ed59f62 C#: Simplify toString() for CIL entities 2020-10-27 20:58:40 +01:00
Tom Hvitved
090ea01249 C#: Fix bad join-order in System.Tuple flow-summaries 2020-10-27 14:51:11 +01:00
Tamas Vajk
342a711296 C#: Add flow summary for 'Task.ConfigureAwait()' 2020-10-27 10:23:39 +01:00
Tom Hvitved
212b49f3dc Merge pull request #4416 from hvitved/csharp/dataflow/tuples
C#: Add flow summaries for `System.[Value]Tuple`
2020-10-26 13:48:24 +01:00
Chris Smowton
68876b02fe Merge pull request #4519 from smowton/smowton/cleanup/loggertype-dead-code
C#: Remove dead LoggerType class
2020-10-26 11:19:27 +00:00
Tom Hvitved
492b1141ef Merge pull request #4445 from hvitved/csharp/sign-analysis-cfg
C#: Use CFG nodes instead of AST nodes in sign/modulus analysis
2020-10-26 09:45:38 +01:00
Robert Marsh
1a365d2098 C++: remove InitializeNonLocalInstruction from IR
Instead, have AliasedDefinition initialize read-only nonlocal memory
2020-10-21 12:12:38 -07:00
Dave Bartolomeo
735c657326 IR consistency checks for FieldAddress and this arguments that are not actually addresses.
Exposes failures in existing tests. Also added a small test case for `FieldAddress` on a prvalue.
2020-10-20 10:32:28 -04:00
Chris Smowton
af6da85ec9 Remove dead LoggerType class
This appears to have been factored into Loggers.qll but left lying around.
2020-10-20 13:32:11 +01:00
Tamas Vajk
dad5166bca C#: Print full name of type mentions in AST 2020-10-20 08:23:57 +02:00
Tamas Vajk
7066568813 C#: Change type access and expression order in casts for AST printing 2020-10-20 08:23:56 +02:00
Tamas Vajk
6c48eb8c12 C#: Add type mentions to AST 2020-10-20 08:23:56 +02:00