4517 Commits

Author SHA1 Message Date
Max Desiatov
a71c1836c7 docs/Wasm: remove incompatible --libcxx flags for build-script (#86017)
Freshly built libc++ introduces issues when building `swift-build`:

```
Undefined symbols for architecture arm64:
  "std::__1::__hash_memory(void const*, unsigned long)", referenced from:
      (anonymous namespace)::CAPIBuildDB::buildUpKeyCache(std::__1::vector<llbuild::core::KeyType, std::__1::allocator<llbuild::core::KeyType>>&) in BuildDB-C-API.cpp.o
      _llb_build_key_make in BuildKey-C-API.cpp.o
      _llb_build_key_make_command in BuildKey-C-API.cpp.o
      _llb_build_key_make_custom_task in BuildKey-C-API.cpp.o
      _llb_build_key_make_custom_task_with_data in BuildKey-C-API.cpp.o
      _llb_build_key_make_directory_contents in BuildKey-C-API.cpp.o
      _llb_build_key_make_filtered_directory_contents in BuildKey-C-API.cpp.o
      ...
ld: symbol(s) not found for architecture arm64
```

<!--
If this pull request is targeting a release branch, please fill out the
following form:

https://github.com/swiftlang/.github/blob/main/PULL_REQUEST_TEMPLATE/release.md?plain=1

Otherwise, replace this comment with a description of your changes and
rationale. Provide links to external references/discussions if
appropriate.
If this pull request resolves any GitHub issues, link them like so:

  Resolves <link to issue>, resolves <link to another issue>.

For more information about linking a pull request to an issue, see:

https://docs.github.com/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue
-->

<!--
Before merging this pull request, you must run the Swift continuous
integration tests.
For information about triggering CI builds via @swift-ci, see:

https://github.com/apple/swift/blob/main/docs/ContinuousIntegration.md#swift-ci

Thank you for your contribution to Swift!
-->
2025-12-13 15:31:05 -08:00
Max Desiatov
125a63d349 docs/WebAssembly.md: add Wasm stdlib testing steps (#85947)
Added instructions for building and running Wasm stdlib tests, including filtering options and environment variable usage.
2025-12-11 09:06:42 +00:00
Max Desiatov
f9c064d161 Merge pull request #85844 from MaxDesiatov/wasm-build-instructions
docs: Add instructions for Wasm stdlib building and testing
2025-12-10 16:07:39 +00:00
Slava Pestov
d9dcc88c46 docs: Fix links to Windows docs in README.md 2025-12-08 10:12:02 -05:00
Michael Gottesman
26d83d4393 Merge pull request #85827 from gottesmm/pr-50a580749c0f00c1a29b7985f98b412538950dce
[mangling.rst] Add a more indepth discussion of what padding bytes are used for when encoding relative symbolic references into mangled names.
2025-12-04 17:27:02 -08:00
Max Desiatov
6c389fe151 Add instructions for stdlib builds 2025-12-04 21:28:22 +00:00
Max Desiatov
b182f239ab Recommend --sccache for Wasm Swift SDK builds 2025-12-04 20:34:13 +00:00
Kavon Farvardin
12cb3f9a9a Merge pull request #85704 from kavon/suppressed-assoc-types-with-defaults
Sema: introduce SuppressedAssociatedTypesWithDefaults
2025-12-03 23:07:40 -08:00
Michael Gottesman
da54f03ada Add a more indepth discussion of what padding bytes are used for when encoding relative symbolic references into mangled names. 2025-12-03 16:14:09 -08:00
Kavon Farvardin
c9d2f522c0 Sema: introduce ProtocolInversesRequest
We need special handling for protocols whose requirement
signature exists but is in a serialized state, as we
cannot run the StructuralRequirementsRequest on such
a protocol as there's no work to be done, effectively.
2025-12-02 21:09:54 -08:00
Erik Eckstein
4c09fa6805 Mangling: add a specialization mangling for changing the function type representation of a function 2025-11-26 16:23:47 +01:00
Michael Gottesman
26627d7987 Merge pull request #85590 from gottesmm/pr-ec98d099eea90c59803748f629e9c4dfb27d42a0
[docs] Add some information to DebuggingTheCompiler.md about working with the various simulators.
2025-11-19 14:49:22 -08:00
Michael Gottesman
ef3298e44e [docs] Add some information to DebuggingTheCompiler.md about working with the various simulators.
I am adding this since I had to go spelunking around to find the SIMCTL_CHILD_
prefix which I need to debug an app. Rather than just forgetting it again, I
thought it made sense to just document it here so I can forget it again. I also
put in a little bit of other stuff about simctl as well while I was here.
2025-11-19 09:44:47 -08:00
Slava Pestov
058bacf255 Update docs/README.md
Co-authored-by: Charles Zablit <c_zablit@apple.com>
2025-11-19 07:16:44 -05:00
Slava Pestov
e5a713465d docs: Remove dead link
I took down my medium.com blog a few years ago, and all of the same material
in this post is now found in "Compiling Swift Generics", in docs/Generics/.
2025-11-18 21:55:25 -05:00
Slava Pestov
a3ecbc8202 Re-organize docs/README.md
Also remove links to stuff that's extremely out of date at this point.
It's still all there in docs/ if you want to see it, but there's no
longer any reason to feature it so prominently at the top of the
README.
2025-11-18 21:50:44 -05:00
Mishal Shah
fe97b6d055 Fix notification username in Branches.md 2025-11-12 08:41:24 -08:00
Mishal Shah
c345a31182 Update notification instructions in Branches.md
Clarified notification instructions for pull requests.
2025-11-12 08:41:01 -08:00
Anthony Latsis
8992ea82a2 Merge pull request #85433 from swiftlang/jepa-main4
AST: Rename `GenericContext::isGeneric` to `hasGenericParamList`
2025-11-11 21:12:34 +00:00
Anthony Latsis
bda6edb85c AST: Rename GenericContext::isGeneric to hasGenericParamList
`isGeneric` is a misleading name because this method checks for the
existence of a `GenericParamList`, which is not implied by genericity.
2025-11-11 15:55:16 +00:00
Slava Pestov
2349b5f6cf docs: Update generics book for 2025
- Revised "Substitution Maps" chapter:
  - New "Subclassing" section
  - New "SIL Type Lowering" section
- New "Opaque Result Types" chapter
- Various smaller edits

New PDF will be available shortly at https://download.swift.org/docs/assets/generics.pdf.
2025-11-11 08:34:36 -05:00
Alfonso Urdaneta
ae9fede33e Replace screenshot to reflect apple/swift -> swiftlang/swift 2025-11-06 03:32:48 +00:00
Slava Pestov
a81a3d37b0 docs: Remove obsolete example from TypeChecker.md
Swift has not had user-defined conversions since before Swift 1.0.

Remove the running example from the discussion of locators. This
probably makes the explanation too opaque, but the old explanation
was useless because it was out of date.

I'll add a proper example later.
2025-11-04 18:31:37 -05:00
John McCall
8d231d20c6 Rewrite StackNesting to be a non-iterative single-pass algorithm.
The previous algorithm was doing an iterative forward data flow analysis
followed by a reverse data flow analysis. I suspect the history here is that
it was a reverse analysis, and that didn't really work for infinite loops,
and so complexity accumulated.

The new algorithm is quite straightforward and relies on the allocations
being properly jointly post-dominated, just not nested. We simply walk
forward through the blocks in consistent-with-dominance order, maintaining
the stack of active allocations and deferring deallocations that are
improperly nested until we deallocate the allocations above it. The only
real subtlety is that we have to delay walking into dead-end regions until
we've seen all of the edges into them, so that we can know whether we have
a coherent stack state in them. If the state is incoherent, we need to
remove any deallocations of previous allocations because we cannot talk
correctly about what's on top of the stack.

The reason I'm doing this, besides it just being a simpler and hopefully
faster algorithm, is that modeling some of the uses of the async stack
allocator properly requires builtins that cannot just be semantically
reordered. That should be somewhat easier to handle with the new approach,
although really (1) we should not have runtime functions that need this and
(2) we're going to need a conservatively-correct solution that's different
from this anyway because hoisting allocations is *also* limited in its own
way.

I've attached a rather pedantic proof of the correctness of the algorithm.

The thing that concerns me most about the rewritten pass is that it isn't
actually validating joint post-dominance on input, so if you give it bad
input, it might be a little mystifying to debug the verifier failures.
2025-11-03 11:51:17 -08:00
Slava Pestov
e18c0c4cea docs: Update Lexicon.md to clarify 'canonical type', and add 'reduced type' 2025-10-31 10:58:22 -04:00
Aidan Hall
a8cef4451a Merge pull request #84513 from aidan-hall/pack-opt
Optimize Specializations of Variadic Generics by Eliminating Parameter Packs
2025-10-31 11:24:04 +00:00
Slava Pestov
e413739b98 docs: Document the fields of the score in TypeChecker.md 2025-10-30 14:46:05 -04:00
Slava Pestov
4127a4e86c docs: Document Unsafe*Pointer conversions in TypeChecker.md 2025-10-30 14:46:05 -04:00
Aidan Hall
8632e58825 Create Pack Specialisation pass 2025-10-30 14:28:16 +00:00
Jamie
251a3f4c39 [docs]: minor typo fixes/cleanups in TypeChecker.md 2025-10-29 07:43:57 -05:00
Carl Peto
5f45e5a704 Merge pull request #85181 from carlpeto/fix-docs-backtrace-options
Fix a few small discrepancies in the docs about options for backtrace.
2025-10-29 10:46:04 +00:00
Slava Pestov
efcb8c6350 Link to Embedded Swift docs and 'Compiling Swift Generics' from docs/README.md 2025-10-28 22:31:11 -04:00
Slava Pestov
83b9bd6588 docs: Fresh coat of paint for TypeChecker.md 2025-10-28 22:31:11 -04:00
Carl Peto
825d82fe79 Update docs/Backtracing.rst
Co-authored-by: Alastair Houghton <alastair@alastairs-place.net>
2025-10-28 21:52:47 +00:00
Carl Peto
43c84ea6e6 Update docs/Backtracing.rst
Co-authored-by: Alastair Houghton <alastair@alastairs-place.net>
2025-10-28 21:52:34 +00:00
Carl Peto
fdbbf31d04 Update docs/Backtracing.rst
Co-authored-by: Alastair Houghton <alastair@alastairs-place.net>
2025-10-28 21:52:14 +00:00
Carl Peto
a2c24eafc7 Fix a few small discrepancies in the docs about options for backtrace. 2025-10-28 17:48:23 +00:00
Kuba (Brecka) Mracek
eb23d3bc0a Merge pull request #85074 from kubamracek/section
SE-0492: Stabilize @_section/@_used into @section/@used
2025-10-24 12:29:48 -07:00
Meghana Gupta
9fed0413f0 [NFC] Add documentation 2025-10-23 05:19:16 -07:00
Kuba Mracek
adeb40f261 SE-0492: Stabilize @_section/@_used into @section/@used
Removes the underscored prefixes from the @_section and @_used attributes, making them public as @section and @used respectively. The SymbolLinkageMarkers experimental feature has been removed as these attributes are now part of the standard language. Implemented expression syntactic checking rules per SE-0492.

Major parts:
- Renamed @_section to @section and @_used to @used
- Removed the SymbolLinkageMarkers experimental feature
- Added parsing support for the old underscored names with deprecation warnings
- Updated all tests and examples to use the new attribute names
- Added syntactic validation for @section to align with SE-0492 (reusing the legality checker by @artemcm)
- Changed @DebugDescription macro to explicitly use a tuple type instead of type inferring it, to comply with the expression syntax rules
- Added a testcase for the various allowed and disallowed syntactic forms, `test/ConstValues/SectionSyntactic.swift`.
2025-10-22 16:05:39 -07:00
Meghana Gupta
06eb315612 Update mangling for borrow and mutate accessors 2025-10-20 09:05:36 -07:00
Michael Gottesman
fe9c21fd87 [sil] Add a new instruction cast_implicit_actor_to_optional_actor.
This instruction converts Builtin.ImplicitActor to Optional<any Actor>. In the
process of doing so, it masks out the bits we may have stolen from the witness
table pointer of Builtin.ImplicitActor. The bits that we mask out are the bottom
two bits of the top nibble of the TBI space on platforms that support TBI (that
is bit 60,61 on arm64). On platforms that do not support TBI, we just use the
bottom two tagged pointer bits (0,1).

By using an instruction, we avoid having to represent the bitmasking that we are
performing at the SIL level and can instead just make the emission of the
bitmasking an IRGen detail. It also allows us to move detection if we are
compiling for AArch64 to be an IRGen flag instead of a LangOpts flag.

The instruction is a guaranteed forwarding instruction since we want to treat
its result as a borrowed projection from the Builtin.ImplicitActor.
2025-10-16 10:52:04 -07:00
Michael Gottesman
2fa3908e94 [concurrency] Add a new type Builtin.ImplicitActor.
This is currently not wired up to anything. I am going to wire it up in
subsequent commits.

The reason why we are introducing this new Builtin type is to represent that we
are going to start stealing bits from the protocol witness table pointer of the
Optional<any Actor> that this type is bitwise compatible with. The type will
ensure that this value is only used in places where we know that it will be
properly masked out giving us certainty that this value will not be used in any
manner without it first being bit cleared and transformed back to Optional<any
Actor>.
2025-10-16 10:51:13 -07:00
Doug Gregor
3e1ea3c0f7 [SIL] Add asmname attribute to SIL functions and global variables
The asmname attribute allows one to specify the name that will be used
when lowering a given SIL declaration to LLVM IR. It is not currently
exposed in the surface language.

Make sure this attribute round-trips through the parser and
serialization.

Part of rdar://137014448O.
2025-10-15 20:44:09 -07:00
John McCall
46623cb6c7 Merge pull request #84811 from rjmccall/verify-dead-end-edges
Strengthen the SIL verifier's rules for edges into dead-end regions
2025-10-11 18:16:56 -04:00
John McCall
f3c9ab8d50 Document SIL's dominance rules, which apparently we've never done. 2025-10-11 02:12:19 -04:00
Max Desiatov
db21bc20ea Merge pull request #84399 from MaxDesiatov/docs-wasm-swift-sdk
docs/WebAssembly.md: update Swift SDK build instructions

Swift SDKs require Swift SDK Generator to be built with its dependencies. Additionally, now that tests for Wasm stdlib run by default, we should include required tools. Embedded Swift build is also enabled in the documented invocation.
2025-10-10 23:20:38 +01:00
Mishal Shah
9d9116ed86 Merge pull request #84650 from rjmansfield/update-CI-md
Remove CentOS 7 and Ubuntu 18.04 from ContinuousIntegration.md.
2025-10-07 14:06:45 -07:00
eeckstein
401a2ac2bc Merge pull request #84704 from eeckstein/closure-specialization
ClosureSpecialization: support for OSSA and a big overhaul
2025-10-07 06:59:08 +02:00
Mishal Shah
ee04cb84b2 Merge pull request #84696 from valeriyvan/Generics-typos 2025-10-06 07:57:15 -07:00