Commit Graph

21434 Commits

Author SHA1 Message Date
Alastair Houghton
5c427124ae [Backtracing] Fix ARM64e build failure.
Accessing the thread context structures is complicated because their
member variables change name depending on various macros.  This caused
a build failure for ARM64e.

rdar://118402226
2023-11-14 17:37:00 +00:00
Kuba (Brecka) Mracek
7d7cf1f102 Merge pull request #69822 from kubamracek/embedded-fallback-to-c-calling-conv
[embedded] Avoid using swiftcc on targets that don't support it
2023-11-14 09:07:48 -08:00
Alastair Houghton
1667378e73 [Backtracing] Make sure we print the program counter on ARM64 linux.
On Linux, the right macro for detecting ARM64 is `__aarch64__`, not
`__arm64__`.

rdar://118379429
2023-11-14 08:27:24 +00:00
Kuba Mracek
df09cf16b1 [embedded] Avoid using swiftcc on targets that don't support it 2023-11-13 12:59:41 -08:00
Doug Gregor
5db3685e1c [Existential collections] Switch internal _map rethrows methods to throws
These class methods are internal, but because they are overridden and are
part of a `@usableFromInline`, `@_fixed_layout` class, we they can't be
moved over to typed throws without breaking ABI. However, they are
only ever called from typed-throws functions, which already need a
do...catch dance to downcast the error itself. Make them `throws`
instead, which is ABI-compatible, but eliminates the need for
do...catch hackery in the function itself.
2023-11-13 11:47:00 -08:00
Doug Gregor
1892396e14 Improve ABI-only rethrowing map shims based on code review
Replace the hackish use of `@_disfavoredOverload` with the more principled
use of `@_silgen_name` for the entrypoint we are maintaining, then rename
these functions in source to `__rethrows_map` to indicate what they're for.

While here, make them `throws` instead of `rethrows`. The ABI is the
same, and `throws` allows us do avoid to do/catch tricks with rethrows
functions.
2023-11-13 11:47:00 -08:00
Doug Gregor
0d15d4edbe Replace rethrowing map with generic typed throws
Adopt typed throws for the `map` operation to propagate thrown error
types through the `map` API. This is done in a manner that is backward
compatible for almost all cases:

* The new typed-throws entrypoint is `@_alwaysEmitIntoClient` so it
can back-deploy all the way back.
* The old `rethrows` entrypoint is left in place, using
`@usableFromInline` with `internal` so it is part of the ABI but not
the public interface, and `@_disfavoredOverload` so the type checker
avoids it while building the standard library itself. The old
entrypoint is implemented in terms of the new one.

Note that the implementation details for the existential collection
"box" classes rely on method overriding of `_map` operations, and the
types are frozen, so  we don't get to change their signatures. However,
these are only implementations, not API: the actual API `map`
functions can be upgraded to typed throws.

