Commit Graph

69 Commits

Author SHA1 Message Date
Artem Chikin
acb4e847f5 [Dependency Scanning] Add functionality to validate contents of a loaded scanner cache state
Checking each module dependency info if it is up-to-date with respect to when the cache contents were serialized in a prior scan.

- Add a timestamp field to the serialization format for the dependency scanner cache
- Add a flag "-validate-prior-dependency-scan-cache" which, when combined with "-load-dependency-scan-cache" will have the scanner prune dependencies from the deserialized cache which have inputs that are newer than the prior scan itself

With the above in-place, the scan otherwise proceeds as-is, getting cache hits for entries still valid since the prior scan.
2025-02-03 10:33:43 -08: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
Holly Borla
32038d9261 [Statistics] Add a frontend counter for Swift 6 errors diagnosed via
`warnUntilSwiftVersion(6)`.
2024-01-29 19:58:48 -08:00
Rintaro Ishizaki
a61ed80813 [Macros] Track macro dependency separately in module trace
Macro plugins are not normal Swift modules, track them differently.
Add "swiftmacros" field to the JSON file.

rdar://118013482
2024-01-19 12:56:02 -08:00
Artem Chikin
5a38d65fb3 Move 'ConstExtract' request from TypeCheckRequest into its own component's collection of requests. 2022-10-28 13:55:09 -07:00
Slava Pestov
4a041c57d0 AST: Rename ConformanceAccessPath to ConformancePath 2022-08-09 13:34:27 -04:00
zoecarver
d706863a52 [cxx-interop][nfc] Add a ClangImporter request zone.
This is just the boilerplate for adding a request zone. I haven't actually added any requrests in this commit.
2021-09-28 17:08:48 -07:00
Slava Pestov
f28d9b3dbf RequirementMachine: Stub out the equivalence class map 2021-06-30 01:34:20 -04:00
Slava Pestov
7bd73008a5 RequirementMachine: Add a couple of simple counters 2021-06-23 23:46:08 -04:00
Slava Pestov
e45b566642 GSB: Try harder to prove derivation via redundant requirements
Consider a signature with a conformance requirement, and two
identical superclass requirements, both of which make the
conformance requirement redundant.

The conformance will have two requirement sources, the explicit
source and a derived source based on one of the two superclass
requirements, whichever one was processed first.

If we end up marking the *other* superclass requirement as
redundant, we would incorrectly conclude that the conformance
was not redundant. Instead, if a derived source is based on a
redundant requirement, we can't just discard it right away;
instead, we have to check if that source could have been
derived some other way.
2021-05-07 18:43:57 -04:00
Slava Pestov
ac3cbe5858 GSB: Add a counter and clean up getConformanceAccessPath() a bit 2021-05-07 18:43:52 -04:00
Slava Pestov
0fa84c14a0 ASTScope: Remove the ExpandASTScopeRequest
This doesn't really fit the request evaluator model since the
result of evaluating the request is the new insertion point,
but we don't have a way to get the insertion point of an
already-expanded scope.

Instead, let's change the callers of the now-removed
expandAndBeCurrentDetectingRecursion() to instead call
expandAndBeCurrent(), while checking first if the scope was
already expanded.

Also, set the expanded flag before calling expandSpecifically()
from inside expandAndBeCurrent(), to ensure that re-entrant
calls to expandAndBeCurrent() are flagged by the existing
assertion there.

Finally, replace a couple of existing counters, and the
now-gone request counter with a single ASTScopeExpansions
counter to track expansions.
2020-12-18 15:43:33 -05:00
Robert Widmann
76cd4bf160 [NFC] Differential Incremental External Dependencies in DependencyTracker
Also perform the plumbing necessary to convince the rest of the compiler that they're just ordinary external dependencies. In particular, we will still emit these depenencies into .d files, and code completion will still index them.
2020-09-24 23:25:47 -06:00
Robert Widmann
8f065e7a61 Delete TypeChecker::validateType
Inline it into its final user: swift::performTypeLocChecking
2020-06-10 19:33:58 -07:00
Hamish Knight
6f212634c8 Add getOperatorDecls to FileUnit and ModuleDecl
Query the SourceLookupCache for the operator decls,
and use ModuleDecl::getOperatorDecls for both
frontend stats and to clean up some code
completion logic.

