Slava Pestov
25252cd683
Merge pull request #77728 from slavapestov/cg-cleanup
...
Sema: Small ConstraintGraph cleanup
2024-11-20 19:43:42 -05:00
Slava Pestov
7fef225c9f
Sema: Allow turning off expression timer with -solver-expression-time-threshold=0
2024-11-20 13:46:19 -05:00
Slava Pestov
c8415aeac4
Sema: Record the trail step count in solver statistics
...
Also introduce two new frontend flags:
The -solver-scope-threshold flag sets the maximum number of scopes, which was
previously hardcoded to 1 million.
The -solver-trail-threshold flag sets the maximum number of trail steps,
which defaults to 64 million.
2024-11-20 13:46:19 -05:00
Slava Pestov
60d34a4162
Sema: Micro-optimize PotentialBindings
...
PotentialBindings is part of ConstraintGraphNode and there's no need
to store the ConstraintSystem and TypeVariableType twice.
Also it doesn't need to be optional either, because we no longer need
to reset and recompute bindings.
2024-11-20 13:35:22 -05:00
Slava Pestov
1a18d70f90
Sema: Remove ConstraintSystem::SolverState::isRecordingChanges()
...
All but two remaining call sites can be changed to just check for a
non-null solverState, because we want to assert if we're inside
of an active undo.
The two places inside binding inference can check isUndoActive()
directly.
2024-11-20 13:35:22 -05:00
Slava Pestov
de731b4d5d
Sema: Preserve insertion order in Solution::typeBindings
2024-11-20 11:47:07 -05:00
Slava Pestov
a7b1e7854c
Merge pull request #77174 from slavapestov/fix-undo-order
...
Sema: Undo changes in chronological order in SolverTrail::undo()
2024-11-20 08:00:53 -05:00
Slava Pestov
1a60685292
Sema: Address the FIXME in ConstraintGraph::mergeNodes()
2024-11-19 21:24:12 -05:00
Slava Pestov
1ecba36e76
Sema: Cache Solution::getTotalMemory()
...
This is showing up in performance profiles.
2024-11-19 16:04:57 -05:00
Slava Pestov
09df48f9fb
Sema: Remove DenseMap usage when opening types
2024-11-18 11:40:38 -05:00
Slava Pestov
47156e006b
AST: Introduce ProtocolConformanceRef::forAbstract()
2024-11-16 16:16:06 -05:00
Pavel Yaskevich
bc949c3680
[CSBindings] Don't favor application result types before application happens
...
Until `ApplicableFunction` constraint is simplified result type
associated with it cannot be bound because the binding set if
incomplete.
Resolves: rdar://139237088
2024-11-08 14:00:01 -08:00
Doug Gregor
720429daf4
[Constraint solver] Disable fallback diagnostic when error emitted into a transaction
...
When we are using diagnostic transactions to disable immediate emission
of diagnostics, `DiagnosticEngine::hadAnyError()` no longer accurately
reports whether an error occurred. Thread the DiagnosticTransaction
into the ConstraintSystem so we can also check whether it contains an
error before emitting the fallback diagnostic.
Fixes rdar://128272346.
2024-11-06 17:07:13 -08:00
Pavel Yaskevich
6109463cce
[ConstraintSystem] NFC: Rename threshold in ExpressionTimer to clarify granularity
...
The variable was named incorrectly, it's actually expressed in seconds.
2024-10-28 17:29:01 -07:00
Slava Pestov
3400022c63
Sema: Remove ConstraintKind::SelfObjectOfProtocol
2024-10-22 20:14:43 -04:00
Slava Pestov
c728c2aa8b
Sema: Simplify doesStorageProduceLValue()
2024-10-22 20:14:43 -04:00
Slava Pestov
6c02529cf8
Sema: Simplify ConstraintSystem::getUnopenedTypeOfReference()
2024-10-22 20:14:43 -04:00
Slava Pestov
53794d3b6a
Sema: Rename ConstraintSystem::generateConstraints() to ConstraintSystem::generateOverloadConstraints()
2024-10-22 20:14:43 -04:00
Slava Pestov
58a6a64647
Sema: SolverTrail::Change::RetiredConstraint now remembers the position
2024-10-21 17:19:01 -04:00
Slava Pestov
38fe0696a4
Sema: Factor out clearScore() and replayScore()
2024-10-09 11:48:07 -04:00
Slava Pestov
c8db9f55e6
Sema: Remove last heap allocation of Scope
2024-10-09 11:48:07 -04:00
Slava Pestov
0b85ce6f00
Sema: Remove SolverScope::numFixes
2024-10-08 16:57:49 -04:00
Slava Pestov
5fdc1a81b8
Sema: Record retired constraints in the trail
2024-10-08 16:39:34 -04:00
Slava Pestov
90175400d2
Sema: Record generated constraints in the trail
2024-10-08 16:17:28 -04:00
Slava Pestov
1e2d4fbc59
Sema: Record score increases in the trail
2024-10-08 16:16:31 -04:00
Slava Pestov
877c60e3d0
Sema: Rename applySolution() to replaySolution()
2024-10-08 16:16:01 -04:00
Slava Pestov
1323953219
Sema: Try not to make a negative impact
2024-10-08 16:14:05 -04:00
Slava Pestov
e47f9966ad
Sema: ConstraintSystem::openType() uses TypeTransform
2024-10-07 17:46:40 -04:00
Slava Pestov
4a82d384b7
Sema: Record synthesized conformances in the trail
2024-10-07 16:50:49 -04:00
Slava Pestov
12eb7cec26
Sema: Record implicit callAsFunction() roots in the trail
2024-10-07 16:50:49 -04:00
Slava Pestov
72a60728fc
Sema: Record argument lists in the trail
2024-10-07 16:50:49 -04:00
Slava Pestov
f2412f318e
Sema: Record key path expressions in the trail
2024-10-07 16:50:48 -04:00
Slava Pestov
881a0100b2
Sema: Record implicit value conversions in the trail
2024-10-07 16:50:48 -04:00
Slava Pestov
ac17292dfe
Sema: Record preconcurrency closures in the trail
2024-10-07 16:50:48 -04:00
Slava Pestov
b961a7ec51
Sema: Record isolated parameters in the trail
2024-10-07 16:50:48 -04:00
Slava Pestov
1d177d0187
Sema: Record expression patterns in the trail
2024-10-07 16:50:48 -04:00
Slava Pestov
500acd122a
Sema: Record potential throw sites in the trail
2024-10-07 16:50:47 -04:00
Slava Pestov
39d0eab275
Sema: Record case label items in the trail
2024-10-07 16:50:47 -04:00
Slava Pestov
8c8a385a4a
Sema: Record SyntacticElementTargetKeys in the trail
2024-10-07 16:50:47 -04:00
Slava Pestov
516277f0fd
Sema: Record contextual types in the trail
2024-10-07 16:50:47 -04:00
Slava Pestov
666361adf2
Sema: Record implied results in the trail
2024-10-07 16:50:47 -04:00
Slava Pestov
1d18cd07cf
Sema: Record closure types in the trail
2024-10-07 16:50:47 -04:00
Slava Pestov
43a4ac9216
Sema: Record resolved overloads in the trail
2024-10-07 16:50:46 -04:00
Slava Pestov
892e79cd70
Sema: Use an xmacro to clean up some duplication in CSTrail.cpp
2024-10-07 16:50:46 -04:00
Slava Pestov
6862955244
Sema: Record applied property wrappers in the trail
2024-10-07 16:50:46 -04:00
Slava Pestov
c7edc3494e
Sema: Record result builder transforms in the trail
2024-10-07 16:50:45 -04:00
Slava Pestov
64293ece51
Sema: Push reconciliation down into applySolution() to strengthen invariants
...
Now, we assert if you try to record the same change twice in any
other code path.
2024-10-07 16:50:45 -04:00
Slava Pestov
61575d9913
Sema: Remove a few isRecordingChanges() checks to tighten invariants
...
In these places we now assert if we attempt to record a change
during an active undo.
2024-10-07 16:50:45 -04:00
Slava Pestov
9115a46736
Sema: Record favored constraints in the trail
2024-10-07 16:50:45 -04:00
Slava Pestov
b2adf51d78
Sema: Record disabled constraints in the trail
2024-10-07 16:50:45 -04:00