Commit Graph

4371 Commits

Author SHA1 Message Date
Michael Gottesman
7ae56aab2e [sil] Add a new instruction ignored_use.
This is used for synthetic uses like _ = x that do not act as a true use but
instead only suppress unused variable warnings. This patch just adds the
instruction.

Eventually, we can use it to move the unused variable warning from Sema to SIL
slimmming the type checker down a little bit... but for now I am using it so
that other diagnostic passes can have a SIL instruction (with SIL location) so
that we can emit diagnostics on code like _ = x. Today we just do not emit
anything at all for that case so a diagnostic SIL pass would not see any
instruction that it could emit a diagnostic upon. In the next patch of this
series, I am going to add SILGen support to do that.
2025-01-22 21:12:36 -08:00
Anthony Latsis
76d1ea3fd5 Merge pull request #78760 from AnthonyLatsis/solanum-melongena
docs: Fully spell out the name of `docs/ABI/CallConvSummary.rst`
2025-01-23 01:03:50 +00:00
Anthony Latsis
cbe420c79d docs: Fully spell out the name of docs/ABI/CallConvSummary.rst
"Conv" is ambiguous. Perhaps "CallConv" is not, but the full name is
still more helpful for those of us browsing or searching for targeted
info.
2025-01-22 21:05:42 +00:00
eeckstein
d314541245 Merge pull request #78715 from eeckstein/fix-typos
docs: fix two typos in SIL.md
2025-01-20 12:14:18 +01:00
Erik Eckstein
6907e26dd8 docs: fix two typos in SIL.md 2025-01-17 20:08:11 +01:00
Michael Gottesman
cb2d7560a4 [rbi] Fix demangling of sending results.
The issue here is that the demangler (since we have a postfix mangling) parses
parameters/results/etc and then uses earlier postfix type arguments to attach
the relevant types to the parameters/results/etc. Since the flag for a sending
result was placed in between the parameters and results, we get an off by one
error.

Rather than fix that specific issue by introducing an offset for the off by one
error, I used the fact that the impl-function part of the mangling is not ABI
and can be modified to move the bit used to signify a sending result to before
the parameters so the whole problem is avoided.

I also while I was doing this looked through the sending result mangling for any
further issues and fixed them as I found them.

rdar://141962865
2025-01-14 15:38:02 -08:00
John McCall
fa932e736c Fix the demangling of sending result types when combined with isolation
Fixes the immediate problem, but the presence of demangling code in the
runtime means that we'll need a follow-up to fix the compiler so that it
doesn't try to use the demangler to materialize metadata for function types
that have both isolation and a sending result.

rdar://142443925
2025-01-10 21:11:45 -05:00
Anthony Latsis
062061e37a Merge pull request #78235 from AnthonyLatsis/aloe-vera
Sema: Minor adjustment to `BindingSet` dumping
2025-01-04 15:13:10 +00:00
Anthony Latsis
a6e5e19512 Sema: Minor adjustment to BindingSet dumping
Shorten some of the keys and format them consistently as sentence
fragments rather than identifiers.
2025-01-04 11:27:54 +00:00
eeckstein
aed60d6740 Merge pull request #78403 from eeckstein/borrow-scope-doc
docs: add a section about borrow scopes in SIL.md
2025-01-03 08:02:56 +01:00
Erik Eckstein
1753c81ce3 docs: add a section about borrow scopes in SIL.md 2025-01-02 17:12:42 +01:00
NinjaLikesCheez
fc3c18b3b4 [doc] Fix links to SIL documentation in docs/README.md 2024-12-16 15:26:03 +01:00
Egor Zhdan
c75507511c [docs] Remove duplicated paragraph in the Testing guide 2024-12-03 19:29:15 +00:00
Kuba Mracek
23cfca22d0 [embedded] Explain new prefix in docs, fix comments 2024-12-02 15:01:24 -08:00
Jamie
e9b131af81 [docs]: fix typo in compilation-model.tex 2024-11-26 04:43:37 -06:00
Erik Eckstein
2a335502c8 docs: Overhaul the documentation for SIL
With a focus on updating the documentation of Ownership SSA.

The main changes are:

* Created a new directory `docs/SIL` and  moved all SIL-related files into this directory.

* Converted `rst` files to markdown.

* Extracted sections from `SIL.md` which go into very much detail - including the instruction reference - into separate files: `Types.md`, `Ownership.md`, `FunctionAttributes.md`, `Instructions.md`. Those files are referenced from `SIL.md` at the relevant places.

* Rewrote and updated the OSSA part in `SIL.md`

* Removed a few sections, which are not relevant anymore, like "Value dependency" (which is replaced by ownership concepts).

