Skip to content

[Macros] Load '-load-plugin-library' plugins lazily #64610

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 1 commit into from
Mar 25, 2023

Conversation

rintaro
Copy link
Member

@rintaro rintaro commented Mar 24, 2023

  • 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
  • NOTE: because of that, unused library plugins are not diagnosed even if missing
  • Remove ASTContext.LoadedSymbols cache because they are cached by ExternalMacroDefinitionRequest anyway
  • -load-plugin-executable format validation is moved to ParseSearchPathArgs

@rintaro rintaro force-pushed the macros-lazy-plugin-library branch from 587d531 to b6511f7 Compare March 24, 2023 21:06
* 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'
@rintaro rintaro force-pushed the macros-lazy-plugin-library branch from b6511f7 to d8c8574 Compare March 24, 2023 21:14
@rintaro
Copy link
Member Author

rintaro commented Mar 24, 2023

@swift-ci Please smoke test

@rintaro rintaro requested review from DougGregor and bnbarham March 24, 2023 21:16
getImpl().ExecutablePluginPaths[getIdentifier(moduleName)] = pathStr;
}
}
}

void *ASTContext::getAddressOfSymbol(const char *name,
void *libraryHandleHint) {
auto lookup = getImpl().LoadedSymbols.try_emplace(name, nullptr);
Copy link
Member Author

Choose a reason for hiding this comment

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

Now that dlsym is performed only with libraryHint, so it's inlined in lib/Sema/TypeCheckMacros.cpp

Copy link
Member

@DougGregor DougGregor left a comment

Choose a reason for hiding this comment

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

LGTM, thank you

@rintaro rintaro merged commit f3524ad into swiftlang:main Mar 25, 2023
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.

3 participants