Commit Graph

2536 Commits

Author SHA1 Message Date
Mike Ash
ba25b624f8 Merge pull request #18737 from mikeash/change-swift_unknownX-to-swift_unknownObjectX
[Runtime] Rename swift_unknown* functions to swift_unknownObject*.
2018-08-17 14:19:27 -04:00
Harlan
9b29e8dc91 Merge pull request #18454 from harlanhaskins/requests-ive-had-a-few
Remove SimpleRequest::breakCycle
2018-08-16 11:03:22 -07:00
Vedant Kumar
9eec249a85 [docs] Document the swift-lldb test whitelist (#18730) 2018-08-15 16:48:03 -07:00
Mike Ash
46309d9794 [Runtime] Rename swift_unknown* functions to swift_unknownObject*.
These functions don't accept local variable heap memory, although the names make it sound like they work on anything. When you try, they mistakenly identify such things as ObjC objects, call through to the equivalent objc_* function, and crash confusingly. This adds Object to the name of each one to make it more clear what they accept.

rdar://problem/37285743
2018-08-15 17:48:23 -04:00
Harlan Haskins
5a6985f39e Remove SimpleRequest::breakCycle
This patch removes the need for Request objects to provide a default
cycle-breaking value, instead opting to return llvm::Expected so clients
must handle a cycle failure explicitly.

Currently, all clients do the 'default' behavior, but this opens the
possibility for future requests to handle failures explicitly.
2018-08-15 11:01:12 -07:00
Andrew Trick
c9033ed938 Add a SIL attribute [without_actually_escaping].
ConvertFunction and reabstraction thunks need this attribute. Otherwise,
there is no way to identify that withoutActuallyEscaping was used
to explicitly perform a conversion.

The destination of a [without_actually_escaping] conversion always has
an escaping function type. The source may have either an escaping or
@noescape function type. The conversion itself may be a nop, and there
is nothing distinctive about it. The thing that is special about these
conversions is that the source function type may have unboxed
captures. i.e. they have @inout_aliasable parameters. Exclusivity
requires that the compiler enforce a SIL data flow invariant that
nonescaping closures with unboxed captures can never be stored or
passed as an @escaping function argument. Adding this attribute allows
the compiler to enforce the invariant in general with an escape hatch
for withoutActuallyEscaping.
2018-08-14 17:14:25 -07:00
Jordan Rose
04b27e0caa Merge pull request #18584 from jrose-apple/remote-run
[test] Add 'remote-run', a tool to run executable tests over SSH
2018-08-14 12:26:04 -07:00
Jordan Rose
290bf08655 [docs] Update Testing.md for remote-run support 2018-08-14 11:17:08 -07:00
Alex Hoppen
4369b36f21 Merge pull request #18497 from ahoppen/bytetree-infrastructure
[libSyntax] Add a binary serialization format for syntax trees
2018-08-13 15:41:30 -07:00
Adrian Prantl
4a5c74fb8d Update mangling prefix in Mangling.rst 2018-08-13 10:22:39 -07:00
Alex Hoppen
c4e1af7205 [byteTree] Add a document describing the ByteTree format 2018-08-10 10:13:00 -07:00
Jordan Rose
7d8acefd3d [docs] Update SIL.rst for the new verifier checks on enum instructions (#18450) 2018-08-01 13:12:18 -07:00
adrian-prantl
796489960f Merge pull request #18366 from adrian-prantl/28859432
Add debug info support for inlined and specialized generic variables.
2018-08-01 07:19:01 -07:00
Adrian Prantl
58475ef1ad Add debug info support for inlined and specialized generic variables.
This patch adds SIL-level debug info support for variables whose
static type is rewritten by an optimizer transformation. When a
function is (generic-)specialized or inlined, the static types of
inlined variables my change as they are remapped into the generic
environment of the inlined call site. With this patch all inlined
SILDebugScopes that point to functions with a generic signature are
recursively rewritten to point to clones of the original function with
new unique mangled names. The new mangled names consist of the old
mangled names plus the new substituions, similar (or exactly,
respectively) to how generic specialization is handled.

On libSwiftCore.dylib (x86_64), this yields a 17% increase in unique
source vars and a ~24% increase in variables with a debug location.

rdar://problem/28859432
rdar://problem/34526036
2018-07-31 16:59:56 -07:00
swift-ci
ba180c5dc5 Merge pull request #18413 from atrick/docs 2018-07-31 16:44:24 -07:00
Andrew Trick
3ab515b198 SILProgrammer's manual. Remove a couple remnants of fake SIL syntax. 2018-07-31 13:51:14 -07:00
Alejandro
d0037492ce [Docs] Fix minor code typo in SILPro..Man..md 2018-07-31 14:29:42 -04:00
Andrew Trick
f6ba49e292 Add docs/SILDevelopment.rst.
Document SILFunction and `apply` arguments.

Create TBD headers to give the document some form.
2018-07-27 11:02:01 -07:00
John McCall
dc052e6364 Resolve metadata cycles through non-generic value types with resilient layout.
The central thrust of this patch is to get these metadata initializations
off of `swift_once` and onto the metadata-request system where we can
properly detect and resolve dependencies.  We do this by first introducing
runtime support for resolving metadata requests for "in-place"
initializations (committed previously) and then teaching IRGen to actually
generate code to use them (this patch).

A non-trivial amount of this patch is just renaming and refactoring some of
existing infrastructure that was being used for in-place initializations to
try to avoid unnecessary confusion.

The remaining cases that are still using `swift_once` resolution of
metadata initialization are:

- non-generic classes that can't statically fill their superclass or
  have resilient internal layout

- foreign type metadata

Classes require more work because I'd like to switch at least the
resilient-superclass case over to using a pattern much more like what
we do with generic class instantiation.  That is, I'd like in-place
initialization to be reserved for classes that actually don't need
relocation.

Foreign metadata should also be updated to the request/dependency scheme
before we declare ABI stability.  I'm not sure why foreign metadata
would ever require a type to be resolved, but let's assume it's possible.

Fixes part of SR-7876.
2018-07-25 15:21:55 -04:00
Bob Wilson
5a96941803 Add doc whitespace to fix Sphinx error. 2018-07-24 21:13:41 -07:00
Doug Gregor
a2b2798de2 [ABI] Eliminate the now-unused protocol requirement array.
This is a holdover from the old protocol descriptor layout, which is no
longer useful.
2018-07-24 17:33:16 -07:00
swift-ci
cf501b4f71 Merge pull request #18163 from DougGregor/protocol-context-descriptor 2018-07-24 15:00:04 -07:00
Jordan Rose
e0c3c725f9 [docs] Update TransparentAttr.rst for '@inlinable' (#18170) 2018-07-24 12:40:26 -07:00
Doug Gregor
e7998f1846 [ABI] Record unmangled names in Swift protocol descriptors.
Rather than storing a mangled name in a Swift protocol descriptor,
which encodes information that is redundant with the context of the
protocol, store an unmangled name as in nominal type descriptors. Update
the various places where this name is used to extract the demangle
tree from the context descriptors.
2018-07-24 04:25:13 -07:00
Doug Gregor
a54a6d8d7f [ABI] Rework protocol descriptor metadata.
Reimplement protocol descriptors for Swift protocols as a kind of
context descriptor, dropping the Objective-C protocol compatibility
layout. The new protocol descriptors have several advantages over the
current implementation:

* They drop all of the unused fields required for layout-compatibility
  with Objective-C protocols.
* They encode the full requirement signature of the protocol. This
  maintains more information about the protocol itself, including
  (e.g.) correctly encoding superclass requirements.
* They fit within the general scheme of context descriptors, rather than
  being their own thing, which allows us to share more code with
  nominal type descriptors.
* They only use relative pointers, so they’re smaller and can be placed
  in read-only memory

 Implements rdar://problem/38815359.
2018-07-23 22:12:42 -07:00
Doug Gregor
c56879da73 [ABI] Update ABI documentation to match existential metadata layout. 2018-07-23 17:10:00 -07:00
John McCall
7a4aeed570 Implement generalized accessors using yield-once coroutines.
For now, the accessors have been underscored as `_read` and `_modify`.
I'll prepare an evolution proposal for this feature which should allow
us to remove the underscores or, y'know, rename them to `purple` and
`lettuce`.

`_read` accessors do not make any effort yet to avoid copying the
value being yielded.  I'll work on it in follow-up patches.

Opaque accesses to properties and subscripts defined with `_modify`
accessors will use an inefficient `materializeForSet` pattern that
materializes the value to a temporary instead of accessing it in-place.
That will be fixed by migrating to `modify` over `materializeForSet`,
which is next up after the `read` optimizations.

SIL ownership verification doesn't pass yet for the test cases here
because of a general fault in SILGen where borrows can outlive their
borrowed value due to being cleaned up on the general cleanup stack
when the borrowed value is cleaned up on the formal-access stack.
Michael, Andy, and I discussed various ways to fix this, but it seems
clear to me that it's not in any way specific to coroutine accesses.

rdar://35399664
2018-07-23 18:59:58 -04:00
Daniel Zheng
0f430e5251 Merge branch 'master' into generics-manifesto-typo 2018-07-18 16:11:17 -07:00
Daniel Zheng
2dc279fa47 [Docs] Minor edits to GenericsManifesto.md.
Address comments by @CodaFi regarding capitalization.
2018-07-18 14:18:42 -07:00
swift-ci
9c99ee1761 Merge pull request #17927 from Dandigit/master 2018-07-17 14:30:53 -07:00
Jordan Rose
4949fcd830 [docs] LibraryEvolution: Non-controversial updates for Swift 4.2 (#17869)
- Standardize on "inlinable" instead of "inlineable", per SE-0193.
- Standardize on "frozen enums" instead of "closed enums", even though
  SE-0192 wasn't quite conclusive on this.
- Typealiases are treated as versioned entities for the purpose of
  verifying availability.
- Per SE-0193, inlinable functions do not have always-emit-into-client
  behavior.
- Rename the fragility attribute for properties and subscripts to
  '@inlinableAccess' for now, since '@inlinable' has been implemented
  for functions now. (We may still end up choosing to use the same
  name for these declarations too.)
- Private and fileprivate entities cannot be '@inlinable' today.
- We implemented the always-emit-into-client change for default
  arguments. They also have even stricter restrictions than most
  inlinable functions.
- A struct initializer can also assign to 'self' instead of delegating
  with `self.init`.
- Disallow adding new associated types to protocols for now.
- Mention that precedence groups exist.
- Mention that '@usableFromInline' exists.
- '@inlinable' can be backdated, even though all the other fragility
  attributes cannot.
- Tweak TODO around '@NSManaged'.
- Tweak list of planned proposals.

This document still deserves some more drastic restructuring to
separate the near-term features from the long-term features.
2018-07-16 15:40:29 -07:00
Dandigit
e745b9e270 Clarify WSL article link 2018-07-13 22:13:38 +10:00
Dandigit
4470d40192 Clarified article title, updated MSDN link 2018-07-13 22:12:01 +10:00
Dandigit
4f0a2645c6 Update WindowsSubsystemForLinux.md 2018-07-13 22:10:38 +10:00
Slava Pestov
330be4a38e SILOptimizer: Remove 'unique ID' from FSO mangling 2018-07-11 15:29:45 -07:00
Adrian Prantl
fdad9076f2 Revert "Add debug info support for inlined and specialized generic variables."
There is an assertion failure building the source compatibility suite that
needs to be investigated.

This reverts commit 91f6f34119.
2018-07-07 13:01:01 -07:00
Adrian Prantl
91f6f34119 Add debug info support for inlined and specialized generic variables.
This patch adds SIL-level debug info support for variables whose
static type is rewritten by an optimizer transformation. When a
function is (generic-)specialized or inlined, the static types of
inlined variables my change as they are remapped into the generic
environment of the inlined call site. With this patch all inlined
SILDebugScopes that point to functions with a generic signature are
recursively rewritten to point to clones of the original function with
new unique mangled names. The new mangled names consist of the old
mangled names plus the new substituions, similar (or exactly,
respectively) to how generic specialization is handled.

On libSwiftCore.dylib (x86_64), this yields a 17% increase in unique
source vars and a ~24% increase in variables with a debug location.

rdar://problem/28859432
rdar://problem/34526036
2018-07-06 22:06:48 -07:00
Ole Begemann
f8ad1a1bb6 [Docs] Fix broken markup in Request-Evaluator (#17793) 2018-07-06 12:15:35 -05:00
Doug Gregor
ef58259cd3 [Docs] Add another idea for the request-evaluator. 2018-07-05 22:43:27 -07:00
Doug Gregor
4682136903 [Docs] Add some more "open projects" for the request-evaluator. 2018-07-05 22:33:17 -07:00
Doug Gregor
a6a1f03148 [Docs] Add some documentation for the request-evaluator. 2018-07-05 22:24:38 -07:00
kitasuke
8e591b0820 Fix wrong blockquote 2018-07-01 17:35:04 +09:00
Robert Widmann
9aae5a6c5c Merge pull request #17513 from spencerkohan/patch-1
[Docs] Fix a typo in docs/WindowsCrossCompile.md
2018-06-28 07:22:05 -07:00
swift-ci
15c61cb442 Merge pull request #17572 from AndrewSB/patch-4 2018-06-27 18:44:10 -07:00
Michael Gottesman
e29c61e73e Merge pull request #17560 from gottesmm/pr-9d67c5b273eaafb2b9bb9f0568014de4ab1296af
[docs] Add a small section about running the static analyzer via clan…
2018-06-27 17:02:21 -07:00
Andrew Breckenridge
bcb3fe398f docs/Android: fix typo in build script invocation
@lanza please smoke test
2018-06-27 15:40:58 -07:00
Michael Gottesman
4a0409c1ff [docs] Add a link in DebuggingTheCompiler to the manual symbolication lldb guide on llvm.org 2018-06-27 09:21:27 -07:00
Michael Gottesman
35c99da8cd [docs] Add a small section about running the static analyzer via clang-tidy using compile_commands.json
I have been doing this every once in a while to look for problems. No point in
siloing this knowledge in my brain.
2018-06-27 09:21:10 -07:00
AnnaZaks
62b73105b5 Merge pull request #17309 from dplanitzer/windows_docu_update_1
Updated the Windows build documentation:
2018-06-26 21:38:16 -07:00
Mishal Shah
21cf9b33c8 Update table of contents for CI doc 2018-06-26 12:13:41 -07:00