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

[windows] IRGen: add support for DLL Storage semantics #2080

Merged
merged 1 commit into from Jul 8, 2016

Conversation

compnerd
Copy link
Collaborator

@compnerd compnerd commented Apr 6, 2016

What's in this pull request?

Resolved bug number: (SR-)


Before merging this pull request to apple/swift repository:

  • Test pull request on Swift continuous integration.

Triggering Swift CI

The swift-ci is triggered by writing a comment on this PR addressed to the GitHub user @swift-ci. Different tests will run depending on the specific comment that you use. The currently available comments are:

Smoke Testing

Platform Comment
All supported platforms @swift-ci Please smoke test
OS X platform @swift-ci Please smoke test OS X platform
Linux platform @swift-ci Please smoke test Linux platform

Validation Testing

Platform Comment
All supported platforms @swift-ci Please test
OS X platform @swift-ci Please test OS X platform
Linux platform @swift-ci Please test Linux platform

Note: Only members of the Apple organization can trigger swift-ci.

Add initial support for modelling DLL Storage semantics for global values. This
is needed to support the indirect addressing mechanism used on Windows.

@compnerd
Copy link
Collaborator Author

compnerd commented Jul 1, 2016

CC @rjmccall

@compnerd compnerd changed the title IRGen: add support for DLL Storage semantics [windows] IRGen: add support for DLL Storage semantics Jul 1, 2016
auto fnTy = llvm::FunctionType::get(returnTy, argTys, /*vararg*/ false);
auto fn = llvm::Function::Create(fnTy, llvm::GlobalValue::PrivateLinkage,
llvm::Twine(name), IGM.getModule());
// FIXME: should we be setting the visibility and the DLL storage as well?
Copy link
Member

Choose a reason for hiding this comment

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

No, private things aren't exported.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Right, but should actually explicitly set the visibility to hidden and the DLL storage to Default (local only)?

Copy link
Member

Choose a reason for hiding this comment

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

Hidden visibility isn't meaningful for internal / private entities, and I believe LLVM considers it a consistency error to have that combination. There's no need to make this explicit in the code.

@rjmccall
Copy link
Member

rjmccall commented Jul 1, 2016

The basic approach looks good, but please extrapolate from my comments so far. :)

@compnerd
Copy link
Collaborator Author

compnerd commented Jul 2, 2016

@rjmccall updated based on the extrapolation of your original comments. Please have another look!

@compnerd
Copy link
Collaborator Author

compnerd commented Jul 2, 2016

@swift-ci Please test

@compnerd
Copy link
Collaborator Author

compnerd commented Jul 5, 2016

@rjmccall post holiday ping :-).

auto fnTy = llvm::FunctionType::get(returnTy, argTys, /*vararg*/ false);
auto fn = llvm::Function::Create(fnTy, llvm::GlobalValue::PrivateLinkage,
llvm::Twine(name), IGM.getModule());
fn->setAttributes(IGM.constructInitialAttributes());

Copy link
Member

Choose a reason for hiding this comment

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

I don't actually dislike these whitespace changes, but please try to avoid changing code that you're not actually changing.

Copy link
Member

Choose a reason for hiding this comment

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

This applies to a fair amount of this diff, really.

IGM.Module.getFunctionList().insert(insertBefore->getIterator(), fn);
else
IGM.Module.getFunctionList().push_back(fn);

Copy link
Member

Choose a reason for hiding this comment

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

Why did this code move?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That was to have the visibility/calling convention together. If you would rather that they just be split up around the original position of this, I can do that.

@rjmccall
Copy link
Member

rjmccall commented Jul 6, 2016

Just some patch-cleanliness requests this time, thanks.

Add initial support for modelling DLL Storage semantics for global values.  This
is needed to support the indirect addressing mechanism used on Windows.
@compnerd
Copy link
Collaborator Author

compnerd commented Jul 7, 2016

Updated. Sorry, the patch is pretty old, and I was going through and inspecting all the sites that I found, so I had changed code around at one point. I believe that only the sites where there are changes should now be part of the commit. Thanks for the patience with this!

@rjmccall
Copy link
Member

rjmccall commented Jul 7, 2016

LGTM, thanks!

@compnerd
Copy link
Collaborator Author

compnerd commented Jul 7, 2016

@swift-ci Please test and merge

@swift-ci swift-ci merged commit 3691b48 into apple:master Jul 8, 2016
@compnerd compnerd deleted the dllstorage branch July 8, 2016 06:58
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

3 participants