Commit Graph

20 Commits

Author SHA1 Message Date
adrian-prantl
f75dea49df Merge pull request #23910 from adrian-prantl/49751363
Record parseable interface imports in the debug info.
2019-04-19 14:23:57 -07:00
Harlan Haskins
24c35f3ff1 [ModuleInterface] Error for out-of-date modules in the resource-dir (#24139)
If we're loading a .swiftmodule from the resource dir adjacent to the compiler,
defer to the serialized loader instead of falling back. This is mainly to
support development of Swift, where one might change the module format version
but forget to recompile the standard library. If that happens, don't fall back
and silently recompile the standard library -- instead, error like we used to.

rdar://49926152
2019-04-19 10:36:37 -07:00
Harlan Haskins
fec837a00d [ParseableInterfaces] Improvements to forwarding module dependencies (#23968)
- Fix a typo in the debug output for finding a prebuilt module
- Don't add the prebuilt module path to the dependency tracker
- Ensure we're registering the _forwarding module_'s dependencies in
cached modules, not the prebuilt module's dependencies.
- Check for the existence of a prebuilt module before doing the
is-up-to-date check (which will have failed anyway if it didn't exist).
- Test that forwarding module dependency collection works

rdar://48659199
2019-04-13 00:11:22 -07:00
Harlan Haskins
ea7e7e918f [ModuleInterface] Remove 'parseable interface' from diagnostics
Part of rdar://49359734
2019-04-11 18:05:09 -07:00
Harlan Haskins
e5456984f7 [ModuleInterfaces] Remove 'parseable' from command-line flags
Leave the old flag in as an alias to the new flag, for transition
purposes. Also go ahead and remove the long-deprecated and unused
`emit-interface-path`.

Part of rdar://49359734
2019-04-11 18:05:09 -07:00
Adrian Prantl
8d03cb7a61 Record parseable interface imports in the debug info.
When a Swift module built with debug info imports a library without
debug info from a textual interface, the textual interface is
necessary to reconstruct types defined in the library's interface.  By
recording the Swift interface files in DWARF dsymutil can collect them
and LLDB can find them.

rdar://problem/49751363
2019-04-11 14:50:07 -07:00
Harlan Haskins
0999bfed74 Revert "Revert "[ParseableInterfaces] Stop explicitly optimizing cached modules""
This re-disables explicit optimization of cached modules.

rdar://46358840
2019-04-10 15:30:27 -07:00
Harlan Haskins
149367e5d5 [ParseableInterfaces] Short-circuit module loading
Previously, the ParseableInterfaceModuleLoader relied on the assumption
that, if it returned `errc::not_supported`, it would fall through the
search paths and then move on to the SerializedModuleLoader. This did
not anticipate the possibility of a valid .swiftinterface coming later
in the search paths, which can cause issues for the standard library
which is in the resource-dir and should always be loaded from there.

Instead, make the module loading explicitly short-circuit when seeing
`errc::not_supported`, and document it.

Also add some more logging throughout `discoverLoadableModule` so we can
more easily catch issues like this in the future.

Fixes rdar://49479386
2019-04-08 10:07:11 -07:00
Nathan Hawes
02e422e5fe [ParseableInterface] Normalize paths before comparison when serializing dependencies
Dependencies in the SDK have their paths serialized relative to it to allow the
produced swift module to stay valid when the SDK moves. In the windows build
mixed slashes were coming through in these paths and breaking the check for
whether a dependency was in the SDK or not.

This patch ensures both paths are using native path separators prior to the
comparison to hopefuly fix the Windows build.
2019-04-07 11:39:02 -07:00
Rintaro Ishizaki
4ab983bc2e Revert "[ParseableInterfaces] Stop explicitly optimizing cached modules" 2019-04-04 16:43:48 -07:00
Harlan Haskins
406c005333 [ParseableInterfaces] Stop explicitly optimizing cached modules
Previously, we always optimized cached modules. Now, use the flag we're
already preserving to optimize them.

Fixes rdar://46358840
2019-04-03 16:24:47 -07:00
Nathan Hawes
7144dab15a [ParseableInterface] Don't report out-of-date dependencies to the parent dependency tracker
We previously added dependencies to the tracker inline while validating a cached
module's dependencies were up to date. If one of its dependencies ended up being
out of date though, we shouldn't have added the previous dependencies, as that
means the dependency list itself was also out of date.

This patch changes the behavior to only add the module's dependencies once we've
verified they're all up to date.
2019-04-03 06:35:11 -07:00
Nathan Hawes
58d622d796 [ParseableInterface] Don't serialize resource directory deps and stop adding cached modules to the dependency tracker
This patch modifies ParseableInterfaceBuilder::CollectDepsForSerialization to
avoid serializing dependencies from the runtime resource path into the
swiftmodules generated from .swiftinterface files. This means the module cache
should now be relocatable across machines.

It also modifies ParseableInterfaceModuleLoader to never add any dependencies
from the module cache and prebuilt cache to the dependency tracker (in addition
to the existing behaviour of not serializing them in the generated
swiftmodules). As a result, CollectDepsForSerialization no longer checks if the
dependencies it is given come from the cache as they are provided by the
dependency tracker. It now asserts that's the case instead.
2019-04-03 06:35:11 -07:00
Nathan Hawes
accc64719e [ParseableInterface][test] Update SDKDependencies.swift test to explicitly check serialized dependencies
Also use the existing check-is-forwarding-module.py script to check for
forwarding modules, rather than doing it manually.
2019-04-03 06:35:11 -07:00
Nathan Hawes
37328020df [ParseableInterface] Don't serialize swiftmodule dependencies in the module cache or prebuilt module cache
*Their* dependencies are already being serialized out, so this shouldn't affect
up-to-date-checking except by alowing the regular and prebuilt module caches to
be relocated without invalidating their contents. In the case of the prebuilt
module cache, this gets us closer to supporting relocation across machines.
2019-04-03 06:35:11 -07:00
Nathan Hawes
58d0ee0888 [ParseableInterface] Distinguish SDK and non-SDK dependencies
This allows the SDK to be relocated without automatically resulting in a
rebuild.

Based on an old patch from Jordan Rose.
2019-04-03 06:35:11 -07:00
Nathan Hawes
f683373116 [ParseableInterface] Respect -track-system-dependencies with -build-module-from-parseable-interface
Updates the subinvocation that builds the parseable interface to respect the
-track-system-dependencies flag of the top-level invocation if present, by
including system dependencies in the produced .swiftmodule.
2019-04-03 06:34:29 -07:00
Harlan Haskins
f4da34f363 [ParseableInterface] Only open module buffers once while loading
In addition to being wasteful, this is a correctness issue -- the
compiler should only ever have one view of this file, and it should not
read a potentially different file after validating dependencies.

rdar://48654608
2019-03-21 18:17:07 -07:00
Jordan Rose
22f9853b76 [ParseableInterface] Turn on -enable-parseable-module-interface always (#23331)
...and remove the option. This is ~technically~ CLI-breaking because
Swift 5 shipped this as a hidden driver option, but it wouldn't have
/done/ anything in Swift 5, so I think it's okay to remove.

Note that if a parseable interface (.swiftinterface) and a binary
interface (.swiftmodule) are both present, the binary one will still
be preferred. This just /allows/ parseable interfaces to be used.

rdar://problem/36885834
2019-03-16 15:31:11 -07:00
Harlan Haskins
366bbf48b9 [ParseableInterface] Add ‘forwarding modules’
A ‘forwarding module’ is a YAML file that’s meant to stand in for a .swiftmodule file and provide an up-to-date description of its dependencies, always using modification times.

When a ‘prebuilt module’ is first loaded, we verify that it’s up-to-date by hashing all of its dependencies. Since this is orders of magnitude slower than reading mtimes, we’ll install a `forwarding module` containing the mtimes of the now-validated dependencies.
2019-03-07 11:36:15 -08:00