Skip to content

Commit 1dcb06b

Browse files
authored
Merge pull request #19698 from rudkx/designated-protocols
[ConstraintSystem] Use operator designated protocols to speed type checking.
2 parents a2e2166 + 985bcba commit 1dcb06b

18 files changed

+378
-116
lines changed

include/swift/Basic/LangOptions.h

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,6 @@ namespace swift {
122122
/// completions.
123123
bool CodeCompleteCallPatternHeuristics = false;
124124

125-
/// Disable constraint system performance hacks.
126-
bool DisableConstraintSolverPerformanceHacks = false;
127-
128125
///
129126
/// Flags for use by tests
130127
///
@@ -193,6 +190,16 @@ namespace swift {
193190
/// Disable the shrink phase of the expression type checker.
194191
bool SolverDisableShrink = false;
195192

193+
/// Disable constraint system performance hacks.
194+
bool DisableConstraintSolverPerformanceHacks = false;
195+
196+
/// \brief Enable experimental operator protocol designator feature.
197+
bool EnableOperatorDesignatedProtocols = false;
198+
199+
/// \brief Enable constraint solver support for experimental
200+
/// operator protocol designator feature.
201+
bool SolverEnableOperatorDesignatedProtocols = false;
202+
196203
/// The maximum depth to which to test decl circularity.
197204
unsigned MaxCircularityDepth = 500;
198205

@@ -203,9 +210,6 @@ namespace swift {
203210
/// \brief Enable experimental property behavior feature.
204211
bool EnableExperimentalPropertyBehaviors = false;
205212

206-
/// \brief Enable experimental operator protocol designator feature.
207-
bool EnableOperatorDesignatedProtocols = false;
208-
209213
/// \brief Staging flag for treating inout parameters as Thread Sanitizer
210214
/// accesses.
211215
bool DisableTsanInoutInstrumentation = false;

include/swift/Option/FrontendOptions.td

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,6 @@ def debug_time_function_bodies : Flag<["-"], "debug-time-function-bodies">,
197197
def debug_time_expression_type_checking : Flag<["-"], "debug-time-expression-type-checking">,
198198
HelpText<"Dumps the time it takes to type-check each expression">;
199199

200-
def disable_constraint_solver_performance_hacks : Flag<["-"], "disable-constraint-solver-performance-hacks">,
201-
HelpText<"Disable all the hacks in the constraint solver">;
202-
203200
def debug_assert_immediately : Flag<["-"], "debug-assert-immediately">,
204201
DebugCrashOpt, HelpText<"Force an assertion failure immediately">;
205202
def debug_assert_after_parse : Flag<["-"], "debug-assert-after-parse">,
@@ -309,10 +306,6 @@ def enable_experimental_property_behaviors :
309306
Flag<["-"], "enable-experimental-property-behaviors">,
310307
HelpText<"Enable experimental property behaviors">;
311308

312-
def enable_operator_designated_protocols :
313-
Flag<["-"], "enable-operator-designated-protocols">,
314-
HelpText<"Enable operator designated protocols">;
315-
316309
def enable_deserialization_recovery :
317310
Flag<["-"], "enable-deserialization-recovery">,
318311
HelpText<"Attempt to recover from missing xrefs (etc) in swiftmodules">;
@@ -376,6 +369,17 @@ def solver_disable_shrink :
376369
Flag<["-"], "solver-disable-shrink">,
377370
HelpText<"Disable the shrink phase of expression type checking">;
378371

372+
def disable_constraint_solver_performance_hacks : Flag<["-"], "disable-constraint-solver-performance-hacks">,
373+
HelpText<"Disable all the hacks in the constraint solver">;
374+
375+
def enable_operator_designated_protocols :
376+
Flag<["-"], "enable-operator-designated-protocols">,
377+
HelpText<"Enable operator designated protocols">;
378+
379+
def solver_enable_operator_designated_protocols :
380+
Flag<["-"], "solver-enable-operator-designated-protocols">,
381+
HelpText<"Enable operator designated protocols in constraint solver">;
382+
379383
def switch_checking_invocation_threshold_EQ : Joined<["-"],
380384
"switch-checking-invocation-threshold=">;
381385

lib/Frontend/CompilerInvocation.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,9 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
164164
Opts.EnableOperatorDesignatedProtocols |=
165165
Args.hasArg(OPT_enable_operator_designated_protocols);
166166

167+
Opts.SolverEnableOperatorDesignatedProtocols |=
168+
Args.hasArg(OPT_solver_enable_operator_designated_protocols);
169+
167170
if (auto A = Args.getLastArg(OPT_enable_deserialization_recovery,
168171
OPT_disable_deserialization_recovery)) {
169172
Opts.EnableDeserializationRecovery

0 commit comments

Comments
 (0)