Note that this code makes use of a known hole in `rethrows` checking
to allow calling between `rethrows` and typed throws. We'll need to do
something about this for source-compatibility reasons, but I'll follow
up with that separately.
2023-11-13 11:47:00 -08:00
Doug Gregor
c433740c08 Enable TypedThrows in the standard library build 2023-11-13 11:47:00 -08:00
Alex Lorenz
cf73629512 Merge pull request #69531 from oyepriyansh/fix-typos
fixed some typos
2023-11-13 10:22:38 -08:00
Augusto Noronha
254ecb6118 Merge pull request #69752 from augusto2112/field-descriptor-interface
Add interface for lookup of externally stored field descriptors
2023-11-13 09:59:13 -08:00
Alastair Houghton
2c8bd79bf0 Merge pull request #69697 from al45tair/eng/PR-118055527
[Backtracing] Add an indication that we're working on a backtrace.
2023-11-13 17:54:43 +00:00
Tim Kientzle
4e821f65ec Merge pull request #69464 from tbkka/tbkka-objc-equatable-hashable
Use Swift Equatable and Hashable conformances from ObjC
2023-11-10 13:46:19 -08:00
Dario Rexin
36f3367275 [Runtime] Use threaded code in compact value witness runtime (#69756)
* [Runtime] Use threaded code in compact value witness runtime

These changed reduce branching and yield performance improvements of up to 10% for some cases.

* Fix offset in handleRefCountsInitWithTake
2023-11-09 19:12:29 -08:00
Eric Miotto
3d71dbb04b CMake: allow to only build Core and Onone when building the stdlib (#69747)
This is needed for some Apple internal configurations that needs to build the
standard library in pieces to construct an SDK.
Given the limited audience, only introduce this flag in CMake.

Addresses rdar://118178539
2023-11-09 14:06:42 -08:00
Augusto Noronha
e05e3ae7f0 Add interface for lookup of externally stored field descriptors
This is a follow up patch that wraps field descriptors and field records
in an abstract interface, and allows descriptor finders to look them up.
2023-11-09 12:33:34 -08:00
Alastair Houghton
9ca81c63b1 [Backtracing] Massage the output a little in various cases.
We shouldn't try to erase the message when in non-color mode; mostly
that's intended for redirected output scenarios anyway, and in that case
we don't really want garbage in the output.

Also, improve the failure messages when the backtracer itself goes
wrong or can't be executed.

Finally, change the behaviour slightly so that *if* we're explicitly
enabled, *and* the backtracer path wasn't explicitly specified, *and*
we can't find the backtracer, we print a warning on start-up.  We
don't do that in any other case because we don't want spurious warnings
everywhere.

rdar://118055527
2023-11-09 18:12:18 +00:00
Alastair Houghton
9d462a7b69 [Backtracing] Add an indication that we're working on a backtrace.
When we crash, emit a message straight away that says we're working
on a backtrace.  If starting the backtracer fails, report that also.

Finally, add a duration to the messages output by the backtracer, so
that we can see how long it took.

rdar://118055527
2023-11-09 18:12:18 +00:00
Alastair Houghton
3d9533de0d Merge pull request #69570 from al45tair/eng/PR-117470489
[Linux] Disable fatalError() backtraces when the runtime backtracer is active.
2023-11-09 17:53:53 +00:00
Augusto Noronha
9f33d3e242 Merge pull request #69556 from augusto2112/builtin-interface
Add interface for lookup up of externally stored type descriptors
2023-11-09 08:43:53 -08:00
Alastair Houghton
aa9f12988c Merge pull request #69510 from al45tair/eng/PR-117681625
[Backtracing] Add a caching wrapper for MemoryReader.
2023-11-09 14:30:41 +00:00
eeckstein
1e9135f7cd Merge pull request #69718 from eeckstein/embedded-stdlib
Two small fixes for the embedded stdlib
2023-11-09 07:51:05 +01:00
Alejandro Alonso
16cbb76fc6 Merge pull request #69710 from Azoy/stdlib-warning-cleanup
[stdlib] Silence some standard library warnings
2023-11-08 20:09:13 -08:00
Alejandro Alonso
2ef2659789 Merge pull request #69728 from Azoy/fix-word-breaking-bug
[stdlib] Fix backwards iteration of word breaking
2023-11-08 18:57:01 -08:00
Mike Ash
967c5c6a75 Merge pull request #69542 from mikeash/retain-release-override-optional
[Runtime] Add option to remove override point for retain/release.
2023-11-08 19:51:29 -05:00
Mike Ash
5e0125b53d Merge pull request #69334 from mikeash/metadata-cache-key-equality-memcmp
[Runtime] Have MetadataCacheKey::operator== try memcmp before deeper comparison.
2023-11-08 19:36:48 -05:00
Alejandro Alonso
e41fe5a173 Special case some unknown builtin macros 2023-11-08 16:02:31 -08:00
Tim Kientzle
f85cb1cd15 Merge pull request #69684 from tbkka/tbkka-better-unexpected-nullable-message
Clarify the error we emit when we see an unexpected null pointer
2023-11-08 16:00:31 -08:00
Augusto Noronha
f09f518abc Add interface for lookup up of externally stored type descriptors
Currently, TypeRefBuilder knows how to parse type descriptors from
reflection metadata. We aim to store the same information that lives
in type descriptors externally, as an effort to support embedded Swift
debugging. In order to take advantage of all of the existing type
information parsing code that exists today in remote mirrors, add an
interface for external lookup of type descriptors, and replace all the
usages of type descriptors with their generic counterpart (this patch
only adds support for builtin descriptors, but follow up patches will
add support for other descriptor types).
2023-11-08 15:57:05 -08:00
Alejandro Alonso
3deacf8944 Fix backwards iteration of word breaking 2023-11-08 13:26:20 -08:00
Tim Kientzle
079c83ba9e Reword message a bit more based on review feedback 2023-11-08 11:04:43 -08:00
Yuta Saito
7df19b86ea [stdlib] Fix calling convention mismatch for debugger utility functions (#69352)
This is the 3rd attempt to fix the mismatch, where the actual definition
(e.g. `swift_retainCount`) are defined with C calling-convention and the
callers wrongly expect Swift calling-convention.

The 1st fix broke ABI compatibility by introducing new symbol references
from app-side without any availability checks.
The 2nd fix broke lldb's retain counting feature due to new x-ref to
Clang module in serialized function body by `@_alwaysEmitIntoClient`.

This attemps to avoid introducing serialized x-ref to Clang module by
using new `@_extern(c)` attribute.

Resolves rdar://113910821

Co-authored-by: Karoy Lorentey <klorentey@apple.com>
2023-11-08 10:45:28 -08:00
Alastair Houghton
003b4556b3 [Backtracing] Fix a Windows build issue.
When backtracing is disabled, don't try to refer to
`_swift_backtraceSettings`.

rdar://117470489
2023-11-08 16:06:16 +00:00
Erik Eckstein
c8db45907f EmbeddedRuntime: add swift_willThrow 2023-11-08 16:23:28 +01:00
Erik Eckstein
de6edc70e8 stdlib: build the embedded stdlib core with -enable-ossa-modules
As it is the case for the regular stdlib core
2023-11-08 14:01:25 +01:00
Alejandro Alonso
17c30f162d Merge pull request #69194 from karwa/patch-17
[NFC][In Both Senses] Use _NormData type instead of performing a lookup directly
2023-11-07 21:44:19 -08:00
Alejandro Alonso
31aed274c4 Silence some standard library warnings 2023-11-07 15:03:53 -08:00
Tim Kientzle
7a920cdcbf Merge pull request #69618 from tbkka/tbkka-SwiftValue-equatable-redux
Make SwiftValue hash/equality work the same as SwiftObject

For Equatable types that are not Hashable, this proxies ObjC `-isEqual:` to Swift `Equatable` and returns a constant for ObjC `-hash`
2023-11-07 13:03:13 -08:00
Egor Zhdan
0db93e2ec1 Merge pull request #69670 from apple/egorzhdan/cmake-deployment-target
[build] Respect `DEPLOYMENT_VERSION_{IOS|TVOS|WATCHOS}` for Swift sources
2023-11-07 20:25:40 +01:00
Alejandro Alonso
8ac7f0b10f Merge pull request #69138 from Azoy/generics-are-hard
[Runtime] Refactor _gatherWrittenGenericParameters
2023-11-06 19:27:54 -08:00
Tim Kientzle
d16e493856 Clarify the error we emit when we see an unexpected null pointer 2023-11-06 16:39:14 -08:00
Alejandro Alonso
d73c812a2d Simplify _gatherWrittenGenericParameters 2023-11-06 12:51:06 -08:00
Alastair Houghton
199dcc2a12 Merge pull request #69635 from al45tair/eng/PR-117900760
[Backtracing][Linux] Handle inaccessible memory properly in Docker.
2023-11-06 18:36:03 +00:00
Alastair Houghton
536742117c Merge pull request #69508 from al45tair/eng/PR-117590155
[Linux] Improve backtracer ELF/DWARF parsing performance.
2023-11-06 18:32:53 +00:00
Alejandro Alonso
3503ab35d8 Update assert to fix packs 2023-11-06 10:31:21 -08:00
Alejandro Alonso
a0c8465f0c Refactor _gatherWrittenGenericParameters
Fix some bugs
2023-11-06 10:31:20 -08:00
Finagolfin
bf137cb30d [android] Add more changes to build the compiler 2023-11-06 21:53:56 +05:30
Egor Zhdan
f8b5143573 [build] Respect DEPLOYMENT_VERSION_{IOS|TVOS|WATCHOS} for Swift sources
See https://github.com/apple/swift/pull/69512

rdar://117699474
2023-11-06 16:20:24 +00:00
Jaeho Yoo
391eee0625 [Concurrency] Fix some typos in PartialAsyncTask 2023-11-07 01:16:37 +09:00
Alastair Houghton
b50b396e1d [Backtracing] Fix rebasing mistake.
When I rebased, I didn't get the FileImageSource code quite right.

rdar://117681625
2023-11-06 16:00:04 +00:00
Konrad `ktoso` Malawski
ad30745994 Merge pull request #69669 from ktoso/wip-docs-remove-misleading
[Docs][TaskLocal] Remove comment which is true, but is confusing to end users
2023-11-06 22:52:46 +09:00