Commit Graph

17573 Commits

Author SHA1 Message Date
Alejandro Alonso
11fbd94668 Merge pull request #78664 from Azoy/unicode-16
[stdlib] Unicode 16
2025-01-21 09:29:35 -08:00
Gabor Horvath
8c03a31d65 [cxx-interop] Support transforming lifetimebound spans
This PR adds basic support for storing lifetime dependence information,
transform Span return types, and generate lifetime annotations.

rdar://139074571
2025-01-21 10:51:04 +00:00
Allan Shortlidge
58a97f1603 Runtime: Suppress a -Winvalid-offsetof warning. 2025-01-20 20:22:51 -08:00
Saleem Abdulrasool
6135d506a7 Merge pull request #78710 from compnerd/pragma-complete
runtime: sprinkle some linker pragmas to autolink
2025-01-20 13:14:59 -08:00
David Smith
600dcd0828 Expose immortal String initialization for Foundation (#78661) 2025-01-19 07:43:13 -08:00
Saleem Abdulrasool
e9ec50132f runtime: sprinkle some linker pragmas to autolink
This prepares the runtime to be closed with its dependencies when
performing static linking. The pragma ensures that the linker will
automatically pick up the dependent libraries avoiding the need to
explicitly add the dependencies.
2025-01-17 08:58:42 -08:00
Alastair Houghton
dd84241d36 [Backtracing] CMake fixes.
Remove a `-disable-implicit-backtracing-module-import` that was added
in `Runtimes/Core/CMakeLists.txt`, and also remove the reference to
`swiftCxxStdlib` from `RuntimeModule` as that causes the build to fail
when attempting to build the static version of `swift-backtrace` on
Linux.

rdar://124913332
2025-01-17 14:31:16 +00:00
Alastair Houghton
4a7ca682d5 [Backtracing] Fix dependency for static swift-backtrace.
We'd missed renaming a CMake variable, which led to link errors.

rdar://124913332
2025-01-17 10:09:37 +00:00
Alastair Houghton
4826d60bc2 [Backtracing] Implement Codable for Backtrace.
Add support for Codable to Bactkrace.

rdar://124913332
2025-01-17 10:09:37 +00:00
Alastair Houghton
ffda416d36 [Backtracing] Add support for repeats to Compact Backtrace Format.
This lets us repeat a frame over and over; it only works for a single
frame, but that's the common case for infinite recursions.

rdar://124913332
2025-01-17 10:09:37 +00:00
Alastair Houghton
348a325d2a [Backtracing] Also try CFStringGetCharactersPtr when converting CFStrings.
We already try using `CFStringGetCStringPtr` to see if we can get ASCII;
we should also try `CFStringGetCharactersPtr` as the native encoding of
`CFNSString` is very often UTF-16.  While we're at it, try asking explicitly
for UTF-8 as well.  That won't work for `CFNSString` because AFAIK it's
currently never encoded that way, but it might work if something hands us
a Swift-backed string or if some future implementation of `CFString`
happens to support UTF-8 encoded data.

rdar://124913332
2025-01-17 10:09:36 +00:00
Alastair Houghton
0e3e9efcd3 [Backtracing] Add ImageMap instead of just using an Array.
We want to be able to efficiently serialise lists of images, and to do so
it makes most sense to create a separate `ImageMap` type.  This also provides
a useful place to put methods to e.g. find an image by address or by build
ID.

rdar://124913332
2025-01-17 10:09:36 +00:00
Alastair Houghton
760cc57bef [Backtracing] Rename _Backtracing to Runtime.
Move the backtracing code into a new Runtime module.  This means renaming
the Swift Runtime's CMake target because otherwise there will be a name
clash.

rdar://124913332
2025-01-17 10:09:36 +00:00
finagolfin
6b2fb2e4b4 Merge pull request #78678 from finagolfin/icu
Linux: don't link libicu in static executables, as it is no longer built separately
2025-01-17 11:45:11 +05:30
Garth Snyder
610d07e9ed [stdlib] Fix doc comment refs to subranges(where:), now called indices(where:) (#78512)
Doc comments for DiscontiguousSlice, MutableCollection, RangeSet, and
RangeReplaceableCollection all refer to a Collection method subranges(where:)
which is intended to return a RangeSet of matching ranges. I believe this is
likely an old or formerly-contemplated spelling of the method now known as
indices(where:). This commit changes "subranges" to "indices".
2025-01-16 13:54:02 -08:00
Alastair Houghton
ad78a86ca9 [Backtracing] Don't include things inside a namespace.
We shouldn't be including `<stdint.h>` inside the namespace.
2025-01-16 14:38:22 +00:00
Finagolfin
abe9225065 Linux: don't link libicu in static executables, as it is no longer built separately
This was dropped in #40340.
2025-01-16 19:47:52 +05:30
Alastair Houghton
d6447284f8 Merge pull request #78514 from al45tair/eng/PR-137201928
[Backtracing] Update module maps.
2025-01-16 11:21:33 +00:00
Alejandro Alonso
d3146e37b3 Update Scalar names for Unicode 16 2025-01-15 14:08:30 -08:00
Alejandro Alonso
1f74aa1634 Update grapheme breaking logic to support Unicode 16 2025-01-15 14:08:18 -08:00
Alejandro Alonso
4e087653f2 Update Unicode data files in stdlib 2025-01-15 14:07:46 -08:00
Alastair Houghton
d3352ef272 [Backtracing] memserver_req/resp and thread are only for Linux.
These types only exist on Linux, so need to be conditionalised here.

rdar://137201928
2025-01-15 11:21:25 +00:00
Guillaume Lessard
c9c5253fb3 [stdlib] fix getting eager-lazy-bridged buffer 2025-01-14 16:18:24 -08:00
Evan Wilde
6dcf7c64cf Merge pull request #78617 from etcwilde/ewilde/value-generic-types
Values in generic types are only available in 6.2
2025-01-14 09:59:56 -08:00
Alastair Houghton
82076d600d [Backtracing] Fix runtime symbols.
The runtime functions must be marked `extern "C"` because the symbols
are not mangled when exported.

rdar://137201928
2025-01-14 16:48:04 +00:00
Alastair Houghton
f0974bd227 [Backtracing] Turn off MemberImportVisibility.
Also fixed a couple of other minor issues preventing this PR from
building on its own.

rdar://137201928
2025-01-14 12:13:58 +00:00
Saleem Abdulrasool
66921730ee Merge pull request #78251 from andrurogerz/swift-runtime-debugvars-android
[Runtime] load debug env vars from Android system properties
2025-01-13 13:14:04 -08:00
Evan Wilde
6f823dcebf Fix Slab availability annotation
Values in generic types are only available as part of 6.2, not 6.1.
Fix the availability annotations on the slab type to match.

rdar://142781302
2025-01-13 12:42:20 -08:00
Henrik G. Olsson
d7bd76e9f1 [Swiftify] Add return pointer support (#78571)
* Import __counted_by for function return values

Instead of simply passing a parameter index to _SwiftifyInfo, the
_SwiftifyExpr enum is introduced. It currently has two cases:
 - .param(index: Int), corresponding to the previous parameter index
 - .return, corresponding to the function's return value.

ClangImporter is also updated to pass this new information along to
_SwiftifyImport, allowing overloads with buffer pointer return types to
be generated. The swiftified return values currently return Span when
the return value is marked as nonescaping, despite this not being sound.
This is a bug that will be fixed in the next commit, as the issue is
greater than just for return values.

* Fix Span variant selection

There was an assumption that all converted pointers were either
converted to Span-family pointers, or UnsafeBufferPointer-family
pointers. This was not consistently handled, resulting in violating the
`assert(nonescaping)` assert when the two were mixed. This patch removes
the Variant struct, and instead each swiftified pointer separately
tracks whether it should map to Span or UnsafeBufferPointer.
This also fixes return pointers being incorrectly mapped to Span when
marked as nonescaping.
2025-01-13 08:08:36 -08:00
Alejandro Alonso
09d122af7c Merge pull request #76438 from Azoy/vector
[stdlib] Slab
2025-01-12 10:36:25 -08:00
John McCall
11ff5b4348 Merge pull request #78576 from rjmccall/demangle-sending-result-with-function-isolation
Fix the demangling of sending result types when combined with isolation
2025-01-11 12:35:55 -05:00
John McCall
fa932e736c Fix the demangling of sending result types when combined with isolation
Fixes the immediate problem, but the presence of demangling code in the
runtime means that we'll need a follow-up to fix the compiler so that it
doesn't try to use the demangler to materialize metadata for function types
that have both isolation and a sending result.

rdar://142443925
2025-01-10 21:11:45 -05:00
Guillaume Lessard
18dd091fb8 Merge pull request #78538 from lorentey/define-availability-for-6.2
Define placeholder availability for Swift 6.2
2025-01-10 18:09:39 -08:00
Alejandro Alonso
4c5a13a63e Moar test fixes 2025-01-10 17:52:50 -08:00
Saleem Abdulrasool
34b684203e Merge pull request #78548 from compnerd/spelling
runtime: use the preferred spelling on Windows (NFCI)
2025-01-10 16:15:28 -08:00
Guillaume Lessard
46aa3fba1a Merge pull request #78546 from glessard/array-lazy-eager-bridge-loadfix
[stdlib] loading a reference can’t use `loadUnaligned`
2025-01-10 13:10:26 -08:00
Guillaume Lessard
12675dddeb Merge pull request #78540 from glessard/string-gardening 2025-01-10 10:24:34 -08:00
Saleem Abdulrasool
627e79556e runtime: use the preferred spelling on Windows (NFCI)
This changes the windows path to use the preferred `_strdup` over
`strdup` to avoid the deprecation warning.
2025-01-10 09:31:09 -08:00
Guillaume Lessard
9743ec9fd6 [stdlib] loading a reference can’t use loadUnaligned 2025-01-10 09:10:32 -08:00
Alastair Houghton
9329776a5d [Backtracing] Use C++ interop to fix elf.h issue on Linux.
We have some problems on Linux where Glibc pulls in `<elf.h>` and then
we end up with conflicting definitions.  Fix by using C++ interop and
putting our definitions into a namespace.

rdar://137201928
2025-01-10 13:49:14 +00:00
Guillaume Lessard
d4ae6b0ce8 [gardening] move String.withCString to String.swift
- it has been at an unexpected location for unremembered reasons.
2025-01-09 22:16:58 -08:00
Karoy Lorentey
872bc6eee6 [stdlib] Define _StdlibVersion.v6_2_0 and set it as the current version 2025-01-09 18:17:46 -08:00
Alejandro Alonso
cedea94b4c Test fixes and review feedback 2025-01-09 15:54:54 -08:00
Alejandro Alonso
f76d841540 Rename to Slab 2025-01-09 10:39:45 -08:00
Saleem Abdulrasool
358be09832 stdlib,Runtimes: begin preparing for a static stdlib on Windows
When building the standard library statically on Windows, we should not
use any __declspec(dllimport) or __declspec(dllexport) on the runtime
functions or data. Furthermore, we should internalise all of the
standard library functions so that they are not re-exported if used to
build a shared library. The code generation changes required for this
are easier to identify once a static SDK is available for Windows.
2025-01-08 15:08:14 -08:00
Alejandro Alonso
c62e851e38 Implement RemoteInspection support for Builtin.FixedArray 2025-01-08 10:37:17 -08:00
Alejandro Alonso
2823d3018f Some Vector API changes 2025-01-08 10:37:16 -08:00
Alejandro Alonso
f867d0bb05 Implement Vector 2025-01-08 10:33:13 -08:00
David Smith
26b2f7bb47 Re-land using associated objects to attach bridged Array buffers (#78452) 2025-01-07 19:38:21 -08:00
Alex Martini
57657c6d3e Clarify what "schoolbook" rounding means (#77903) 2025-01-06 16:27:47 -08:00