Commit Graph

21434 Commits

Author SHA1 Message Date
Alejandro Alonso
3053c81259 Enforce that atomic representations are bitwisecopyable 2024-05-18 10:18:32 -07:00
Michael Gottesman
d759ec97ea Merge pull request #73696 from gottesmm/rdar128216574
[sending] Add support for 'sending'
2024-05-18 05:42:41 -04:00
Mike Ash
011c46eb45 Merge pull request #73650 from mikeash/prespecializations-dyld-hash-table
[Runtime] Add pointer-based lookup of prespecialized metadata.
2024-05-17 21:22:57 -04:00
Guillaume Lessard
a27d9c426a Merge pull request #71912 from oscbyspro/better-joined-distance-from-to-int-min
FlattenSequence/distance(from:to:) untrapping Int.min
2024-05-17 16:17:01 -07:00
Augusto Noronha
4417786be4 [RemoteInspection] Hardcode DefaultActorStorage's type info
No metadata is emitted for the builtin DefaultActorStorage type. Since
its layout is fixed, hardcode its definition in Remote Mirrors.

rdar://128032250
2024-05-17 14:29:25 -07:00
Mike Ash
96555ba51c [Runtime] Add pointer-based lookup of prespecialized metadata.
The existing lookup uses a hash table with the type's mangled name as the key. Building that key is costly. Add a new table that uses pointer keys, so that we can use the descriptor and arguments directly as the key.

rdar://127621414
2024-05-17 16:17:03 -04:00
Allan Shortlidge
f0551920c5 Merge pull request #73700 from tshortli/borrowing-switch-condfail
stdlib: Fix a borrowing switch condfail
2024-05-17 09:16:39 -07:00
Allan Shortlidge
ca70312879 stdlib: Fix a borrowing switch condfail.
Resolves rdar://128249510
2024-05-16 23:35:25 -07:00
Allan Shortlidge
5b252da7e2 stdlib: Fix warnings in Duration.swift. 2024-05-16 23:34:44 -07:00
Alex Martini
b57dbae317 Fix typo in docs code example
Co-authored-by: Kavon Farvardin <kfarvardin@apple.com>
2024-05-16 16:33:12 -07:00
Alex Martini
97790c03a7 Indent code listings, to match style used elsewhere 2024-05-16 14:35:29 -07:00
Alastair Houghton
a3ce5a9ba2 Merge pull request #73670 from al45tair/eng/PR-128197532
[Build] Add compatibility library deps to target executables.
2024-05-16 21:57:21 +01:00
Alex Martini
6fa34bdabf Add a missing implicit Copyable constraint
Co-authored-by: Kavon Farvardin <kfarvardin@apple.com>
Co-authored-by: Slava Pestov <spestov@apple.com>
2024-05-16 13:47:36 -07:00
Michael Gottesman
e3e78ad6bb [sending] Change the internals of sending to be based around 'sending' instead of 'transferring'.
We still only parse transferring... but this sets us up for adding the new
'sending' syntax by first validating that this internal change does not mess up
the current transferring impl since we want both to keep working for now.

rdar://128216574
2024-05-16 12:20:45 -07:00
Alejandro Alonso
db9232f246 Merge pull request #73550 from Azoy/string-debugger-changes
[debug] Print strings using their description in the debugger
2024-05-16 11:40:00 -07:00
Mike Ash
857cc388d4 Merge pull request #73639 from mikeash/lazy-signposts
[Runtime] Don't emit signposts until the system is ready.
2024-05-16 14:30:39 -04:00
Alastair Houghton
0302944988 [Build] Add compatibility library deps to target executables.
We need to make sure that we add the compatibility libraries as
dependencies for target executables, otherwise we can end up with
a race condition in the build where the build will fail if the
compatibility libraries haven't been built by the time e.g.
`swift-backtrace` is linked.

