Commit Graph

32 Commits

Author SHA1 Message Date
Joe Groff
7e99e84070 Add an "addressable for dependencies" flag to value witness flags.
This may be useful for type layout of borrow fields in the future, should we
decide that addressable-for-dependencies borrows should always be represented
by a pointer. rdar://153650278
2025-06-18 12:47:16 -07:00
Anthony Latsis
76333e2800 [test] IRGen: Adjust FileCheck pattern where attribute order changed in upstream LLVM
`alias nocapture swiftself` -> `alias swiftself captures(none)`.

`nocapture` became `captures(none)` in
29441e4f5fa5f5c7709f7cf180815ba97f611297 (llvm-project).

This is intended to reduce future conflicts with rebranch.
2025-05-04 07:01:17 +01:00
Anthony Latsis
17fc00f8a7 [test] IRGen: Adjust FileCheck patterns for new nuw attribute in upstream LLVM
This attribute was introduced in
7eca38ce76d5d1915f4ab7e665964062c0b37697 (llvm-project).

Match it using a wildcard regex, since it is not relevant to these
tests.

This is intended to reduce future conflicts with rebranch.
2025-05-04 03:28:56 +01:00
Alejandro Alonso
c1bb143648 Make ValueGenerics feature always available 2025-02-27 10:03:37 -08:00
Daniel Rodríguez Troitiño
ba68faaed5 [test] Mark tests that use experimental/upcoming features as such
Find all the usages of `--enable-experimental-feature` or
`--enable-upcoming-feature` in the tests and replace some of the
`REQUIRES: asserts` to use `REQUIRES: swift-feature-Foo` instead, which
should correctly apply to depending on the asserts/noasserts mode of the
toolchain for each feature.

Remove some comments that talked about enabling asserts since they don't
apply anymore (but I might had miss some).

All this was done with an automated script, so some formatting weirdness
might happen, but I hope I fixed most of those.

There might be some tests that were `REQUIRES: asserts` that might run
in `noasserts` toolchains now. This will normally be because their
feature went from experimental to upcoming/base and the tests were not
updated.
2024-11-02 11:46:46 -07:00
Joe Groff
57a56e5804 IRGen: Set a "not bitwise borrowable" bit in value witnesses for @_rawLayout types.
For types like `Atomic` and `Mutex`, we want to know that even though they are
technically bitwise-takable, they differ from other bitwise-takable types until
this point because they are not also "bitwise-borrowable"; while borrowed,
they are pinned in memory, so they cannot be passed by value as a borrowed
parameter, unlike copyable bitwise-takable types. Add a bit to the value witness
table flags to record this.

Note that this patch does not include any accompanying runtime support for
propagating the flag into runtime-instantiated type metadata. There isn't yet
any runtime functionality that varies based on this flag, so that can
be implemented separately.

rdar://136396806
2024-09-24 19:08:50 -07:00
Yuta Saito
53a6cd5ae0 test: Fix raw_layout.swift for 32-bit platforms
The test was failing on 32-bit platforms after https://github.com/swiftlang/swift/pull/75518
2024-09-06 10:57:48 +00:00
Alejandro Alonso
2c703ee860 Update raw_layout.swift 2024-09-04 15:13:51 -07:00
Alejandro Alonso
451e7259a1 Add ValueGenerics experimental feature 2024-09-04 15:13:49 -07:00
Alejandro Alonso
22349bcfb9 Use intptr_t instead of ssize_t and more test fixes 2024-09-04 15:13:49 -07:00
Alejandro Alonso
4a7fb6f5fe Some test fixes 2024-09-04 15:13:48 -07:00
Alejandro Alonso
b663a151fe Add tests for raw layout vector 2024-09-04 15:13:28 -07:00
Alejandro Alonso
a029900b9f Update raw_layout.swift 2024-09-04 15:13:28 -07:00
Alejandro Alonso
75c2cbf593 Implement value generics
Some requirement machine work

Rename requirement to Value

Rename more things to Value

Fix integer checking for requirement

some docs and parser changes

Minor fixes
2024-09-04 15:13:25 -07:00
Alejandro Alonso
3ebcd23494 Update raw_layout.swift 2024-07-29 08:04:45 -07:00
Alejandro Alonso
0c1b51db97 Update raw_layout.swift 2024-07-28 10:29:59 -07:00
Alejandro Alonso
ca8c90ecc0 Support movesAsLike for the array variant of @_rawLayout 2024-07-28 10:29:57 -07:00
Alejandro Alonso
8f3ea58c07 Update raw_layout.swift 2024-06-03 09:23:30 -07:00
Alejandro Alonso
7c313c52dc Update raw_layout.swift 2024-05-31 10:19:09 -07:00
Alejandro Alonso
e51ef9c8c3 Update raw_layout.swift 2024-05-30 15:00:52 -07:00
Alejandro Alonso
475ddde196 Update raw_layout.swift
Update raw_layout.swift
2024-05-30 11:06:58 -07:00
Alejandro Alonso
e90d3bc097 Update raw_layout.swift 2024-05-29 10:59:44 -07:00
Alejandro Alonso
316ce6f02b Update raw_layout.swift 2024-05-29 09:47:00 -07:00
Alejandro Alonso
a9da08ccb6 Add option for raw layout to move as its like type 2024-05-28 14:34:22 -07:00
Alejandro Alonso
f5e10e2c0b Get rid of sil instruction and use a builtin for addressOfRawLayout 2024-03-27 11:36:29 -07:00
Alejandro Alonso
937c85c54e Add documentation and some tests
Add case to SILVerifier
2024-03-27 09:47:52 -07:00
Alejandro Alonso
ab143ee3ee Some fixes for raw layout types and noncopyable types in the stdlib 2023-09-11 20:45:09 -07:00
Alejandro Alonso
686a86d352 Update raw_layout.swift
Update raw_layout.swift
2023-08-17 09:45:56 -07:00
Alejandro Alonso
f840191e14 Emit call to old initialization function for older OSes
Add test

Update raw_layout.swift

Update raw_layout.swift
2023-08-03 09:30:37 -07:00
Alejandro Alonso
df17f7be90 Implement dependent layouts for raw types
Update raw_layout.swift

Allow for concrete specializations of raw layout

Make test platform agnostic
2023-08-01 14:09:23 -07:00
Joe Groff
2d767cd769 Fix IRGen/raw_layout.swift test for 32-bit platforms
and clarify a statement in the docs.
2023-07-27 10:14:49 -07:00
Joe Groff
aee071bf4e Introduce an experimental @_rawLayout attribute.
This attribute can be attached to a noncopyable struct to specify that its
storage is raw, meaning the type definition is (with some limitations)
able to do as it pleases with the storage. This provides a basis for
implementing types for things like atomics, locks, and data structures
that use inline storage to store conditionally-initialized values.
The example in `test/Prototypes/UnfairLock.swift` demonstrates the use
of a raw layout type to wrap Darwin's `os_unfair_lock` APIs, allowing
a lock value to be stored inside of classes or other types without
needing a separate allocation, and using the borrow model to enforce
safe access to lock-guarded storage.
2023-07-24 14:28:19 -07:00