-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[docs] LibraryEvolution: Merge @alwaysEmitIntoClient into @inlineable. #6118
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
[docs] LibraryEvolution: Merge @alwaysEmitIntoClient into @inlineable. #6118
Conversation
JoeG (and Dmitri before him) pointed out a while back that having /two/ ways to get something emitted into a client's module was really more complexity than we really needed, and created a pitfall for library authors who might choose the wrong one for their needs.
@jckarter, @slavapestov, @milseman, @rjmccall, @drewcrawford, thoughts? |
Makes sense to me. Inlinable functions ought to be small, and even if we can't inline them at a particular use site, emitting a copy into the client has performance benefits (no dyld stub) and reduces ABI liability, so that seems like the right default mode for inlinability. |
I'm not sure about "inlinable functions ought to be small" when this is also the way to keep a function from being part of your ABI, but yes, that was the general thought. |
IMO there is more than one type of inline, although the existing dichotomy does not quite capture it.
However C has another feature, Partly hazy is whether "inline" in this context means inlining a function into calling functions or copying a function into a client module and calling the local copy from client functions. The latter is not especially useful but the former is. Unrelated, but
would prefer to see an attribute for this, similar to |
You're right that it's close to Even without that, a client might still be able to get more optimization by the compiler looking at the body of a function and seeing what it does and doesn't do, at which point the function needs to be emitted into the client anyway. There is an attribute I am totally happy for this to get a different name that has nothing to do with inlining. I'd prefer if that name weren't "fragile", but we'll see.
I'm a little confused by this. This is referring to functions and closures defined within the body of an inlineable function, not arguments. |
I agree that having two keywords that (merely) evict the function from the ABI is redundant. |
Is there a term other than |
I definitely agree we should change the name, but the primary effect is "make this available for clients". Only in some cases does it actually omit the thing from the library's ABI. There's been no major objections so far, so I'll commit this and we can build on it. @swift-ci Please smoke test |
@airspeedswift, @dabrahams, this is relevant to our discussion today. |
@jckarter (and @gribozavr before him) pointed out a while back that having two ways to get something emitted into a client's module was really more complexity than we really needed, and created a pitfall for library authors who might choose the wrong one for their needs.