Commit Graph

2735 Commits

Author SHA1 Message Date
Slava Pestov
4cecc268dc IRGen: Emit Objective-C metadata update callbacks 2018-10-26 16:54:23 -04:00
Doug Gregor
b5bc06e552 [ABI] Eliminate witness table accessors.
Witness table accessors return a witness table for a given type's
conformance to a protocol. They are called directly from IRGen
(when we need the witness table instance) and from runtime conformance
checking (swift_conformsToProtocol digs the access function out of the
protocol conformance record). They have two interesting functions:

1) For witness tables requiring instantiation, they call
swift_instantiateWitnessTable directly.
2) For synthesized witness tables that might not be unique, they call
swift_getForeignWitnessTable.

Extend swift_instantiateWitnessTable() to handle both runtime
uniquing (for #2) as well as handling witness tables that don't have
a "generic table", i.e., don't need any actual instantiation. Use it
as the universal entry point for "get a witness table given a specific
conformance descriptor and type", eliminating witness table accessors
entirely.

Make a few related simplifications:

* Drop the "pattern" from the generic witness table. Instead, store
  the pattern in the main part of the conformance descriptor, always.
* Drop the "conformance kind" from the protocol conformance
  descriptor, since it was only there to distinguish between witness
  table (pattern) vs. witness table accessor.
* Internalize swift_getForeignWitnessTable(); IRGen no longer needs to
  call it.

Reduces the code size of the standard library (+assertions build) by
~149k.

Addresses rdar://problem/45489388.
2018-10-25 20:35:27 -07:00
andreanmasiro
ca53d0b5bd Fix guard-else typo (#20042) 2018-10-25 14:27:08 -07:00
Nathan Lanza
1d551cbddb Merge pull request #20006 from jmittert/EnhanceWindowsDocs
Clarified Windows build docs
2018-10-24 12:50:35 -07:00
Jordan Rose
25c19bb11c Merge pull request #19451 from jrose-apple/stable-view
[Serialization] Give swiftdocs a stable version
2018-10-24 08:33:05 -07:00
Jordan Rose
76e5488aec Docs on how to make backwards-compatible changes using LLVM bitstream 2018-10-23 19:55:44 -07:00
Jason Mittertreiner
c4021d8720 Clarified Windows build docs
- The module maps need to be renamed to module.modulemap
- The module maps need to be copied for non cross compiled builds as well
- The cmake variable is DIRS not DIR
2018-10-23 17:57:53 -07:00
Doug Gregor
5b41ac16db [ABI] Introduce indirect symbolic references to context descriptors.
Extending the mangling of symbolic references to also include indirect
symbolic references. This allows mangled names to refer to context
descriptors (both type and protocol) not in the current source file.

For now, only permit indirect symbolic references within the current module,
because remote mirrors (among other things) is unable to handle relocations.

Co-authored-by: Joe Groff <jgroff@apple.com>
2018-10-23 16:06:42 -07:00
Doug Gregor
8d3da66823 [Doc] Update mangling document with historical prefixes.
Co-authored-by: Joe Groff <jgroff@apple.com>
2018-10-23 16:00:04 -07:00
Doug Gregor
a0e3258ba6 [ABI] Collapse generic witness table into protocol conformance record.
Collapse the generic witness table, which was used only as a uniquing
data structure during witness table instantiation, into the protocol
conformance record. This colocates all of the constant protocol conformance
metadata and makes it possible for us to recover the generic witness table
from the conformance descriptor (including looking at the pattern itself).

Rename swift_getGenericWitnessTable() to swift_instantiateWitnessTable()
to make it clearer what its purpose is, and take the conformance descriptor
directly.
2018-10-22 23:36:31 -07:00
Doug Gregor
1c02bfe4e5 [IRGen] Remove dead code for creating resilient witness table globals.
Resilient witness tables are no longer separate entities.
2018-10-12 15:41:45 -07:00
Harlan
00cc011621 [SILOptimizer] Don't diagnose infinite recursion if a branch terminates the program (#19781)
* [SILOptimizer] Don't diagnose infinite recursion if a branch terminates the program

This patch augments the infinite recursion checker to not warn if a
branch terminates, but still warns if a branch calls into something with
@_semantics("programtermination_point"). This way, calling fatalError
doesn't disqualify you for the diagnostic, but calling exit does.

This also removes the warning workaround in the standard library, and
annotates the internal _assertionFailure functions as
programtermination_points, so they get this treatment too.

* Fix formatting in SILInstructions.cpp

* Re-add missing test
2018-10-09 09:46:37 -07:00
Graydon Hoare
cc16ddfd13 Revert "[SILOptimizer] Don't diagnose infinite recursion if a branch terminates (#19724)"
This reverts commit e94450e840.

rdar://45080912
2018-10-07 23:54:33 -07:00
Harlan
e94450e840 [SILOptimizer] Don't diagnose infinite recursion if a branch terminates (#19724)
This patch augments the infinite recursion checker to not warn if a
branch terminates, but still warns if a branch calls into something with
`@_semantics("arc.programtermination_point")`. This way, calling `fatalError`
doesn't disqualify you for the diagnostic, but calling `exit` does.

This also removes the warning workaround in the standard library, and
annotates the internal _assertionFailure functions as
`programtermination_point`s, so they get this treatment too.
2018-10-05 19:15:26 -07:00
Azoy
464fb1678f Update Mangling Docs 2018-10-05 12:07:42 -05:00
Mike Ash
1131507578 [Testing] Add a substitution for %target-is-simulator. 2018-10-04 12:32:50 -04:00
Doug Gregor
441fee071a [Witness tables] Use a discriminator bit for default associated type witnesses
Indicate whether a particular associated type witness is a default (whose
mangled name is relative to the protocol) vs. being supplied as part of the
conformance (whose mangled name is relative to the conforming type). The
use of pointer identity to distinguish these cases can fail due to the
coalescing of these linker symbols.
2018-09-27 13:26:31 -07:00
Mike Ash
1fb165a0ea Merge branch 'master' into rename-conflicting-classes-and-methods 2018-09-24 10:17:22 -04:00
Mike Ash
49c3547449 Merge remote-tracking branch 'origin/master' into rename-conflicting-classes-and-methods 2018-09-21 15:52:38 -04:00
Dave Lee
5f461798b5 Link to docs referenced from Driver.md (#19420) 2018-09-21 11:26:33 -07:00
Doug Gregor
32fd274f5e Merge pull request #19391 from DougGregor/assoc-conformance-default-witnesses
[ABI] Associated conformance defaults
2018-09-19 13:15:46 -07:00
Mishal Shah
21654c3685 Update CI docs to include new Linux trigger 2018-09-18 18:08:25 -07:00
Zedd
1dcc8e020a class -> AnyObject 2018-09-18 16:12:55 +09:00
Doug Gregor
b71bef1e42 [ABI] Mangling for default associated conformance accessors.
Default associated conformance accessors will be used in default
witness tables to fill in associated conformances for defaulted
associated types. Add (de|re|)mangling support for them and make them
linking entities in IRGen.
2018-09-17 22:45:15 -07:00
Doug Gregor
241bcdf85c [ABI] Document associated conformance descriptors. 2018-09-17 17:40:24 -07:00
Doug Gregor
b6efa97b3e Merge pull request #19349 from ravikandhadai/master
[Docs] Fix minor typos in the ownership manifesto.
2018-09-17 15:30:48 -07:00
Ravi Kandhadai
80463c5001 [Docs] Fix minor typos in the ownership manifesto. 2018-09-17 15:17:53 -07:00
Doug Gregor
2ef9363bd1 [ABI] Add default associated type witnesses to resilient protocols.
When an associated type witness has a default, record that as part of
the protocol and emit a default associated type metadata accessor into the
default witness table. This allows a defaulted associated type to be
added to a protocol resiliently.

This is another part of rdar://problem/44167982, but it’s still very
limiting because the new associated type cannot have any conformances.
2018-09-15 22:04:46 -07:00
Doug Gregor
78f3017436 Merge pull request #19266 from DougGregor/associated-type-resilience
Associated type resilience
2018-09-15 21:03:13 -07:00
Felix Wehnert
2c3ce9b5ba Fixed typo in example code 2018-09-15 18:24:04 +02:00
Doug Gregor
bbe56b284a [ABI] Add protocol requirements base descriptor.
Introduce an alias that refers one element prior to the start of a
protocol descriptor’s protocol requirements. This can be subtracted from
an associated type descriptor address to determine the offset of the
associated type accessor within a corresponding witness table. The code
generation for the latter is not yet implemented.
2018-09-14 20:59:03 -07:00
Doug Gregor
9873d52814 [ABI] Emit associated type descriptors referencing each requirement.
Emit associated type descriptors (as aliases) to reference each associated
type requirement within a resilient protocol.
2018-09-14 20:59:03 -07:00
Jordan Rose
9161da5a39 [docs] Add "WIP" and "DNM" to Lexicon.rst (#19329)
"WIP" is hardly unique to Swift, but it is a three-letter acronym that
someone might not have encountered before. "DNM" seems to have arisen
organically over the last few weeks.
2018-09-14 16:36:18 -07:00
Mike Ash
798edb9d0e [Runtime][Stdlib][Overlays] Rename various Objective-C classes and methods that would conflict when loading old Swift libraries into a process alongside ABI-stable libraries.
rdar://problem/35768222
2018-09-13 16:55:10 -04:00
Slava Pestov
2990271686 IRGen: Add mangling for method lookup functions 2018-09-07 21:50:58 -07:00
Graydon Hoare
4fcdbaccd0 [Docs] Remove FrontendStatsTracer task from request-evaluator open projects. 2018-09-04 16:04:06 -07:00
Ray Fix
3f49124d99 Update Lexicon.rst
Add missing curly brace so that Bar isn't nesting in Foo.
2018-09-01 09:04:41 +09:00
Slava Pestov
dad44cdd4a IRGen: Introduce 'method descriptor' mangling 2018-08-31 00:20:38 -06:00
Alex Hoppen
49d0d5b7a3 [libSyntax] Make the ByteTree protocol version consist of a major and minor component 2018-08-29 13:40:50 -07:00
Mishal Shah
11f70e4cd2 @swift-ci now supports Source Compatibility in debug and release 2018-08-28 22:43:35 -07:00
YOCKOW
bbb1220162 [docs] Replace ":=" with "::=" in "docs/ABI/Mangling.rst".
Nowadays, "::=" is used rather than ":=" in BNF.
2018-08-28 14:50:49 +09:00
YOCKOW
22e023f159 [docs] Replace all spaces with U+0020 in "docs/ABI/Mangling.rst".
Unfortunately, in some systems, spaces other than U+0020 can not be recognized as space-characters.
2018-08-28 14:43:14 +09:00
Erik Eckstein
8f35a3eff7 runtime: remove pinning in reference counting and pinning runtime entry points
rdar://problem/35401813
2018-08-25 11:14:18 -07:00
Erik Eckstein
c6eb5fe82a minor follow-ups for remove pinning in utilities and docs 2018-08-25 11:14:18 -07:00
Alex Hoppen
f97d13d984 Merge pull request #18889 from ahoppen/bytetree-forward-compatible
[libSyntax] Make the ByteTree format forwards-compatible
2018-08-24 10:47:26 -07:00
Erik Eckstein
99a9ed5535 SIL: remove the pinning instructions: strong_pin, strong_unpin, is_unique_or_pinned
They are not used anymore after removing the pinning addressors.
2018-08-23 12:47:56 -07:00
Erik Eckstein
6ba45473df Remove the pinning addressors
It was used for Array + related types.
With exclusivity checking the pinned addressors are not useful anymore.

rdar://problem/35401528
2018-08-23 12:47:56 -07:00
Jordan Rose
8c48e39e42 [test] Add --param remote_run_extra_args (#18885)
This goes with 810b240354: if we want to pass extra arguments to SSH
when using remote-run, there has to be a way to get them to remote-run
when using lit.
2018-08-22 13:19:03 -07:00
Alex Hoppen
34a89d45e2 [libSyntax] Make the ByteTree format forwards-compatible 2018-08-22 12:07:57 -07:00
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