Skip to content

[5.9] Bundle macro plugin changes #64793

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

Merged
merged 6 commits into from
Mar 31, 2023

Conversation

rintaro
Copy link
Member

@rintaro rintaro commented Mar 30, 2023

Cherry-pick #64407 #64555 #64610 #64655 into release/5.9

Explanation: A bundle of macro plugin related changes (1) Recovery after external plugin crash, (2) Load -load-plugin-library lazily (3) Add environment variable to dump external plugin messagagings (4) Use a single PluginRegistry in multiple ASTContexts. All changes are important to improve the compiler stability regarding macro executable plugins.
Scope: Macro resolution and expansion
Risk: Mid. Macro executable plugin system is a new feature
Testing: Added regression test cases
Reviewer: Ben Barham (@bnbarham), Alex Hoppen (@ahoppen), Doug Gregor (@DougGregor)

rintaro added 6 commits March 30, 2023 15:48
When executable plugins crashed or somehow decided to exit, the compiler
should relaunch the plugin executable before sending another message.

(cherry picked from commit a49ab25)
* Argument to '-load-plugin-library' now must have a filename that's
  '{libprefix}{modulename}.{sharedlibraryextension}'
* Load '-load-plugin-library' plugins are now lazily loaded in
  'CompilerPluginLoadRequest'
* Remove ASTContext.LoadedSymbols cache because they are cached by
  'ExternalMacroDefinitionRequest' anyway
* `-load-plugin-executable` format validation is now in
  'ParseSearchPathArgs'

(cherry picked from commit d8c8574)
Set 'SWIFT_DUMP_PLUGIN_MESSAGING' env variable to enable it.

(cherry picked from commit bd9af09)
And stop using '-dump-macro-expansions'

(cherry picked from commit d5b8c84)
Make a single 'PluginRegistry' and share it between SwiftASTManager,
IDEInspectionInstance, and CompileInstance. And inject the plugin
registry to ASTContext right after 'CompilerInstance.setup()'

That way, all sema-capable ASTContext in SourceKit share a single
PluginRegistry.

(cherry picked from commit a4d1fc6)
PluginRegistry is now shared between multiple ASTContext. ASTContext
should track its loaded plugin library paths separately.

(cherry picked from commit 59f744c)
@rintaro rintaro requested a review from a team as a code owner March 30, 2023 22:55
@rintaro
Copy link
Member Author

rintaro commented Mar 30, 2023

@swift-ci Please test

@rintaro
Copy link
Member Author

rintaro commented Mar 31, 2023

@swift-ci Please test macOS

@rintaro rintaro merged commit 93e77f3 into swiftlang:release/5.9 Mar 31, 2023
@AnthonyLatsis AnthonyLatsis added the 🍒 release cherry pick Flag: Release branch cherry picks label May 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants