Skip to content

Add @_inlineable attribute #5570

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 2 commits into from
Nov 2, 2016

Conversation

slavapestov
Copy link
Contributor

No description provided.

@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test and merge

@@ -164,9 +164,12 @@ SIMPLE_DECL_ATTR(nonobjc, NonObjC,
SIMPLE_DECL_ATTR(_fixed_layout, FixedLayout,
OnVar | OnClass | OnStruct | OnEnum | UserInaccessible, 31)

SIMPLE_DECL_ATTR(_fragile, Fragile,
OnVar | OnSubscript | OnFunc | OnConstructor | UserInaccessible, 32)
Copy link
Member

Choose a reason for hiding this comment

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

You'll want to bump the module version...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point.

@jrose-apple
Copy link
Contributor

Please name this @_inlineable, even when prototyping. It doesn't apply to anything but decls with bodies, right?

Does this also belong on deinitializers?

@slavapestov slavapestov force-pushed the add-fragile-attribute branch from be78115 to 416aa2e Compare November 1, 2016 23:03
@slavapestov slavapestov changed the title Add @_fragile attribute Add @_inlineable attribute Nov 1, 2016
@slavapestov
Copy link
Contributor Author

@DougGregor I bumped the version. @jrose-apple I renamed the attribute and added a test that it works on deinits -- good catch.

@slavapestov
Copy link
Contributor Author

@swift-ci Please test and merge

@jckarter
Copy link
Contributor

jckarter commented Nov 1, 2016

It's also spelled inlinable, not inlineable.

@jrose-apple
Copy link
Contributor

Oh no it isn't. :-) http://jrose-apple.github.io/swift-library-evolution/#inlineable-functions

(I went back and forth on it. I don't actually care what swift-evolution picks once we put this through review, which is probably the most dangerous thing to say.)

Quiz: What does @_transparent on an extension actually *do*?

1) Make all members @_transparent?
2) Allow your members to be @_transparent?
3) Some other magical effect that has nothing to do with members?

The correct answer is 1), however a few places in the stdlib defined
a @_transparent extension and then proceeded to make some or all members
also @_transparent, and in a couple of places we defined a @_transparent
extension with no members at all.

To avoid cargo culting and confusion, remove the ability to make
@_transparent extensions altogether, and force usages to be explicit.
This attribute causes a function's body to be serialized, but unlike
@_transparent and @inline(__always), does not force it to be inlined.
@slavapestov slavapestov force-pushed the add-fragile-attribute branch from 416aa2e to 4780b0b Compare November 2, 2016 04:14
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test and merge

1 similar comment
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test and merge

@slavapestov
Copy link
Contributor Author

@jckarter @jrose-apple One of the reasons I wanted to go with @_fragile :-)

@slavapestov slavapestov merged commit 07ec69f into swiftlang:master Nov 2, 2016
@jckarter
Copy link
Contributor

jckarter commented Nov 2, 2016

We may as well head off an unnecessary swift-evolution bikeshed by using the correct spelling going in, or else picking a name whose spelling is less in doubt like Slava suggested.

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.

4 participants