rdar://128197532
2024-05-16 15:46:09 +01:00
Erik Eckstein
15acfbb268 stdlib: improve debug performance of UnsafePointer.pointer(to:)
Making those functions transparent enables to completely remove the creation of keypaths, even with -Onone.
rdar://127793797
2024-05-16 10:15:53 +02:00
Erik Eckstein
fb036e9019 stdlib: more efficient pointer overflow checks in the UnsafePointer.pointer(to:) functions
Saves the optional nil check for unwrapping the pointer and one condition
2024-05-16 10:15:42 +02:00
Joe Groff
2c6bfa23c8 Merge pull request #72967 from jckarter/enable-borrowing-switch-frontend
Enable 'BorrowingSwitch' feature.
2024-05-15 10:57:07 -07:00
Alejandro Alonso
b2f21bbfb3 Update DebuggerSupport.swift 2024-05-15 10:02:35 -07:00
Mike Ash
dd24d8e71f [Runtime] Don't emit signposts until the system is ready.
Emitting a signpost for the first time can trigger lazy setup of the logging system, and doing this in the wrong context can cause deadlocks. Check to see if the logging system is already set up, and only emit signposts if it has been to avoid triggering this.

As it's hard to determine if the "is it set up?" function is available in the SDK we're building against, only do this in OS builds, as it's not particularly useful in local builds.

rdar://124620772
2024-05-15 11:02:23 -04:00
Karoy Lorentey
6e6a5ba1d0 Merge pull request #73400 from lorentey/fix-managedbuffer-abi-mixup
[stdlib] ManagedBuffer: Fix misapplied linkage names for legacy entry points
2024-05-14 20:52:17 -07:00
Joe Groff
10f9289ef8 Enable 'BorrowingSwitch' feature. 2024-05-14 07:31:59 -07:00
Kuba (Brecka) Mracek
e7b9fbc6e4 Merge pull request #73599 from kubamracek/embedded-concurrency-install
[embedded] Explicitly install the embedded concurrency .a libraries with +x permissions
2024-05-13 21:10:28 -07:00
Kuba Mracek
fba653708e [embedded] Explicitly install the embedded concurrency .a libraries with +x permissions 2024-05-13 10:27:26 -07:00
Kuba Mracek
e68195b8f2 [embedded] Avoid using UInt64 in int->string code (which triggers allocations on 32-bit systems) 2024-05-12 22:11:40 -07:00
Kuba Mracek
7120279755 [embedded] Avoid using a metatype variable in _allocateUninitializedArray 2024-05-12 22:07:00 -07:00
Tim Kientzle
54a2007903 Merge pull request #73552 from tbkka/tbkka-127839540
Make SwiftValue == support unconditional
2024-05-10 22:47:30 -07:00
Tim Kientzle
03ea6a1225 Merge pull request #73491 from tbkka/tbkka-mpe-sparebits
Calculate spare bits for multi-payload enums from first principles
2024-05-10 13:15:07 -07:00
Mykola Pokhylets
9ba09ff63d Process incoming queue when obtaining drainer lock 2024-05-10 11:05:22 +02:00
Mykola Pokhylets
40c38f9803 Using multiple insertion points to ensure all jobs are always inserted in O(1)
Fully separated unprocessed jobs and processed jobs
Reverse jobs after updating status to minimise contention
2024-05-10 11:05:22 +02:00
Mykola Pokhylets
21a70e10c7 Fixed quadratic performance of ListMerger when each executed job creates 2+ new jobs of the same priority
See https://forums.swift.org/t/quadratic-performance-of-the-listmerger-in-specific-use-case/69393
2024-05-10 11:05:22 +02:00
Alex Lorenz
340bfcddc0 Merge pull request #73534 from hyp/eng/fix-readlink
stdlib: fix android build
2024-05-09 20:29:59 -07:00
Tim Kientzle
cb03a459fe Make SwiftValue == support unconditional
PR #71620 made this behavior conditional as a way to help
provide binary compatibility for legacy software that might
be relying on the old behavior.

So far, it appears the only such problems arose from the
SwiftObject behavior changes, not from SwiftValue behavior.
So let's optimistically back this out and make the new behavior
unconditional.

