Commit Graph

20133 Commits

Author SHA1 Message Date
Ben Rimmington
28e1fdf919 [stdlib] Remove _FixedArray16 from GroupInfo.json (#75631) 2024-08-01 19:54:09 -07:00
Tim Kientzle
9debfbc08c Merge pull request #75607 from tbkka/tbkka-remotemirror-unsafecontinuation
[RemoteMirror] Handle UnsafeContinuation
2024-08-01 13:46:09 -07:00
Eric Miotto
5c31c10dcf Merge pull request #75566 from edymtt/edymtt/promote-concurrency-stringprocessing-to-core-libraries
Promote _Concurrency and StringProcessing to core subset of the stdlib
2024-08-01 11:06:41 -07:00
Tim Kientzle
4bad739ad4 Remove FIXME since this is actually right! 2024-08-01 07:27:43 -07:00
Tim Kientzle
9e1dcd6c9f [RemoteMirror] Handle UnsafeContinuation
UnsafeContinuations can be stored in variables or properties,
so it's important for RemoteMirror to be able to at least minimally
recognize them.

This just treats an UnsafeContinuation as a refcounted pointer.
Which might be "good enough" for now.

Working towards rdar://110351406
2024-07-31 18:15:27 -07:00
Tim Kientzle
725dc3c011 Merge pull request #75587 from tbkka/tbkka-remotemirror-generic-depth
[RemoteMirror] Fix generic depth calculation
2024-07-31 17:56:27 -07:00
Tim Kientzle
039e78d31a [RemoteMirror] Fix generic depth calculation
The "generic depth" is used to match up generic type variables.
For example:
```
struct Foo<T> { // `T` at generic depth 0
  struct Bar {
    struct Baz<U> { // 'U' at generic depth 1
      ...
}}}
```

Note in the above that `Bar` is not counted in the
generic depth.  The previous logic did count `Bar` in
the generic depth calculation, leading to mismatches
when trying to associate references to generic variables.

This adds a new test with cases like the above and of course
corrects the calculation.

Resolves rdar://127450037
2024-07-31 07:08:08 -07:00
Karoy Lorentey
56bcc8dc83 [stdlib] Remove _FixedArray16
We are no longer using this internal type; remove it from the stdlib.
2024-07-30 16:14:05 -07:00
Philippe Hausler
5b20f7d10f [Embedded] Correct the signature of free to avoid using Builtin module for potential client implementations (#75496) 2024-07-30 11:59:24 -07:00
Kavon Farvardin
972373b129 NCGenerics: begin process of removing compat hack
The reverse-condfail workaround needs to be removed, and this is the
first step to allowing the stdlib to build with conditionally escapable
types.

resolves rdar://132453000
2024-07-29 17:27:17 -07:00
Dave Lee
abe697ff72 [Debug] Rename DebugDescription fallback property to lldbDescription (#75305)
From feedback, replace the name `_debugDescription`, which was confusing because of the 
underscore, with `lldbDescription`. This new name also indicates that this property may 
contain [LLDB Summary Strings](https://lldb.llvm.org/use/variable.html#summary-strings).
2024-07-29 11:10:43 -07:00
Eric Miotto
5512833d18 Promote _Concurrency and StringProcessing to core subset of the stdlib
This is needed to support Apple internal configurations.

Addresses rdar://125909114
2024-07-29 08:58:04 -07:00
Alex Lorenz
d9b7994cfe Merge pull request #75494 from hyp/eng/posix_filesystem_fix
[android] fix path and cmake local build target tracking for posix_fi…
2024-07-29 08:17:10 -07:00
Xiaodi Wu
ea1baed83a Address 128-bit integer comparison type inference issue (#75529) 2024-07-28 21:38:38 -07:00
Ben Rimmington
66e6c009eb [stdlib] Move unused functions to LegacyABI.swift (#75462) 2024-07-27 04:45:31 +01:00
Alex Martini
0958bdd312 Merge pull request #75383 from Jager-yoo/fix-compiler-protocols
[stdlib] Correct documentation formatting in CompilerProtocols
2024-07-26 17:20:33 -07:00
Holly Borla
7d65170614 Merge pull request #75495 from hborla/remove-redundant-sendable-stdlib 2024-07-26 06:38:19 -07:00
Holly Borla
dc3893d9ca [Concurrency] Remove redundant Sendable conformances in the standard library.
These conformances are all redundant because the `Sendable` conformance is
inherited from a superclass.
2024-07-25 21:51:56 -07:00
Alex Lorenz
c03627014e [android] fix path and cmake local build target tracking for posix_filesystem.apinotes
This apinote file needs to be accessible in the locally built Android SDK as it's being built with build.ps1, so that swift-foundation can be built with that file present. This change ensures that the file is copied over into the local build directory for that Android SDK, in addition to being included in the installed component

This change also places the component into lib/swift/apinotes, as that's where the clang importer already looks for API notes
2024-07-25 21:25:25 -07:00
Tim Kientzle
6fd0ddcec3 Merge pull request #75454 from tbkka/tbkka-reflection-performance-asan
When ASAN is visible, do not use page-aligned requests
2024-07-25 15:00:30 -07:00
Dave Lee
e0129799fa [Debug] Add user friendly diagnostic when @DebugDescription is atached to a generic (#75307)
Emit a user friendly diagnostic when `@DebugDescription` is attached to a generic 
definition.
2024-07-25 10:06:47 -07:00
Ben Rimmington
3c855da45d [stdlib] Fix coding style of AdditiveArithmetic (#75461)
Use explicit access modifiers instead of `public extension` inheritance.
2024-07-25 11:30:14 -04:00
Tim Kientzle
702f86c47d Merge pull request #75429 from tbkka/tbkka-mpe-improvements-2024-07-23
More MPE improvements
2024-07-24 21:55:30 -07:00
Tim Kientzle
3ffc3e8444 Use TC.targetPointerSize() for the pointer size 2024-07-24 16:23:17 -07:00
Ben Rimmington
fc8cc33777 [stdlib] Update documentation of integer types (#74973)
* [stdlib] Remove docs from default implementations

Customized docs were not removed:

  public static var isSigned: Bool
  public static var max: Self
  public static var min: Self
  public var description: String
  public var magnitude: Self
  public init<T: BinaryInteger>(_ source: T)
  public func distance(to other: Self) -> Int
  public func advanced(by n: Int) -> Self

* [stdlib] Remove unused docs for "unsafe" methods

* [stdlib] Remove inherited "ReportingOverflow" docs

* [stdlib] Remove inherited docs for operators

Customized docs were not removed.
(`+`, `-`, `*`, `+=`, `-=`, `*=`)

Non-inherited docs were not removed.
(`&+`, `&-`, `&+=`, `&-=`, `&*=`)

* [stdlib] Reattach doc comments to their APIs

Use `rstrip()` to remove the trailing newline.
<https://docs.python.org/3/library/stdtypes.html#str.rstrip>

* [stdlib] Remove inherited docs from integer types

* [stdlib] Remove FIXME(ABI) comments

* [stdlib] Remove unused docs for operators

* [stdlib] Update example code for `-=` and `*=`

* [stdlib] Update internal gyb comments

* [stdlib] Move docs to BinaryInteger overrides

* [stdlib] Remove unused gyb code

* [stdlib] Fix `&-` and `&*` examples
2024-07-24 17:31:15 -05:00
Tim Kientzle
9214ebd360 When ASAN is visible, do not use page-aligned requests 2024-07-24 14:58:16 -07:00
Allan Shortlidge
66e2f972ab Merge pull request #75432 from tshortli/maccatalyst-upstream
Upstream missing macCatalyst support
2024-07-24 09:58:04 -07:00
Tim Kientzle
706b0b0ed1 Whitespace changes to better match clang-format style 2024-07-24 09:08:51 -07:00
Alex Martini
736be735e6 DOCS: Add missing periods (#75407)
* Add missing period at end of sentence

* Add missing period

Co-authored-by: LamTrinh.Dev <me@lamtrinh.dev>

---------

Co-authored-by: LamTrinh.Dev <me@lamtrinh.dev>
2024-07-23 22:12:10 -07:00
Mike Ash
75fa43ebd8 [Concurrency] Clear current task TSD before enqueuing task in swift_task_switch. (#74736)
The executor may execute and free the task while the enqueue code is still finishing up. If that code tries to get an async backtrace (for example, if it calls malloc/free with malloc stack logging enabled) then it will find a dangling pointer in the current task TSD, and dereferencing it may crash.

rdar://130125017
2024-07-24 12:29:01 +09:00
Tim Kientzle
c19c73d74d Merge pull request #75415 from tbkka/tbkka-reflection-test-speedup
Huge speedup of RemoteMirror testing (in debug)
2024-07-23 19:50:46 -07:00
Allan Shortlidge
6fb6a56b20 SILGen: Introduce macCatalyst support for if #available.
Upstream the necessary changes to compile `if #available` queries correctly
when a `macabi` target triple or a `-target-variant` is specified.
2024-07-23 17:00:10 -07:00
Tim Kientzle
8d22ae449c More MPE improvements
This fills in a number of missing cases:
* MPEs with closure payloads
* MPEs with many non-payload cases
* MPEs with class existential payloads
* MPEs with existential metatype payloads

Resolves rdar://132270733
Resolves rdar://128705332
2024-07-23 16:08:57 -07:00
Tim Kientzle
9b7fcba72b Comments 2024-07-23 14:08:02 -07:00
Kavon Farvardin
2557ba96c8 Noncopyable: deprecate '@_moveOnly' attribute
This hidden attribute is a leftover from before the '~Copyable' syntax.

rdar://130526083
2024-07-23 11:05:33 -07:00
Tim Kientzle
8206c26c59 Remove some debugging code 2024-07-23 09:55:42 -07:00
Tim Kientzle
19cad5fbfb Huge speedup of RemoteMirror testing
**Background:**

Each RemoteMirror test runs two processes: A host process runs the
RemoteMirror library and queries memory data from a target process.  The host
and target communicate by passing strings back and forth with requests to read
particular information in memory.  The target is pure Swift; the host is
C/C++.

**What this change does:**

Without this, the host makes very many small requests to the target.
Each of those requests has to be individually parsed by the target
using String operations from the debug stdlib.  Actually transferring
the raw bytes is relatively quick.
With this, the host requests and caches "pages" of about 4k and
satisfies most requests from previously-fetched data.  This dramatically
reduces the total number of operations.

**Performance notes:**

The following notes only count the time to compile and run the 78 tests in the
validation-tests/Reflection directory using `lit.py`; it does not include time
to rebuild the project before running tests.

**Performance with debug stdlib:**

(That is: `build-script -ra --debug-swift-stdlib`) Before this change, I got
tired of waiting after about 15 minutes and it was about 1/4 done.  Some very
simplistic profiling showed >99% of the time being spent in stdlib String
operations in the target process.  Activity Monitor shows that individual tests
run for about 6 minutes of CPU time each.

With this change, the tests run in about 70s of wall time.  Almost all of the
time seems to spent compiling the tests; the tests themselves run too quickly to
even show up in the Activity Monitor.

**Performance with release stdlib:**

(That is: `build-script -ra`)
The tests run in about 70s of wall time with or without this change.
2024-07-23 09:50:41 -07:00
Mishal Shah
48d5aca28d Revert "Use associated objects to attach contiguous array buffers to lazy one…"
This reverts commit 7c011813f2.
2024-07-21 23:34:57 -07:00
Michael Ilseman
a0bf388bd5 UTF8-validation: speed up findInvalidRange (#75381)
Changes findInvalidRange from being O(n) to O(1).
2024-07-20 07:49:49 -06:00
Jaeho Yoo
ec78f498ec [stdlib] Correct documentation formatting in CompilerProtocols 2024-07-20 22:01:28 +09:00
David Smith
7c011813f2 Use associated objects to attach contiguous array buffers to lazy ones (#75148)
rdar://132124808
2024-07-19 23:21:41 -07:00
Alejandro Alonso
448596c03e Merge pull request #75366 from kim-minseong/main
[stdlib][public][core] Fix indentation in `Array`
2024-07-19 17:35:47 -07:00
Rintaro Ishizaki
2c63bf2b48 Merge pull request #75304 from rintaro/swiftsyntax-package-cmo
[SwiftSyntax] Enable Package CMO if possible
2024-07-19 17:34:09 -07:00
Mike Ash
fa0f2b2a37 Merge pull request #75274 from mikeash/fix-unsafe-continuation-validation
[Concurrency] Fix unsafe continuation validation when a continued task has been destroyed.
2024-07-19 17:06:24 -04:00
smonteiro2
684e9ebf0c [cxx-interop] Implements CxxMutableSpan, created from an UnsafeMutableBufferPointer
* Added tests for generic functions
* Add some tests for mutable spans
* Initialize ConstSpan from UnsafeMutableBufferPointer
* Change hardening flag
2024-07-19 10:38:52 +01:00
Minseong Kim
d5bcdca2b6 fix indentation from 1 space to 2 spaces 2024-07-19 16:41:58 +09:00
smonteiro2
15e1749594 Add precondition to prevent access out of bounds
The subscript function from CxxRandomAccessCollection did not perform any bounds-checks.
This means that C++ containers that don't provide the operator[] (or C++ containers used in generic contexts) didn't have bounds-checks.

Fixes rdar://126570011
2024-07-18 15:30:11 +01:00
Doug Gregor
ac0f574fdb Merge pull request #75127 from carlos4242/embedded-avr-cross-compile-stdlib
[AVR] standard library support for AVR
2024-07-17 22:17:42 -07:00
Rintaro Ishizaki
f0808e5335 [SwiftSyntax] Workaround a crash
The compiler crashes when compiling swift files importing package-cmo
enabled '.swiftmodule'. Avoid that by not-using '.swiftmodule'.
2024-07-17 14:29:28 -07:00
Alejandro Alonso
24a46c422b Merge pull request #74946 from Azoy/mutex-sending-inout
[stdlib] Adopt inout sending for Mutex
2024-07-17 10:56:57 -07:00