Skip to content

[ParseableInterfaces] Add -prebuilt-module-cache-path to the frontend #21398

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

jrose-apple
Copy link
Contributor

When trying to load a swiftinterface, search this directory before doing all the work of building a swiftmodule.

When trying to load a swiftinterface, search this directory before
doing all the work of building a swiftmodule.
Makes this code easier to read. No functionality change.
// .swiftinterface.
// If we have a prebuilt cache path, check that too if the interface comes
// from the SDK.
if (!PrebuiltCacheDir.empty()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic checks the prebuilt cache dir first. I don't like this because it slows down the case where the module is not in the prebuilt cache; the alternative would be to fall back to the prebuilt cache and then copy the prebuilt artifact into the proper cache. The downside(s) of that: What if the copy fails? What if it's nonatomic? What if someone's deliberately set things up so that using prebuilt artifacts is okay, but nothing else should get built?

(I was a little unhappy to see that llvm::sys::fs::copy_file is just reading and writing buffered chunks instead of using a system native API. That might be worth fixing on its own.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the extra stats here are worth worrying about. Entire modules are comparatively large units of granularity; the system is doing a ton more stat-work examining individual file dependencies.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's less the stats I'm worried about than the dependency checking, i.e. "the prebuilt version is present but I've modified my SDK for whatever reason". Or even, to a lesser extent, "the prebuilt version is present but I'm using a custom-built toolchain".

@jrose-apple jrose-apple requested a review from nathawes December 18, 2018 02:27
@jrose-apple
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 1c3d467

Copy link
Contributor

@graydon graydon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@jrose-apple
Copy link
Contributor Author

@swift-ci Please test Linux

Copy link
Contributor

@nathawes nathawes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@jrose-apple
Copy link
Contributor Author

I discovered a silly bug: this works at the top level, but I forgot to pass it down to the sub-invocation to handle indirect imports. Fix coming soon.

@jrose-apple
Copy link
Contributor Author

Merged as part of #21513.

@jrose-apple jrose-apple closed this Jan 9, 2019
@jrose-apple jrose-apple deleted the the-prebuiltmore-garage-wants-a-grand branch January 9, 2019 22:59
@jrose-apple jrose-apple merged commit 1c3d467 into swiftlang:master Jan 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants