Commit Graph

4421 Commits

Author SHA1 Message Date
Erik Eckstein
30cd3869b9 Mangling: add a new mangling for generic specialization
For performance annotations we need the generic specializer to trop non-generic metatype argumentrs
(which we don't do in general). For this we need a separate mangling.
2022-07-07 08:34:53 +02:00
John McCall
175f74d38f Implement symbolic demangling for extended existential metadata
Fixes rdar://96268090.
2022-07-01 11:21:53 -04:00
Robert Widmann
19b27c5eb7 Merge pull request #59763 from CodaFi/mangolia 2022-06-30 20:46:38 -07:00
Robert Widmann
dde0d8f609 Generalize the Mangling of Constrained Existential Types
Upgrade the old mangling from a list of argument types to a
list of requiremnets. For now, only same-type requirements
may actually be mangled since those are all that are available
to the surface language.

Reconstruction of existential types now consists of demangling (a list of)
base protocol(s), decoding the constraints, and converting the same-type
constraints back into a list of arguments.

rdar://96088707
2022-06-30 15:32:37 -07:00
swift-ci
9aa2de4137 Merge pull request #41083 from kavon/inconvenienced-actors
[SE-327] Remove need for `convenience` for delegating initializers of an actor.
2022-06-30 14:56:32 -07:00
Kavon Farvardin
41134ea8a0 Remove the need for convenience on actor inits to delegate.
This is possible because actors do not support inheritance. There
is one specific exception to that rule, which is that an actor
can inherit from `NSObject` just to support ObjC interop.

This means an actor is effectively a final class.

resolves rdar://87568153
2022-06-27 16:01:08 -07:00
Saleem Abdulrasool
3d950362b4 Merge pull request #59684 from compnerd/vcruntime
platform: restructure visualc module
2022-06-27 10:20:23 -07:00
Saleem Abdulrasool
fc070c6167 platform: restructure visualc module
Restructure the `visualc` module into `vcruntime` in order to help
expose the various components (SAL, vcruntime, ucrt, corecrt, STL) for C++
modularization.  Include the `stdint.h` textually to deal with
redefinition of types in clang resources and MSVC.
2022-06-26 14:06:59 -07:00
Philip Turner
393986de73 Capitalize "Intel" in GettingStarted.md 2022-06-26 15:31:29 -04:00
Egor Zhdan
156f081308 Merge pull request #59588 from apple/egorzhdan/hosttools-docs
[SwiftCompilerSources][docs] Describe using `hosttools` builds with a locally built toolchain
2022-06-21 10:53:27 +01:00
Egor Zhdan
b64c2b071a [SwiftCompilerSources][docs] Describe using hosttools builds with a locally built toolchain 2022-06-20 13:30:38 +01:00
Alex Lorenz
09b2e05258 Merge pull request #59550 from hyp/docs-reverse-update
[docs] Update CppInteroperabilityStatus for reverse interop
2022-06-17 19:32:03 -07:00
Alex Lorenz
e155b1bd87 [docs] Update CppInteroperabilityStatus for reverse interop 2022-06-17 17:07:53 -07:00
Erik Eckstein
718de937b7 Add a mangling for constant static arrays.
The layout of constant static arrays differs from non-constant static arrays.
Therefore use a different mangling to get symbol mismatches if for some reason two modules don't agree on which version a static array is.
2022-06-17 11:21:29 +02:00
0x41c
156f02c8df [Docs] Add note for intel users when setting up clion 2022-06-15 14:34:17 -07:00
Michael Gottesman
234280439a [docs] Add a small howto on setting up LSP/Emacs as a C++ IDE for working on the compiler code base.
I recently helped @aprantl to set this up on their machine, so I figured I
should just add it as a HOWTO for the benefit of additional engineers.
2022-06-13 10:40:23 -07:00
eeckstein
2d2a56fe44 Merge pull request #59360 from eeckstein/fix-store-borrow-verification
Fix store borrow verification
2022-06-13 09:39:53 +02:00
swift-ci
7653b6b738 Merge pull request #39893 from 3405691582/DocUpdateForOpenBSD70
[docs] Update for OpenBSD 7.1.
2022-06-11 13:00:02 -07:00
3405691582
37e2b1c8a4 [docs] Update for OpenBSD 7.1.
Make the following documentation changes:

* update last tested version number and emphasize that the process
  may work for later platform versions,

* update required packages to emphasize py3 instead of py2.7,

* python3 link is not strictly required to need root.

* update the suggested checkout config file to the stable branch used
  in the "upstream" checkout config file, and

* mention some extra flags are now required to properly switch off
  Dispatch (since without pr apple/swift-corelibs-libdispatch#559
  Dispatch won't compile).

* reinforce building release by default, since the flags likely needed
  for debug builds aren't provided in the command snippet.
2022-06-11 12:48:58 -04:00
Michael Gottesman
2bae905299 [SIL.rst] Fix two rst errors to fix the build. 2022-06-10 16:23:18 -07:00
Erik Eckstein
a98d9af49f docs: document that a store_borrow location must not be modified by other instructions. 2022-06-10 11:13:29 +02:00
Michael Gottesman
e1006c62f9 [move-only] Add copyable_to_moveonlywrapper and moveonlywrapper_to_copyable instructions.
These instructions have the following attributes:

1. copyably_to_moveonlywrapper takes in a 'T' and maps it to a '@moveOnly
T'. This is semantically used when initializing a new moveOnly binding from a
copyable value. It semantically destroys its input @owned value and returns a
brand new independent @owned @moveOnly value. It also is used to convert a
trivial copyable value with type 'Trivial' into an owned non-trivial value of
type '@moveOnly Trivial'. If one thinks of '@moveOnly' as a monad, this is how
one injects a copyable value into the move only space.

2. moveonlywrapper_to_copyable takes in a '@moveOnly T' and produces a new 'T'
value. This is a 'forwarding' instruction where at parse time, we only allow for
one to choose it to be [owned] or [guaranteed].

* moveonlywrapper_to_copyable [owned] is used to signal the end of lifetime of
the '@moveOnly' wrapper. SILGen inserts these when ever a move only value has
its ownership passed to a situation where a copyable value is needed. Since it
is consuming, we know that the no implicit copy checker will ensure that if we
need a copy for it, the program will emit a diagnostic.

* moveonlywrapper_to_copyable [guaranteed] is used to pass a @moveOnly T value
as a copyable guaranteed parameter with type 'T' to a function. In the case of
using no-implicit-copy checking this is always fine since no-implicit-copy is a
local pattern. This would be an error when performing no escape
checking. Importantly, this instruction also is where in the case of an
@moveOnly trivial type, we convert from the non-trivial representation to the
trivial representation.

Some important notes:

1. In a forthcoming commit, I am going to rebase the no implicit copy checker on
top of these instructions. By using '@moveOnly' in the type system, we can
ensure that later in the SIL pipeline, we can have optimizations easily ignore
the code.

2. Be aware of is that due to SILGen only emitting '@moveOnly T' along immediate
accesses to the variable and always converts to a copyable representation when
calling other code, we can simply eliminate from the IR all moveonly-ness from
the IR using a lowering pass (that I am going to upstream). In the evil scheme
we are accomplishing here, we perform lowering of trivial values right after
ownership lowering and before diagnostics to simplify the pipeline.

On another note, I also fixed a few things in SILParsing around getASTType() vs
getRawASTType().
2022-06-09 19:47:31 -07:00
Butta
9d5a7a5877 [android] Update to LTS NDK 23c
Also, switch the build instructions in the doc to the much more common AArch64,
add instructions to cross-compile a standalone stdlib with a prebuilt toolchain,
and add missing Concurrency library and its dependencies to the list of Swift
libraries to copy over.
2022-06-06 21:43:47 +05:30
eeckstein
967e3c75f4 Merge pull request #59049 from eeckstein/utility-proposal
docs: add a proposal for Swift SIL utilities
2022-05-29 13:39:03 +02:00
Erik Eckstein
a07c2ad852 docs: add a proposal for Swift SIL utilities 2022-05-27 16:34:55 +02:00
Si Beaumont
3b76fd82a6 [docs] Fix typo in LibraryEvolution.rst
Signed-off-by: Si Beaumont <beaumont@apple.com>
2022-05-26 13:29:34 +01:00
Erik Eckstein
9335249e90 docs: add a reference from GettingStarted to DevelopmentTips 2022-05-23 16:12:26 +02:00
Erik Eckstein
c053ab623c docs: a few minor fixes/improvements in DevelopmentTips.md 2022-05-23 14:45:32 +02:00
Erik Eckstein
eb51264f57 docs: add documentation about the bootstrapping modes 2022-05-23 10:46:32 +02:00
Erik Eckstein
d97b786ca4 docs: document working with two build directories 2022-05-23 10:46:32 +02:00
Erik Eckstein
5566c7529e docs: describe how to use Xcode together with ninja 2022-05-23 10:46:32 +02:00
Luciano Almeida
0a133e8df7 Merge pull request #58815 from LucianoPAlmeida/docs-gardening
[Docs] Updating Getting started documentation from JIRA to Swift Issues
2022-05-12 20:21:50 -03:00
Slava Pestov
e80150d429 RequirementMachine: Minor documentation updates
This just deletes some outdated material, but really the whole paper
needs an overhaul and some major additions to describe generic
signature minimization too.
2022-05-12 10:19:13 -07:00
Luciano Almeida
efdf354a29 [Docs] Updating Getting started documentation from JIRA to Swift Issues 2022-05-11 22:17:47 -03:00
Alex Hoppen
29639f17e5 Merge pull request #40873 from philipturner/patch-5 2022-05-09 11:19:14 +02:00
Joseph Kato
a1a5038863 [NFC] Fix a few typos (#58739)
* typo: "an an" -> "an"

* typo: "used used" -> "used"

* typo: "template template" -> "template"

* typo: "is is" -> "it is"

* typo: "lastest" -> "latest"

* typo: "instantanious" -> "instantaneous"
2022-05-08 10:27:54 -03:00
Philip Turner
e43d1e0daf Update RequirementMachine.tex 2022-04-24 19:47:08 -04:00
John McCall
bd77714537 Unique extended existential shapes using the generalized AST type.
I wrote out this whole analysis of why different existential types
might have the same logical content, and then I turned around and
immediately uniqued existential shapes purely by logical content
rather than the (generalized) formal type.  Oh well.  At least it's
not too late to make ABI changes like this.

We now store a reference to a mangling of the generalized formal
type directly in the shape.  This type alone is sufficient to unique
the shape:

- By the nature of the generalization algorithm, every type parameter
  in the generalization signature should be mentioned in the
  generalized formal type in a deterministic order.

- By the nature of the generalization algorithm, every other
  requirement in the generalization signature should be implied
  by the positions in which generalization type parameters appear
  (e.g. because the formal type is C<T> & P, where C constrains
  its type parameter for well-formedness).

- The requirement signature and type expression are extracted from
  the existential type.

As a result, we no longer rely on computing a unique hash at
compile time.

Storing this separately from the requirement signature potentially
allows runtimes with general shape support to work with future
extensions to existential types even if they cannot demangle the
generalized formal type.

Storing the generalized formal type also allows us to easily and
reliably extract the formal type of the existential.  Otherwise,
it's quite a heroic endeavor to match requirements back up with
primary associated types.  Doing so would also only allows us to
extract *some* matching formal type, not necessarily the *right*
formal type.  So there's some good synergy here.
2022-04-21 23:47:01 -04:00
Josh Soref
0213f2dd88 Spelling docs (#42437)
* spelling: any

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: associated

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: async

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: classes

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: clonability

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: conspicuously

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: constituent

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: constraint

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: contains

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: definition

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: digestible

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: for

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: github

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: javascript

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: manually

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: much

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: multi

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: occasionally

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: outputs

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: overriding

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: partition

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: propagation

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: protocol

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: quandary

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: redundant

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: responsible

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: right

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: specifically

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: suppose

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: that

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: the

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: with

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
2022-04-19 14:04:59 -07:00
Allan Shortlidge
d3dbe75419 ModuleInterface: Introduce the %target-swift-emit-module-interface and %target-swift-typecheck-module-from-interface lit substitutions and adopt them in some tests that involve emitting a swiftinterface. The substitutions specify the additional flags -swift-version 5 -enable-library-evolution. There are a few motivations for adding these substitutions:
- Tests that depend on emitted interfaces should generally use flags that are typical for modules that have textual interfaces (e.g. `-enable-library-evolution`).
- If a test is intended to produce a valid `swiftinterface` then it should verify that interface. This will help prevent interface printing regressions caused by compiler changes.
- Having commonly used substitutions for tests that emit interfaces makes it easy to experiment with compiler flags that might effect interface printing.

Resolves rdar://91634358
2022-04-14 15:09:36 -07:00
Daniel Duan
3dfc40898c [NFC] Remove Python 2 imports from __future__ (#42086)
The `__future__` we relied on is now,  where the 3 specific things are
all included [since Python 3.0](https://docs.python.org/3/library/__future__.html):

* absolute_import
* print_function
* unicode_literals
* division

These import statements are no-ops and are no longer necessary.
2022-04-13 14:01:30 -07:00
Egor Zhdan
93ce94a05f [Docs] Remove dead link to CentOS 8 Dockerfile
CentOS 8 is no longer supported after https://github.com/apple/swift-docker/pull/273
2022-04-13 14:57:24 +01:00
John McCall
d079679e0c Merge pull request #42317 from rjmccall/build-constrained-existential-metadata
IR generation for constrained existentials
2022-04-12 19:37:53 -04:00
John McCall
24616aed5c Mangling support for extended existential type shapes 2022-04-11 22:25:11 -04:00
Luciano Almeida
ed7981f9a6 [Docs] Update section about integrated repl that was removed in Debugging the compiler docs file 2022-04-11 16:29:26 -03:00
Meghana Gupta
3459000278 Merge pull request #42246 from meg-gupta/closureopaque
[SIL Opaque Value] Fix some SILGen issues for closures when opaque values are enabled
2022-04-08 12:11:17 -07:00
zoecarver
839839f924 [cxx-interop] Rename enable-cxx-interop -> enable-experimental-cxx-interop.
Also removes the driver flag, this will now also always be guarded on `-Xfrontend`.
2022-04-07 19:15:25 -07:00
Meghana Gupta
d43a6e12f2 NFC: Remove documentation of deleted opcodes 2022-04-06 21:05:37 -07:00
Alex Lorenz
a6bb23b628 [docs][cxx-interop] Mention no bridging for C++ standard library types 2022-04-05 15:46:26 -07:00
Zoe Carver
3505175301 Merge pull request #42149 from zoecarver/docs/interop-oddities 2022-04-05 08:43:35 -07:00