Skip to content

SIL: Remove special meaning for @_semantics("stdlib_binary_only") #12237

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
Oct 3, 2017

Conversation

slavapestov
Copy link
Contributor

With -sil-serialize-all gone, this no longer means anything; just
don't declare the function as @_inlineable instead.

@slavapestov
Copy link
Contributor Author

@swiftix @moiseev Let me know if this makes sense.

@slavapestov
Copy link
Contributor Author

Also @milseman for the string stuff

@slavapestov
Copy link
Contributor Author

I haven't even built this locally, so of course all tests will pass!

@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov
Copy link
Contributor Author

@swift-ci Please clean smoke test Linux

@slavapestov slavapestov force-pushed the kill-stdlib-binary-only branch 2 times, most recently from 3b12ae4 to fd60335 Compare October 3, 2017 06:45
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

1 similar comment
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke benchmark

1 similar comment
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke benchmark

@swift-ci
Copy link
Contributor

swift-ci commented Oct 3, 2017

Build comment file:

Build failed before running benchmark.



Notice that this annotation is similar to the resilient annotation that will
disallow the cloning of code into the user application.
application for functions marked @_inlinable. This allows the optimizer to
Copy link
Contributor

Choose a reason for hiding this comment

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

s/inlinable/inlineable It's not codable =)

disallow the cloning of code into the user application.
application for functions marked @_inlinable. This allows the optimizer to
inline calls from the stdlib and improve the performance of code that uses
common operators such as '++' or basic containers such as Array. However,
Copy link
Contributor

Choose a reason for hiding this comment

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

I know it's not your words, but you touched it, so... ++ does not exit any more.

@inline(never)
@_inlineable
Copy link
Contributor

Choose a reason for hiding this comment

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

Wait, I thought @inline(never) and @_inlineable don't play well together, and already wanted to ask for a warning.

Copy link
Member

Choose a reason for hiding this comment

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

@_inlineable is not about inlining, so they are actually orthogonal.

Copy link
Contributor

Choose a reason for hiding this comment

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

But, @swiftix told me that @inline(__always) implies @_inlineable. I'm confused now...

Copy link
Contributor

Choose a reason for hiding this comment

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

@moiseev IIRC, the current rules in the compiler work in such a way that @inline(__always) and @_transparent implies @_inlineable.

@slavapestov That's how it works today, or?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@swiftix and @milseman are correct. I know it's a bit confusing but this is where we are at today:

  • @_transparent and @inline(__always) imply @_inlineable, but only if the function is public.
  • @_inlineable just marks the SIL function body for serialization, it's ignored by the optimizer.
  • @inline(never) is an optimizer directive and is orthogonal to @_inlineable.

With -sil-serialize-all gone, this no longer means anything; just
don't declare the function as @_inlineable instead.

Fixes <rdar://problem/34564380>.
@slavapestov slavapestov force-pushed the kill-stdlib-binary-only branch from fd60335 to 0fad13e Compare October 3, 2017 20:49
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

Copy link
Member

@milseman milseman left a comment

Choose a reason for hiding this comment

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

Question about the use of decl comments and convention. The String file changes LGTM.

@_versioned // FIXME(sil-serialize-all)
@inline(never) @_semantics("stdlib_binary_only") // Hide the CF dependency
@inline(never) // Hide the CF dependency
Copy link
Member

Choose a reason for hiding this comment

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

IIRC The comment is solely from the lack of @_inlineable. I don't think it goes on @inline(never), but I don't know where to put it. Perhaps under the new paradigm it's just not an interesting distinction. Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the comment is still useful for future maintainers in case they decide to put @_inlineable back in?

Copy link
Contributor

Choose a reason for hiding this comment

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

In theory we shouldn't need the inline-never anymore either, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

Without inline-never it can be inlined inside the stdlib itself.

Copy link
Contributor

Choose a reason for hiding this comment

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

Right, but that should be fine now.

Copy link
Member

Choose a reason for hiding this comment

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

Outline-and-inline-never is still a useful, albeit niche, tool inside the stdlib when Builtin.expect is insufficient.

@slavapestov
Copy link
Contributor Author

@swift-ci Please clean smoke test Linux

@slavapestov slavapestov merged commit aed8c33 into swiftlang:master Oct 3, 2017
@jrose-apple
Copy link
Contributor

I'm not sure why testing didn't catch this, but StdlibUnittest is still using this. Reverting for now.

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.

6 participants