Resolves rdar://127839540
2024-05-09 14:38:36 -07:00
Alejandro Alonso
180a11fdc2 Print strings using their description in the debugger 2024-05-09 14:36:57 -07:00
nate-chandler
387e8d3ff1 Merge pull request #73516 from nate-chandler/rdar127755503
[BitwiseCopyable] Avoid a condfail.
2024-05-09 07:00:01 -07:00
Konrad `ktoso` Malawski
b2bd17635f [Concurrency] Fix too eager early return in checkIsolation mode detecting (#73495) 2024-05-09 03:12:37 -07:00
Kuba Mracek
92c20a699b [embedded] Avoid unsafeBitCast, use Builtin.castFromNativeObject instead, add armv7 test 2024-05-08 21:29:11 -07:00
Alex Lorenz
94b1348183 stdlib: fix android build
the readlink addition in f4bf278 was introduced without a corresponding include.
2024-05-08 20:20:51 -07:00
Nate Chandler
2671652085 [BitwiseCopyable] Avoid a condfail.
The standard library defines
```
protocol BitwiseCopyable {}
typealias _BitwiseCopyable = BitwiseCopyable
```
For current compilers, `BitwiseCopyable` is a "known protocol".

For older compilers, it is not; instead `_BitwiseCopyable` is.  So
print the following into the swiftinterface for those older compilers:
```
protocol _BitwiseCopyable {}
typealias BitwiseCopyable = _BitwiseCopyable
```

rdar://127755503
2024-05-08 16:53:14 -07:00
Nate Chandler
acd9b72833 [BitwiseCopyable] Only deprecate underscored.
Rather than immediately outright banning the old protocol, just make it
be a deprecated typealias for the real one.
2024-05-08 16:52:51 -07:00
Kuba Mracek
7ae20b7039 [embedded] Port Swift.String to embedded Swift 2024-05-08 11:11:37 -07:00
Alastair Houghton
54e97de7cc Merge pull request #71848 from al45tair/eng/PR-123508245
[Stdlib][Build] Fix the standard library build for fully static Linux.
2024-05-08 14:21:54 +01:00
Alastair Houghton
f6bdbbdcc4 Merge pull request #71840 from al45tair/eng/PR-123503615
[Platform] Update musl modulemap and improve musl platform support.
2024-05-08 10:39:07 +01:00
Tim Kientzle
ea87a273d7 Redesign the spare bit mask calculation
This adds a `getSpareBits` method to all the TypeInfo classes
that returns a suitable bitmask indicating the spare bits available
in values of this type.  This gives us a way to recursively explore
the type tree and build up a full spare bit mask for an arbitrary type.

Happily, it appears we actually do have enough information to do this
calculation entirely from first principles, without requiring additional
reflection information.  So once this is stable, we should remove my
earlier incomplete effort to publish spare bit mask info in the reflection
data, as that adds unnecessary metadata to every binary.

This doubtless still has plenty of holes, but seems sufficient
to handle a few basic enum types, including the stdlib DecodingError
which was used as an example to work out some key issues.
2024-05-07 14:17:00 -07:00
Alastair Houghton
20714b5fb9 [Platform] Rename modules for C library headers to match Darwin.
The Darwin headers have a naming convention for these modules; we should
match it.

rdar://123503615
2024-05-07 21:34:43 +01:00
Alastair Houghton
b6a3d22a06 [Platform] Updated after review comments.
Added the _modules workaround to make the compiler pull in the correct
module when someone does `import stdc_assert` (for instance).

Fix various niggles.

rdar://123503615
2024-05-07 17:00:18 +01:00
Alastair Houghton
4262b7e4a4 [Platform] Update musl modulemap and improve musl platform support.
We need to declare separate top-level modules for every header in
the musl C library.  Note that our set-up here does require some
tweaks to musl itself (specifically, the `alltypes.h` header needs
some fairly serious massaging to make it module compatible; in
particular, we need to pull out every type declaration into its
own separate modularized header in `bits/types`).

Also update `Platform.swift` a little for more musl support.

rdar://123503615
2024-05-07 17:00:18 +01:00
Alastair Houghton
0fa5e65bb2 [Stdlib][Build] Fix the standard library build for fully static Linux.
Mostly this just means adding `Musl` as a module dependency of various
things and making sure that we build things for `swift_static` even
if `SWIFT_BUILD_STATIC_STDLIB` isn't enabled.

There's also a slight difference in the declaration of `memcmp()`;
musl's declaration is more like the one we have on Darwin.

rdar://123508245
2024-05-07 16:56:20 +01:00