Commit Graph

2383 Commits

Author SHA1 Message Date
Arnold Schwaighofer
cf5b5dcb68 Merge pull request #14440 from aschwaighofer/convert_function_to_trivial
SIL: Add a convert_function_to_trivial instruction for converting escaping t…
2018-02-07 05:11:36 -08:00
swift-ci
50637d1080 Merge pull request #14439 from AndrewSB/one-tenth-the-build-time-🤦‍♂️ 2018-02-06 19:05:04 -08:00
Arnold Schwaighofer
d51053b003 Add convert_escape_to_noescape instruction for converting escaping to noescape functions
@noescape function types will eventually be trivial. A
convert_escape_to_noescape instruction does not take ownership of its
operand. It is a projection to the trivial value carried by the closure
-- both context and implementation function viewed as a trivial value.

A safe SIL program must ensure that the object that the project value is based
on is live beyond the last use of the trivial value. This will be
achieve by means of making the lifetimes dependent.

For example:

  %e = partial_apply [callee_guaranteed] %f(%z) : $@convention(thin) (Builtin.Int64) -> ()
  %n = convert_escape_to_noescape %e : $@callee_guaranteed () -> () to $@noescape @callee_guaranteed () -> ()
  %n2 = mark_dependence %n : $@noescape @callee_guaranteed () -> () on %e : $@callee_guaranteed () -> ()
  %f2 = function_ref @use : $@convention(thin) (@noescape @callee_guaranteed () -> ()) -> ()
  apply %f2(%n2) : $@convention(thin) (@noescape @callee_guaranteed () -> ()) -> ()
  release_value %e : $@callee_guaranteed () -> ()

Note: This is not yet actually used.

Part of:
SR-5441
rdar://36116691
2018-02-06 18:01:23 -08:00
Andrew Breckenridge
063849d520 [docs][Windows] Build clang in Release mode instead of Debug
Should result in ~10x faster build times.
2018-02-06 11:16:04 -08:00
Andrew Breckenridge
5218326b27 [docs][Windows] Add forgotten ^ to LLVM_TARGETS_TO_BUILD 2018-02-06 11:07:16 -08:00
Arnold Schwaighofer
d981bb1d96 Mangling: noescape functions will be trivial and no longer compatible with escape function types.
Mangle escapeness as part of the type.

Part of:
SR-5441
rdar://36116691
2018-02-06 08:51:43 -08:00
Saleem Abdulrasool
63fe8c49b0 Merge pull request #14329 from AndrewSB/save-the-env-🌱
[docs][Windows] Add LLVM_TARGETS_TO_BUILD flag to LLVM CMake invocation
2018-02-06 08:20:48 -08:00
Erik Eckstein
4a0ec87294 docs: Mention the blockifyasm script in DebuggingTheCompiler 2018-02-02 15:31:47 -08:00
Andrew Breckenridge
65f3d21af5 [docs][Windows] Add LLVM_TARGETS_TO_BUILD flag to LLVM CMake invocation 2018-02-01 14:55:34 -08:00
Andrew Breckenridge
9eb4a0babf [docs][Windows] Add bash+cmd syntax highlighting in code snippets 2018-02-01 07:12:31 -08:00
swift-ci
6c0eb5d438 Merge pull request #14269 from AndrewSB/we-❤️-32bit-too 2018-01-31 17:23:37 -08:00
swift-ci
7ab3426f0c Merge pull request #14268 from AndrewSB/wut-is-dev-prompt 2018-01-31 13:07:04 -08:00
Doug Gregor
28c489c16d [ABI] Mangle retroactive conformances as part of bound generic types.
A "retroactive" protocol conformance is a conformance that is provided
by a module that is neither the module that defines the protocol nor
the module that defines the conforming type. It is possible for such
conformances to conflict at runtime, if defined in different modules
that were not both visible to the compiler at the same time.

When mangling a bound generic type, also mangle retroactive protocol
conformances that were needed to satisfy the generic requirements of
the generic type. This prevents name collisions between (e.g.) types
formed using retroactive conformances from different modules. The
impact on the size of the mangling is expected to be relatively small,
because most conformances are not retroactive.