* Fixed and improved a lot of small things.
2024-11-21 08:50:20 +01:00
Andrew Trick
7255c412c2 SIL.rst: mark_dependence: minor typo and reformatting 2024-11-18 22:02:44 -08:00
Slava Pestov
7ad160a971 docs: Update generics.tex
Overhaul the "Conformance Paths" chapter to use the new notation
for derived requirements.
2024-11-16 22:05:52 -05:00
Konrad `ktoso` Malawski
45d15d1268 Merge pull request #76460 from finagolfin/ndk27 2024-11-15 17:50:40 +09:00
John Hui
cc8c5bb01e [doc] Fix typo in shell command from Getting Started guide (#77634) 2024-11-15 00:42:01 -08:00
Finagolfin
22833fbc54 [android] Update to LTS NDK 27c
Add a new bits/ header to the Android overlay, include runtime libraries that are
auto-extracted and listed many times to the list of libraries to be de-duplicated,
enable a C++ interop test that's working again, and update the doc with new
libraries that need to be available to run a simple executable.
2024-11-14 00:11:53 +05:30
Hamish Knight
03d8ea5248 Introduce swift-xcodegen
This is a tool specifically designed to generate
Xcode projects for the Swift repo (as well as a
couple of adjacent repos such as LLVM and Clang).
It aims to provide a much more user-friendly experience
than the CMake Xcode generation (`build-script --xcode`).
2024-11-05 22:42:10 +00:00
Daniel Rodríguez Troitiño
2f62bf4e04 [docs] Add a couple of paragraphs about swift_feature in testing.md
Quickly explain the feature, its intended usage and a warning about not
longer needing `REQUIRES: asserts` anymore.`
2024-11-02 11:46:47 -07:00
Michael Gottesman
3c38c79f7a [region-isolation] Implement MergeIsolationRegionInst.
I am adding this instruction to express artificially that two non-Sendable
values should be part of the same region. It is meant to be used in cases where
due to unsafe code using Sendable, we stop propagating a non-Sendable dependency
that needs to be made in the same region of a use of said Sendable value. I
included an example in ./docs/SIL.rst of where this comes up with @out results
of continuations.
2024-11-01 11:25:53 -07:00
Hamish Knight
2d7500eda6 [AST] Remove ParenType
Today ParenType is used:

1. As the type of ParenExpr
2. As the payload type of an unlabeled single
   associated value enum case (and the type of
   ParenPattern).
3. As the type for an `(X)` TypeRepr

For 1, this leads to some odd behavior, e.g the
type of `(5.0 * 5).squareRoot()` is `(Double)`. For
2, we should be checking the arity of the enum case
constructor parameters and the presence of
ParenPattern respectively. Eventually we ought to
consider replacing Paren/TuplePattern with a
PatternList node, similar to ArgumentList.

3 is one case where it could be argued that there's
some utility in preserving the sugar of the type
that the user wrote. However it's really not clear
to me that this is particularly desirable since a
bunch of diagnostic logic is already stripping
ParenTypes. In cases where we care about how the
type was written in source, we really ought to be
consulting the TypeRepr.
2024-10-31 11:32:40 +00:00
Alejandro Alonso
79689be55f Change integer type mangling
Fix negative mangling
2024-10-29 09:52:22 -07:00
Kuba (Brecka) Mracek
79d8de952f Merge pull request #77240 from kubamracek/embedded-printing-types
[embedded] Make Bool string-interpolatable in Embedded Swift, clarify support in docs
2024-10-26 07:56:36 -07:00
Kuba Mracek
68e01f2249 [embedded] Make Bool string-interpolatable in Embedded Swift, clarify support in docs 2024-10-25 22:05:58 -07:00
Joe Groff
8242110bbe Merge pull request #76831 from jckarter/builtin-vector
Builtin.FixedArray
2024-10-23 05:20:21 -10:00
Joe Groff
a184782a38 Introduce a Builtin.FixedArray type.
`Builtin.FixedArray<let N: Int, T: ~Copyable & ~Escapable>` has the layout of `N` elements of type `T` laid out
sequentially in memory (with the tail padding of every element occupied by the array). This provides a primitive
on which the standard library `Vector` type can be built.
2024-10-22 16:21:45 -07:00
Slava Pestov
3b76bc44cc docs: Update generics.tex 2024-10-21 22:08:52 -04:00
Nate Chandler
71239d6357 [CoroutineAccessors] SIL represents callee alloc.
When its operand has coroutine kind `yield_once_2`, a `begin_apply`
instruction produces an additional value representing the storage
allocated by the callee.  This storage must be deallocated by a
`dealloc_stack` on every path out of the function.  Like any other stack
allocation, it must obey stack discipline.
2024-10-11 08:25:03 -07:00
Nate Chandler
df1c4f6b25 [CoroutineAccessors] Add new SILFnTy CoroKind.
For `modify` and `read` coroutines, produce SILFunctionType's whose
coroutineKind is ::YieldOnce2.
2024-10-11 08:25:02 -07:00
Erik Eckstein
54e7cdda25 docs: document the witness table ABI for Embedded Swift 2024-10-07 09:00:32 +02:00
Anthony Latsis
54ef4dc67a [docs] FirstPullRequest: Turn CEWG team handle into a link (#76866)
GitHub handles do not work automatically in files.
2024-10-04 07:59:16 -07:00
Konrad `ktoso` Malawski
dea3b59331 Merge pull request #76250 from ktoso/wip-experimental-isolated-deinit 2024-10-03 17:19:10 +09:00
Michael Gottesman
561662d6cc [sil] Add a new instruction called ThunkInst.
For now this will only be used for HopToMainActorIfNeeded thunks. I am creating
this now since in the past there has only been one option for creating
thunks... to create the thunk in SILGen using SILGenThunk. This code is hard to
test and there is a lot of it. By using an instruction here we get a few benefits:

1. We decouple SILGen from needing to generate new kinds of thunks. This means
that SILGenThunk does not need to expand to handle more thunks.

2. All thunks implemented via ThunkInst will be easy to test in a decoupled way
with SIL tests.

3. Even though this stabilizes the patient, we still have many thunks in SILGen
and various parts of the compiler. Over time, we can swap to this model,
allowing us to hopefully eventually delete SILGenThunk.
2024-10-02 14:15:49 -07:00
Erik Eckstein
6fdb713e94 SwiftCompilerSources: implement WitnessTable.Entry as enum 2024-10-02 07:10:30 +02:00
Kuba (Brecka) Mracek
eb2b52207e Merge pull request #76768 from kubamracek/embedded-docs10
[embedded] Adjust docs to clarify support for class-bound existentials
2024-10-01 13:59:00 -07:00
Konrad `ktoso` Malawski
45b97f146b Merge branch 'main' into wip-experimental-isolated-deinit 2024-09-30 13:47:39 +09:00
Kuba Mracek
ca3a7f4638 [embedded] Adjust docs to clarify support for class-bound existentials 2024-09-28 18:09:11 -07:00
Nate Chandler
091368ba21 [CoroutineAccessors] Added read.
The name is a placeholder for the mutating single-yield coroutine
accessor.
2024-09-26 18:10:39 -07:00
Nate Chandler
98a2e6a7df [CoroutineAccessors] Added modify.
The name is a placeholder for the mutating single-yield coroutine
accessor.
2024-09-26 18:10:39 -07:00
Kuba (Brecka) Mracek
d3c5149714 Merge pull request #76658 from kubamracek/embedded-managed-buffer
[embedded] Add support for ManagedBuffer to Embedded Swift
2024-09-25 02:54:55 -07:00
Anthony Latsis
09c73585ca docs: Update links to section on commit access (#76672)
This section has migrated to our local contributing file and will soon
be removed from the website.
2024-09-24 10:46:03 -07:00
Anthony Latsis
9e752ca473 docs: Update link to commit message guidelines (#76667)
This information is specific to the compiler repository and now lives in our local contributing page.
2024-09-24 05:55:24 -07:00
Kuba Mracek
c7a5569c4f [embedded] Add support for ManagedBuffer to Embedded Swift
This makes ManagedBuffer available and usable in Embedded Swift, by:

- Removing an internal consistency check from ManagedBuffer that relies on metatypes.
- Making the .create() API transparent (to hoist the metatype to the callee).
- Adding a AllocRefDynamicInst simplification to convert `alloc_ref_dynamic` to `alloc_ref`, which removes a metatype use.
- Adding tests for the above.
2024-09-23 13:32:50 -07:00
Konrad `ktoso` Malawski
b9319d80f1 Merge branch 'main' into wip-experimental-isolated-deinit 2024-09-23 09:01:06 +09:00
Konrad `ktoso` Malawski
d89347bed0 Merge branch 'main' into wip-experimental-isolated-deinit 2024-09-20 18:34:45 +09:00
Saleem Abdulrasool
6443619126 Remove swift-indent tool
This removes the implementation of the `swift-indent` tool, its
associated documentation, and utilities. This tool was never completed
and has much better alternatives with `swift-format` which is more
flexible and actually maintained.
2024-09-19 11:21:59 -07:00