Commit Graph

14680 Commits

Author SHA1 Message Date
swift-ci
978395bc11 Merge pull request #62959 from meg-gupta/simplifycfgossapr3
Migrate simple and dominator based jump threading to OSSA
2023-08-18 17:18:10 -07:00
Meghana Gupta
8fafdd1148 Add @always(__inline) to _parseInteger(UnsafeBufferPointer<UInt8>, Int)
Integer parsing seems to be very sensitive to inlining.
With simplifycfg, _parseInteger function gets bigger and ends up not being inlined
causing significant performance regression in the integer parsing benchmarks.

Add @always(__inline) to recover the performance.
2023-08-18 14:32:14 -07:00
Alejandro Alonso
44198d16a4 Merge pull request #67611 from Azoy/raw-types-are-cool!
[WIP] Implement dependent layouts for raw types
2023-08-16 06:55:42 -07:00
Ben Rimmington
98ada1b200 [stdlib] Fix buffer size of small-capacity strings (#67929) 2023-08-16 10:00:42 +01:00
Alejandro Alonso
c20ab10cef Use an i32 argument instead of size
more int32

zzz
2023-08-15 19:49:44 -07:00
Allan Shortlidge
5cc7fff4ca Concurrency: Restore consume in TaskLocal.withValueImpl<R>(_:operation:).
It is no longer necessary to avoid using the `consume` keyword in inlinable
function bodies in the standard library in order to support older compilers.

Partially reverts https://github.com/apple/swift/pull/65599.

Resolves rdar://109165937.
2023-08-14 22:19:56 -07:00
Mike Ash
07cbed62ce Merge pull request #67868 from mikeash/class-copy-fixup-heap-destroyer
[Runtime] Fix up the heap destroyer in objc_setClassCopyFixupHandler.
2023-08-11 10:27:53 -04:00
Mike Ash
dbd2f82739 [Runtime] Fix up the heap destroyer in objc_setClassCopyFixupHandler.
We fix up the VWT pointer, but not the heap destroyer. This doesn't matter for classes which use ObjC refcounting, which is the common case for dynamic subclasses, because that doesn't use the heap destroyer pointer. But it does matter for classes that use native Swift refcounting, such as classes that don't inherit from NSObject, or actors.

rdar://113657917
2023-08-10 15:19:18 -04:00
Egor Zhdan
3723ff1401 [cxx-interop] Add UnsafeCxxMutableRandomAccessIterator protocol
This will be used to provide a safe overload of `std::vector::erase` in Swift.

`std::vector::erase` is not currently imported into Swift because it returns a C++ iterator.

rdar://113704853
2023-08-10 19:58:51 +01:00
swift-ci
9668f0442f Merge pull request #67590 from ktoso/wip-multi-error-group-single-leak
[TaskGroup] Fix unlock order, add missing detaches and add more assertions
2023-08-10 07:28:38 -07:00
Konrad `ktoso` Malawski
1195955647 Review feedback: add better code comments 2023-08-10 21:16:09 +09:00
David Smith
dade932a85 Revert "Try using withContiguousStorageIfAvailable in RangeReplaceableCollection.append(contentsOf:) before falling back to a slow element-by-element loop. Fixes rdar://109059874" (#67842)
This reverts commit 465aa22b81.
2023-08-10 01:39:20 -07:00
Saleem Abdulrasool
fe82f76e91 Merge pull request #67820 from stevapple/stevapple-patch-1
Fix building `LibcShims.cpp` with MSVC v14.37
2023-08-09 13:45:46 -07:00
Saleem Abdulrasool
47eb843f02 Merge pull request #67821 from stevapple/stevapple-patch-1-1
Remove `vcruntime._Private.xstddef`
2023-08-09 13:45:34 -07:00
Saleem Abdulrasool
af57672c0f Platform: further modularise vcruntime._Private
Create an explicit module for `xhash` to correct the usage for
`unordered_set`.
2023-08-09 13:45:21 -07:00
Stephen Canon
20a11db290 Revert "[stdlib] Fix calling convention mismatch for debugger utility functions" 2023-08-09 07:31:58 -04:00
YR Chen
7c43dfb986 Remove vcruntime._Private.xstddef
`<xstddef>` was removed since MSVC 14.37. It isn't meant to be used by most users, but the reference will break all clients of `vcruntime`, including Swift standard library itself.
2023-08-09 18:53:00 +08:00
YR Chen
e39babe1c9 Fix building LibcShims.cpp with MSVC v14.37
`_swift_stdlib_configure_console_mode` reverts console codepage on Windows using `atexit`, which is declared in `stdlib.h`.

Add the missing `#include <stdlib.h>` to unblock building Swift `stdlib` with MSVC v14.37 (Visual Studio 17.7).
2023-08-09 17:32:07 +08:00
Konrad `ktoso` Malawski
e1e81d54e3 Merge pull request #67773 from amartini51/checked_cont_typo_113502204 2023-08-09 15:44:22 +09:00
Konrad `ktoso` Malawski
8aa70dc733 cleanup for freestanding mode 2023-08-09 13:08:04 +09:00
Konrad `ktoso` Malawski
7d93bba7df cleanups 2023-08-09 12:47:01 +09:00
Konrad `ktoso` Malawski
060260e959 make use of unreachable 2023-08-09 08:44:12 +09:00
Konrad `ktoso` Malawski
383c62f731 disable debugging tricks 2023-08-09 08:44:12 +09:00
Konrad `ktoso` Malawski
61d783c5b3 revamping locking scheme, test this a bunch 2023-08-09 08:44:11 +09:00
Konrad `ktoso` Malawski
b135ecd8f6 [TaskGroup] Must detach discarded task, THEN unlock before resume waiting 2023-08-09 08:44:11 +09:00
Konrad `ktoso` Malawski
9d9f8cb143 [DiscardingTaskGroup] Properly detach when LAST task is failed, and prior failure was already stored 2023-08-09 08:44:11 +09:00
Saleem Abdulrasool
3de765cad3 Platform: correct requirements for std.unordered_set
This module requires C++11, not `unordered_set` which prevents the use
of the module.
2023-08-08 13:28:08 -07:00
swift-ci
c88877ea0e Merge pull request #67792 from ktoso/wip-remove-spawn-word-from-warning
[runtime warning] reenable async_taskgroup_discarding_dontLeak.swift
2023-08-08 07:07:12 -07:00
Konrad `ktoso` Malawski
eaafe3f79e [TaskGroup] Stop using group.spawn in warning messages 2023-08-08 20:38:57 +09:00
Alex Martini
2676e261fd Fix typo; add missing word. 2023-08-07 11:35:42 -07:00
Egor Zhdan
6261ee2bb5 Merge pull request #67772 from apple/egorzhdan/cxx-vector-proto
[cxx-interop] Add `CxxVector` protocol
2023-08-07 19:25:57 +01:00
Egor Zhdan
4acf9c8cf4 [cxx-interop] Add CxxVector protocol
This makes it possible to initialize `std::vector` from a Swift Sequence. This also conforms C++ vectors to `ExpressibleByArrayLiteral`, making it possible, for instance, to pass a Swift array to a C++ function that takes a vector of strings as a parameter.

rdar://104826995
2023-08-07 17:12:12 +01:00
Konrad `ktoso` Malawski
7020cf384e Merge pull request #67392 from ktoso/wip-reenable-async_taskgroup_discarding_dontLeak_class_error.swift 2023-08-07 22:38:13 +09:00
Saleem Abdulrasool
81cab33a75 Platform: further modularise ucrt
Add a couple of submodules for these modules to further modularise the
headers.  This might expose additional APIs now as some of these headers
would not have been indirectly included and wind up in the wrong module.
2023-08-06 21:16:40 -07:00
Alastair Houghton
54291008ac Merge pull request #67592 from DianQK/support-the-DW_AT_specification-attribute
[Backtracing][Linux] Support the DW_AT_specification attribute.
2023-08-06 11:47:19 +01:00
Saleem Abdulrasool
2124c01e74 stdlib: enable CxxStdlib module on Windows
Enable this module on Windows for enabling C++ Interop.
2023-08-04 21:19:35 -07:00
Saleem Abdulrasool
3aec82da29 Platform: make stdint module implicit on Windows
This makes the `stdint` module implicit which repairs the ability to
build some components.  In order to accomplish this, we need to
potentially break the fragile Swift build system.  Due to the incorrect
handling of compilers we need some workarounds to support
cross-compilation.  This removes the injected system header paths when
building on Windows to ensure that the clang resource headers are not
following the system headers which breaks the modules as the clang
resources are dependent on the system headers when running in hosted
mode.
2023-08-04 15:37:59 -07:00
Saleem Abdulrasool
da314bc7d7 runtime: silence some -Wformat warnings (NFC)
Use `z` rather than `l` for the modifier as the values are `size_t`
rather than `long`.  This fixes a bit of warning spew on Windows.
2023-08-04 08:47:23 -07:00
Konrad `ktoso` Malawski
d01abcb42e Unlock BEFORE resuming the waitAll waiting task, to avoid unlock() on
released memory.

Because the waitAll() group method is called before the group returns
from withTaskGroup and is used to ensure all tasks have completed before
we destroy the task group, this method is then immediately followed by
calling TaskGroup::destroy.

If we, as previously, first resume the waiting task and then attempt to
unlock the lock held by the group, we are in an unsafe situation with
racing the task group destroy() and the unlock().

Therefore, we must release the lock before we resume the waiting task.
2023-08-04 08:46:30 +09:00
Mike Ash
f674e56a0a Merge pull request #67681 from mikeash/fix-actor-dynamic-subclassing
[Concurrency] Fix crash when actor is dynamically subclassed.
2023-08-03 15:58:37 -04:00
Mike Ash
9f9929a1d0 [Concurrency] Fix crash when actor is dynamically subclassed.
Dynamic subclasses have a NULL type descriptor. Make sure isDefaultActorClass doesn't try to dereference that NULL descriptor.

rdar://112223265
2023-08-02 19:05:10 -04:00
Egor Zhdan
6caaa77efc [cxx-interop] Allow mutating std::map from Swift
This adds a setter to the `CxxDictionary` subscript which makes it possible to mutate `std::map` and `std::unordered_map` from Swift.

rdar://105399019
2023-08-02 16:44:30 +01:00
Alejandro Alonso
df17f7be90 Implement dependent layouts for raw types
Update raw_layout.swift

Allow for concrete specializations of raw layout

Make test platform agnostic
2023-08-01 14:09:23 -07:00
Egor Zhdan
dd2648b827 [cxx-interop] Conform Swift pointers to UnsafeCxxMutableInputIterator
This is currently a no-op since we don't auto-conform custom types to any kind of `MutableCollection` protocols: `UnsafeCxxMutableInputIterator` is only used for `std::map` conformance to `CxxDictionary` in the overlay. However, this will be useful in the future if we start conforming mutable C++ containers to certain Swift protocols: that way containers that use raw non-const pointers as iterators would be treated as mutable in Swift.
2023-08-01 15:31:22 +01:00
Max Desiatov
cc72301a87 Merge pull request #66531 from swiftwasm/pr-8addaa1d85ba6750d500373b55bd9451e869c8e6
[stdlib] Fix calling convention mismatch for debugger utility functions
2023-08-01 09:49:37 +01:00
DianQK
017d31fc31 [Backtracing][Linux] Support the DW_AT_specification attribute.
Support parsing the following format:
```
0x0000104b: DW_TAG_subprogram
              DW_AT_specification (0x00000d23 "$s8CrashOpt6level1yyF")
              DW_AT_inline (DW_INL_inlined)
```
2023-08-01 06:59:56 +08:00
Max Desiatov
819d9847a5 stdlib/public/core: use UInt(bitPattern:) to make sure casts work 2023-07-31 16:50:52 +01:00
Dario Rexin
b82ac6bcdf Merge pull request #67599 from drexin/wip-112474091
[Runtime] Fix _swift_refCountBytesForMetatype for reference types
2023-07-28 14:53:56 -07:00
Dario Rexin
f257b3bbab [Runtime] Fix _swift_refCountBytesForMetatype for reference types
_swift_addRefCountStringForMetatype and _swift_refCountBytesForMetatype diverged in the code that determines whether a type is a reference, causing the size number of ref count bytes to differ from the actually used bytes. This can cause early termination of the runtime interpreter functions, which in turn causes unbalanced reference counts.

rdar://112474091
2023-07-28 11:55:53 -07:00
Slava Pestov
50b8c347eb Merge pull request #67565 from slavapestov/fix-issue67322
TypeDecoder: Push one-element tuple unwrapping down into createTupleType() implementations
2023-07-28 09:32:03 -04:00