Commit Graph

19 Commits

Author SHA1 Message Date
Tim Kientzle
0ab1b1631d Upstream some binary-compatibility logic 2024-07-09 13:30:13 -07:00
Alexander Cyon
c21b1e68fd [stdlib] Fix typos 2024-07-06 13:09:57 +02:00
Konrad `ktoso` Malawski
7790609fc8 [Concurrency] Futher prevent crashes in legacy mode of isCurrentExecutor 2024-05-27 17:02:26 +09:00
Konrad `ktoso` Malawski
86f5441294 [SerialExecutor] SerialExecutor.checkIsolated() to check its own tracking for isolation checks (#71172) 2024-03-29 07:06:34 +09:00
Tim Kientzle
2be0f047f8 Missing include 2024-02-28 10:42:52 -08:00
Tim Kientzle
5337c8b208 Preserve legacy behavior on Apple OSes in all environments 2024-02-27 17:46:49 -08:00
Tim Kientzle
b3ed7aee24 Bincompat hooks for revised hash/isEqual interop
This adds in hooks so that the new hash/isEqual interop
(which bridges Obj-C hash/isEqual: calls to the corresponding
Swift Hashable/Equatable conformances) can be selectively
disabled based on the OS and/or client.

For now, enable the new semantics everywhere except Apple platforms
(which have legacy apps that may be relying on the old semantics).
2024-02-14 12:13:07 -08:00
Tim Kientzle
71c9dd3727 [Dynamic Casting] Use old boxing semantics for pre-Fall-2023 apps
For Apple platforms, enable the new stricter boxing semantics only
for apps built against the Fall 2023 or later SDK.  This
avoids breaking apps that relied on the old behavior and
have not been updated since then.
2023-06-05 17:01:20 -07:00
Tim Kientzle
3a849abe08 Flip the bincompat switches on the tightened casting semantics
so the new behavior is always enabled by default on all OSes.

(This may change depending on whether anyone is actually depending
on this behavior.)
2023-02-02 08:45:50 -08:00
Tim Kientzle
00f49a98d0 Provide a Bincompat override for the newly tightened casting semantics 2023-02-02 08:45:50 -08:00
Egor Zhdan
84a1ffcb33 [Shims] Include SwiftShims headers without ../
This replaces a number of `#include`-s like this:
```
#include "../../../stdlib/public/SwiftShims/Visibility.h"
```
with this:
```
#include "swift/shims/Visibility.h"
```

This is needed to allow SwiftCompilerSources to use C++ headers which include SwiftShims headers. Currently trying to do that results in errors:
```
swift/swift/include/swift/Demangling/../../../stdlib/public/SwiftShims/module.modulemap:1:8: error: redefinition of module 'SwiftShims'
module SwiftShims {
       ^
Builds.noindex/swift/swift/bootstrapping0/lib/swift/shims/module.modulemap:1:8: note: previously defined here
module SwiftShims {
       ^
```
This happens because the headers in both the source dir and the build dir refer to SwiftShims headers by relative path, and both the source root and the build root contain SwiftShims headers (which are equivalent, but since they are located in different dirs, Clang treats them as different modules).
2022-09-14 11:14:50 +01:00
Alastair Houghton
668bcbce4f [Threading] Fix a few things following rebase.
After rebasing, a few things broke.  Fix them.

rdar://90776105
2022-06-07 07:39:53 +01:00
Alex Hoppen
4aa2bbbf06 Revert "Merge pull request #42447 from al45tair/eng/PR-90776105"
This reverts commit 8bcb71140f, reversing
changes made to c4dd271d36.
2022-06-02 18:03:23 +02:00
Alastair Houghton
3a5f10356c [Threading] Fix a few things following rebase.
After rebasing, a few things broke.  Fix them.

rdar://90776105
2022-05-24 16:42:36 +01:00
Karoy Lorentey
50c2399a94 [stdlib] Work around binary compatibility issues with String index validation fixes in 5.7
Swift 5.7 added stronger index validation for `String`, so some illegal cases that previously triggered inconsistently diagnosed out of bounds accesses now result in reliable runtime errors. Similarly, attempts at applying an index originally vended by a UTF-8 string on a UTF-16 string now result in a reliable runtime error.

As is usually the case, new traps to the stdlib exposes code that contains previously undiagnosed / unreliably diagnosed coding issues.

Allow invalid code in binaries built with earlier versions of the stdlib to continue running with the 5.7 library by disabling some of the new traps based on the version of Swift the binary was built with.

In the case of an index encoding mismatch, allow transcoding of string storage regardless of the direction of the mismatch. (Previously we only allowed transcoding a UTF-8 string to UTF-16.)

rdar://93379333
2022-05-17 19:25:10 -07:00
tbkka
184488d3f2 Conditionalize the fix for SR-14635 (#40822)
* Refactor Bincompat

Organize everything around internal functions that test for
a particular OS version.

Correctly handle cases where we don't know the version of the app.

Make all bincompat functions consistently return `true` for the
legacy semantics, `false` for new semantics.  Consistently name
them all to reflect this.

* Conditionalize the support for SR-14635

SR-14635 pointed out a hole in the updated dynamic casting logic
that allowed certain casts that should have been illegal.

In particular, when casting certain types to Obj-C protocols,
the Swift value gets boxed; we would permit the cast to succeed
whenever the resulting box satisfied the protocol.  For example,
this allowed any Swift value to be cast to `NSCopying` regardless of
whether or not it implemented the required `copy(with:)` method.

This was fixed in #37683 to reject such casts but of course some folks were
depending on this behavior to pass Swift data into Obj-C functions.
(The properly supported approach for passing arbitrary Swift data into
Obj-C functions is to cast the Swift value to `AnyObject`.)

This change makes that new behavior conditional.  For now,
the legacy semantics are enabled on Apple platforms and the
new semantics are in use everywhere else.  This will allow
us to gradually enable enforcement of the new behavior over
time.

* Just skip this test on Apple platforms, since it is inconsistently implemented there (and is therefore not really testable)
2022-01-14 11:56:25 -08:00
Kuba (Brecka) Mracek
62e7139574 Disable bincompat checks in Bincompat.cpp when SWIFT_RUNTIME_OS_VERSIONING is off. (#39009) 2021-08-23 19:05:26 -07:00
Mishal Shah
3116eed2e4 Update the branch to build with Xcode 12.5 (#37046) 2021-04-23 16:24:11 -07:00
Mike Ash
9ac3b0ee3b [Runtime] Add a disabled workaround for protocol conformance checking to check conformances in reverse order.
rdar://problem/72049977
2020-12-14 12:59:18 -05:00