Fixes the ABI part of rdar://problem/14375889.
2018-01-31 09:53:38 -08:00
Andrew Breckenridge
308eb46c2a [docs][Windows] Add instruction for 32-bit Windows 2018-01-30 18:10:57 -08:00
Andrew Breckenridge
9c667eea6b [docs][Windows] Add an explanation for what the developer prompt is 2018-01-30 18:09:53 -08:00
Joe Groff
a7a3b17597 Replace nominal type descriptors with a hierarchy of context descriptors.
This new format more efficiently represents existing information, while
more accurately encoding important information about nested generic
contexts with same-type and layout constraints that need to be evaluated
at runtime. It's also designed with an eye to forward- and
backward-compatible expansion for ABI stability with future Swift
versions.
2018-01-29 16:19:25 -08:00
Jordan Rose
e63879dc48 [Mangling] Define "related entity" operators 'LA'...'LJ'
(and 'La'...'Lj')

Use this for the synthesized structs for error enums, as described in
the previous commit, instead of reusing the "private discriminator"
feature. I left some space in the APIs for "related entity kinds" that
are longer than a single character, but I don't actually expect to use
it any time soon. It's mostly just easier to deal with StringRef than
with a bare char.

Note that this doesn't perfectly round-trip to the old mangling; I had
it treat these nodes as private discriminators with a prefixed "$"
instead. We don't depend on that for anything, though.
2018-01-24 10:52:46 -08:00
Doug Gregor
eb4f9a3d4c [ABI] Reserve space in the protocol descriptor for the superclass.
Extend protocol descriptors with a field for the superclass bound of the
protocol itself. This carves out space in the ABI for

    class C { }
    protocol P : C { ... }

although the feature is not yet implemented.
2018-01-19 14:03:24 -08:00
Doug Gregor
bc866086d9 [Mangling] Add a mangling for protocol conformance descriptors. 2018-01-17 10:33:30 -08:00
Doug Gregor
015dcfaee5 [ABI] Document the new-ish fields of protocol descriptors. 2018-01-12 11:48:00 -08:00
John McCall
3c54c0edfc IRGen and basic optimizer support for coroutines. 2018-01-09 11:35:09 -05:00
Erik Eckstein
9b99d3b771 docs: update type mangling rule in mangling ABI doc 2018-01-08 14:59:08 -08:00
Erik Eckstein
cd3d50a5d9 ABI: Change the mangling prefix from _T0 to $S 2018-01-06 13:55:59 -08:00
Pavel Yaskevich
fc64e34c8e Merge pull request #13701 from xedin/rdar-36278686
[Runtime/ABI] Optimize number of function metadata ABI endpoints
2018-01-05 21:47:13 -08:00
Pavel Yaskevich
86de71ee6d [Runtime/ABI] Remove swift_getFunctionTypeMetadata{1-3}WithFlags
Since it's not very common to use such ABI endpoints, let's remove
them and use the most general one `swift_getFunctionTypeMetadata`
instead when function parameters have flags attached to them.