In addition, this commit switches getPrecedenceGroups
over to querying SourceLookupCache.
2020-03-27 09:44:55 -07:00
Robert Widmann
52f4aba784 IRGen Requests
Implement the IRGen Request infrastructure and provide the first
request: generating IR from a given SourceFile.
2020-03-16 18:00:33 -07:00
Hamish Knight
e9a7427712 [SILOptimizer] Add pipeline execution request (#29552)
[SILOptimizer] Add pipeline execution request
2020-03-03 20:24:28 -08:00
Brent Royal-Gordon
014bb1cd83 Don’t count submodules when cross-importing
It turns out that, if you pull in any nontrivial module, there are thousands of submodules and none of them could possibly have a  cross-import overlay. Avoid evaluating them.
2020-02-18 11:08:36 -08:00
Hamish Knight
13217b600c [SILOptimizer] Add pipeline execution request
Add ExecuteSILPipelineRequest which executes a
pipeline plan on a given SIL (and possibly IRGen)
module. This serves as a top-level request for
the SILOptimizer that we'll be able to hang
dependencies off.
2020-02-14 09:58:32 -08:00
Hamish Knight
586e586af2 Add top-level request for TBDGen
Introduce `GenerateTBDRequest` which outputs the
interface file along with a set of public symbols.
2020-02-13 21:52:45 -08:00
Slava Pestov
aa417c306b Merge pull request #29793 from slavapestov/small-misc-cleanups
Small miscellaneous cleanups
2020-02-13 00:04:24 -05:00
Slava Pestov
0b502d8c84 AST: loadNamedMembers() never fails
This allows us to simplify lookupDirect() a fair bit as well.
2020-02-12 18:32:46 -05:00
Slava Pestov
06855f758d AST: Remove a couple of redundant statistics 2020-02-12 18:29:27 -05:00
Slava Pestov
762ab4fc6a IRGen: Add a counter for GOT entries emitted 2020-02-11 18:59:21 -05:00
Robert Widmann
6ec3ab94d2 [NFC] Define SILGen Request Zone and GenerateSIL Request
Define a high-level request for SILGen and switch the high-level
entrypoint to vector through it.
2020-01-26 13:43:52 -08:00
Robert Widmann
26d8bad7c2 Add DirectLookupRequest 2020-01-25 11:04:53 -08:00
Robert Widmann
e7170bd751 Add Qualified Lookup Requests 2019-12-16 15:36:09 -08:00
Hamish Knight
6811586e40 Remove NumLookupQualifiedInAnyObject counter
We now have an equivalent counter for
AnyObjectLookupRequest.
2019-11-22 12:59:27 -08:00
Hamish Knight
2ca30c6847 Remove NumLookupInModule counter
We now have an equivalent counter for
LookupInModuleRequest.
2019-11-22 12:59:27 -08:00
Hamish Knight
acbf0b264c Remove NumUnqualifiedLookup counter
We now have an equivalent counter for
UnqualifiedLookupRequest.
2019-11-15 14:25:42 -08:00
Robert Widmann
28b66f6225 Switch DeclValidation Counter to Request Counter
Now that validateDecl is gone, stop duplicating work here and use the
request counter instead.
2019-10-28 15:36:50 -07:00
Slava Pestov
0405ab5ffc AST: GenericContexts store a GenericSignature instead of a GenericEnvironment
This eliminates the entire 'lazy generic environment' concept;
essentially, all generic environments are now lazy, and since
each signature has exactly one environment, their construction
no longer needs to be co-ordinated with deserialization.
2019-09-06 17:16:04 -04:00
Robert Widmann
087e2f2746 [Evaluator Ergonomics] Add location information options to the requests 2019-09-06 11:16:17 -07:00
Robert Widmann
7a51cfcb87 [Evaluator Ergonomics] Add Request Signatures
Also add their caching kinds.  This information will be used to remove
the need to define classes at all.
2019-09-05 13:15:02 -07:00
Doug Gregor
d8f7c9e72c [Parser] Introduce a request for parsing type and extension members.
Ensure that lazy parsing of the members of nominal type definitions
and extensions is handled through a request. Most of the effort here
is in establishing a new request zone for parser requests.
2019-08-28 21:39:56 -07:00
Slava Pestov
acf5371dfc AST: Introduce a new ImportCache singleton 2019-08-28 16:29:49 -04:00
Robert Widmann
5ec344b5b9 Define SWIFT_REQUEST
Begin refactoring the request evaluator by swapping SWIFT_TYPEID for
SWIFT_REQUEST.  Introduce the Zone of the request as a formal parameter
to the macro, then re-expand the request macro to get the type info
back.

SWIFT_REQUEST will eventually grow to encompass more information about
requests as we seek to reduce the boilerplate involved in their
definitions.
2019-08-27 17:38:14 -07:00
David Ungar
7992e1c6c4 Lots of cleanups, renamings, etc. 2019-08-26 16:55:18 -07:00
Slava Pestov
94c5a35bf2 AST: Add some counters related to name lookup 2019-08-19 23:00:57 -04:00
Doug Gregor
73e5a64bd1 [Constraint graph] Collapse cycles in the one-way component graph.
When we encounter a cycle in the one-way component graph due to constraints
that (e.g.) tie together the outputs of two one-way constraints, collapse
the components along the cycle into a single connected component, because
all of those type variables must be solved together.
2019-08-14 13:51:24 -07:00
Slava Pestov
9dd835c71b Sema: Replace the finalizeDecl() mechanism with ClassDecl::getEmittedMembers()
The only thing remaining in finalizeDecl() is synthesis of
certain class members. Let's turn that into a request.
2019-08-09 19:08:47 -04:00
Slava Pestov
ac9a3bf34a Sema: Add counters for synthesized accessors 2019-07-23 16:13:28 -04:00
Xi Ge
77ba3a21b4 IDE+Evaluator: refactor the implementation of two type checker utilities to evaluator requests. NFC
IDE functionality needs some internal type checking logics, e.g. checking
whether an extension is applicable to a concrete type. We used to directly
expose an header from sema called IDETypeChecking.h so that IDE functionalities
could invoke these APIs. The goal of the commit and following commits is to
expose evaluator requests instead of directly exposing function entry points from
sema so that we could later move IDETypeChecking.h to libIDE and implement these functions
by internally evaluating these requests.
2019-07-22 12:49:36 -07:00
Slava Pestov
56515ee871 Merge pull request #26119 from slavapestov/stored-properties-request
Re-implement NominalTypeDecl::getStoredProperties() using request evaluator
2019-07-17 09:12:47 -04:00
Slava Pestov
83c90b6b2a AST: Turn NominalTypeDecl::getStoredProperties() into a request
This improves on the previous situation:

- The request ensures that the backing storage for lazy properties
  and property wrappers gets synthesized first; previously it was
  only somewhat guaranteed by callers.

- Instead of returning a range this just returns an ArrayRef,
  which simplifies clients.

- Indexing into the ArrayRef is O(1), which addresses some FIXMEs
  in the SIL optimizer.
2019-07-16 16:38:38 -04:00
Xi Ge
8915cf8c4d Sourcekit/Evaluator: refactor cursor-info resolver to using the evaluator model. NFC
This change adds a new IDE request ID zone and refactors the cursor-info resolver
to use the request evaluator model.
2019-07-16 09:55:16 -07:00
Jordan Rose
cce8d2fde0 [Serialization] Deserialize protocol requirement signatures lazily
Always good to do less work, and it's a stepping stone towards
recovering from trying to deserialize a protocol with missing
requirements.
2019-06-27 14:52:47 -07:00
Slava Pestov
ec1b1a390a AST: Remove ASTContext::ExternalDefinitions
Anything added here has a type checked body now, so it no longer
serves any purpose.
2019-05-28 22:08:30 -04:00
Andrew Trick
8f84429565 Add a scale-test for VarDecl::getStoredProperties.
Adds a NumStoredPropertiesQueries stat.

Adds a test case for an increasing number of lazy stored class
properties. Each property requires a formal access within the
initializer. This would manifest as cubic behavior in
AccessEnforcementOpts, which scales as O(1.5) in the above stat.
2019-05-13 16:54:55 -07:00
Slava Pestov
33b548f8b0 AST: Remove SourceFile::UsedConformances
Sema no longer adds conformances to a per-SourceFile list that it thinks
are going to be "used" by SILGen, IRGen and the runtime. Instead, previous
commits already ensure that SILGen determines the set of conformances to be
emitted, triggering conformance checking as needed.
2019-04-25 22:32:27 -04:00