Skip to content
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

[Macros] Update plugin search options serialization #66689

Merged
merged 2 commits into from
Jun 16, 2023

Conversation

rintaro
Copy link
Member

@rintaro rintaro commented Jun 16, 2023

Previously plugin search options were serialized for each option kind. Instead serialize them in the order specified.

rdar://110903149

Previously plugin search options were serialized for each option kind.
Instead serialize them in the order specified.
@rintaro
Copy link
Member Author

rintaro commented Jun 16, 2023

apple/llvm-project#7003
@swift-ci Please smoke test

options_block::ResilienceStrategyLayout::readRecord(scratch, optKind);
switch (PluginSearchOptionKind(optKind)) {
case PluginSearchOptionKind::PluginPath:
optStr = "-plugin-path";
Copy link
Member Author

@rintaro rintaro Jun 16, 2023

Choose a reason for hiding this comment

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

Not sure about this. But I didn't want to introduce another "kind" enum just for swift/Serialization/Validation.h

Copy link
Member

Choose a reason for hiding this comment

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

The fact that LLDB needs to match on these strings feels a little brittle. Would we be better off exporting PluginSearchOptionKind into a header and having that in the list of plugin search options?

Copy link
Member Author

Choose a reason for hiding this comment

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

👍 Added a commit.
Made PluginSearchOption a struct with PluginSearchOption::Kind in SearchPathOptions.h

options_block::ResilienceStrategyLayout::readRecord(scratch, optKind);
switch (PluginSearchOptionKind(optKind)) {
case PluginSearchOptionKind::PluginPath:
optStr = "-plugin-path";
Copy link
Member

Choose a reason for hiding this comment

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

The fact that LLDB needs to match on these strings feels a little brittle. Would we be better off exporting PluginSearchOptionKind into a header and having that in the list of plugin search options?

LoadPluginLibrary,
LoadPluginExecutable,
};
using PluginSearchOptionKindField = BCFixed<3>;
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like a BCFixed<2> should be enough for the current enum size.

Copy link
Contributor

@xymus xymus left a comment

Choose a reason for hiding this comment

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

The change looks good!

Create a 'Kind' enum so that deserialization can use the kind instead of
a string option name.
@rintaro rintaro force-pushed the macros-serialization-pluginopts branch from ec184e9 to 6fa0c14 Compare June 16, 2023 18:59
@rintaro
Copy link
Member Author

rintaro commented Jun 16, 2023

apple/llvm-project#7003
@swift-ci Please smoke test

1 similar comment
@rintaro
Copy link
Member Author

rintaro commented Jun 16, 2023

apple/llvm-project#7003
@swift-ci Please smoke test

Copy link
Contributor

@bnbarham bnbarham left a comment

Choose a reason for hiding this comment

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

LGTM other than @xymus comment

@rintaro
Copy link
Member Author

rintaro commented Jun 16, 2023

BCFixed<3> is for possible future addition of another options without incrementing module format version.
Since this record is not going to be used hundreds of times for each module, @xymus and I agreed we keep it 3 bits.

@rintaro rintaro merged commit 13a29a0 into apple:main Jun 16, 2023
3 checks passed
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.

None yet

4 participants