Resolves: rdar://problem/36278686
2018-01-04 16:32:51 -08:00
Doug Gregor
afc5cf5bfb Merge pull request #13734 from DougGregor/nominal-type-refs
[Runtime] Never use type metadata references in conformance records.
2018-01-04 16:02:12 -08:00
pe-ter-
f875d1307b [docs] Rename isUniquelyReferencedNonObjC to isKnownUniquelyReferenced (#13633)
Because it has been removed in [3.0](https://github.com/apple/swift/blob/master/CHANGELOG.md#swift-30) (as a part of [SE-0125](https://github.com/apple/swift-evolution/blob/master/proposals/0125-remove-nonobjectivecbase.md))
2018-01-04 14:02:38 -08:00
Doug Gregor
cc3e3701b2 [Runtime] Eliminate the now-unused "NonuniqueDirectType" type reference kind.
Now that we use nominal type descriptors for everything that we can within
protocol conformance records, eliminate the unused
"NonuniqueDirectType" case and all of the code that supports it. Leave
this value explicitly reserved for the future.
2018-01-04 13:21:58 -08:00
Doug Gregor
7458640883 [Runtime] Add nominal type descriptor field to foreign class metadata.
Like other nominal type metadata, include a nominal type descriptor in
foreign class metadata.
2018-01-04 10:12:19 -08:00
Bob Wilson
c76942d528 Add doc whitespace to fix Sphinx error. 2018-01-03 21:20:50 -08:00
Doug Gregor
0632d8763a Merge pull request #13685 from DougGregor/protocol-conformance-record-cleanup
[Runtime] Improve representation of protocol conformance records
2018-01-03 14:11:00 -08:00
Doug Gregor
bfd2230c6d [Runtime] Eliminate ProtocolConformanceFlags.
Eliminate the separate flags field in protocol conformance records, now that
all of the information is stored in spare bits elsewhere. Reserve this
32-bit value for future use to describe conditional requirements.
2018-01-03 10:49:21 -08:00
Chris Lattner
415cd50ba2 Reduce array abstraction on apple platforms dealing with literals (#13665)
* Reduce array abstraction on apple platforms dealing with literals

Part of the ongoing quest to reduce swift array literal abstraction
penalties: make the SIL optimizer able to eliminate bridging overhead
 when dealing with array literals.

Introduce a new classify_bridge_object SIL instruction to handle the
logic of extracting platform specific bits from a Builtin.BridgeObject
value that indicate whether it contains a ObjC tagged pointer object,
or a normal ObjC object. This allows the SIL optimizer to eliminate
these, which allows constant folding a ton of code. On the example
added to test/SILOptimizer/static_arrays.swift, this results in 4x
less SIL code, and also leads to a lot more commonality between linux
and apple platform codegen when passing an array literal.

This also introduces a couple of SIL combines for patterns that occur
in the array literal passing case.
2018-01-02 15:23:48 -08:00
Doug Gregor
7e6f52308d [Runtime] Move conformance kind into low bits of witness table reference.
Move the 2-bit conformance reference kind from the conformance flags (which
is meant to go away) into the lower two bits of the witness table offset.
2018-01-02 12:34:06 -08:00
John McCall
9bbbe2c418 Update the metadata-initialization ABI:
- Create the value witness table as a separate global object instead
  of concatenating it to the metadata pattern.

- Always pass the metadata to the runtime and let the runtime handle
  instantiating or modifying the value witness table.

- Pass the right layout algorithm version to the runtime; currently
  this is always "Swift 5".

- Create a runtime function to instantiate single-case enums.

Among other things, this makes the copying of the VWT, and any
modifications of it, explicit and in the runtime, which is more
future-proof.
2017-12-21 00:26:37 -05:00
Pavel Yaskevich
98db9d01b7 [Mangling/ABI] NFC: Update ABI/Mangling.rst to reflect parameter label changes 2017-12-20 13:02:18 -08:00
swift-ci
973448a942 Merge pull request #13481 from CodaFi/who-copyedits-the-copyeditors 2017-12-15 21:12:35 -08:00
Nathaniel Manista
f027a3df38 Copy edits 2017-12-15 23:09:56 -05:00
Michael Gottesman
05deb32e52 [docs] Add a section about debugging the typechecker to DebuggingTheCompiler.rst. 2017-12-08 18:38:00 -08:00
Michael Gottesman
b99ac1e4ff [docs] Be consistent about rst headings. 2017-12-08 18:29:12 -08:00
Slava Pestov
4d21d127aa Mangler: Add mangling for class metadata base offset 2017-12-08 13:50:56 -08:00
Erik Eckstein
97a361f867 docs: add ABI docs to contents 2017-12-05 09:17:45 -08:00
Erik Eckstein
c9f28c81c2 docs: fix sphinx build error 2017-12-05 09:17:44 -08:00
Doug Gregor
31723be232 Merge pull request #13264 from DougGregor/se-0143-better-fail-than-crash
[Runtime] Always fail to find a conditional conformance at runtime.
2017-12-04 21:50:25 -08:00
Doug Gregor
4f8edeb913 [Runtime] Always fail to find a conditional conformance at runtime.
Proper evaluation of conditional conformances at runtime (e.g., as part of
dynamic casting) is too large to tackle in the Swift 4.1 timeframe. For now,
record that a conformance is conditional in the protocol conformance record,
and always return "does not conform" to such types.

Fixes rdar://problem/35761301.
2017-12-04 16:51:52 -08:00
Erik Eckstein
ee608763c2 docs: small simplification and added comments in the mangling grammar doc. 2017-12-04 15:41:21 -08:00
Greg Parker
da14cd79a6 [runtime] Clean up symbol exports in libc functions. (#13202) 2017-12-01 17:49:11 -08:00
Jordan Rose
8f8f00012a Merge pull request #12834 from jrose-apple/restrict-cross-module-struct-initializers-2
Implementation of SE-0189 "Restrict cross-module struct initializers to be delegating"

rdar://problem/34777878
2017-11-30 13:32:45 -08:00
Thomas Roughton
01891c0ca8 Clarify Associated Type Inference and SE-0108
Just a minor edit for clarity while reading through the generics documentation. Previously, this read as if associated type inference itself, and not the proposal to remove it, was rejected.
2017-11-27 02:39:16 -05:00
Darío Hereñú
4dd8fc6c64 Minor fix on subtitle (styling) 2017-11-21 18:22:26 -08:00