Commit Graph

41 Commits

Author SHA1 Message Date
Konrad `ktoso` Malawski
5546f4da7b Rename ExecutorRef to SerialExecutorRef 2023-11-01 18:39:44 +09:00
Konrad `ktoso` Malawski
41f99fc2ae [Executors][Distributed] custom executors for distributed actor (#64237)
* [Executors][Distributed] custom executors for distributed actor

* harden ordering guarantees of synthesised fields

* the issue was that a non-default actor must implement the is remote check differently

* NonDefaultDistributedActor to complete support and remote flag handling

* invoke nonDefaultDistributedActorInitialize when necessary in SILGen

* refactor inline assertion into method

* cleanup

* [Executors][Distributed] Update module version for NonDefaultDistributedActor

* Minor docs cleanup

* we solved those fixme's

* add mangling test for non-def-dist-actor
2023-03-15 23:42:55 +09:00
Anton Korobeynikov
c89e270b7d Implement value witness table for @differentiable functions (#60875)
@differentiable function is actually a triple (function, jvp, vjp). Previously normal thick function value witness table was used. As a result, for example,  only function was copied, but none of differential components.

This was the cause of uninitialized memory accesses and subsequent segfaults.

Should fix now unavailable TF-1122
2022-09-01 03:09:39 -07:00
Jonathan Grynspan
b749dd395d Revert "runtime: allow over-aligned types in the runtime"
This reverts commit b694ce4634.
2022-05-05 11:10:12 -04:00
Saleem Abdulrasool
b694ce4634 runtime: allow over-aligned types in the runtime
Not all targets have a 16-byte type alignment guarantee.  For the types
which are not naturally aligned, provide a type specific `operator new`
overload to ensure that we are properly aligning the type on allocation
as we run the risk of under-aligned allocations otherwise.

This should no longer be needed with C++17 and newer which do a two
phase `operator new` lookup preferring
`operator new(std::size, std::align_val_t)` if needed.  The base type
would be fully pre-processed away.  The empty base class optimization
should help ensure that we do not pay any extra size costs for the
alignment fixes.

As we are a C++14 codebase, we must locally implement some of the
standard type_traits utilities, namely `void_t`.  We take the minimal
definition here, assuming that the compiler is up-to-date with C++14 DR
reports which fixed an issue in SFINAE.  We use the SFINAE for detecting
the presence of the `operator new` overload to guide the over-alignment,
which is inherited through the new `swift::overaligned_type<>`  base
type.

Annotate the known classes which request explicit alignment which is
non-pointer alignment.  This list was identified by
`git grep ' alignas(.*) '`.
2022-04-04 18:26:20 -07:00
Kuba (Brecka) Mracek
e6a1e23a9f Add SWIFT_STDLIB_ENABLE_VECTOR_TYPES to take away support for SIMD (#41149) 2022-02-02 12:06:45 -08:00
Doug Gregor
9fbb897096 Fix alignment of the default actor storage type 2021-04-09 00:36:39 -07:00
Doug Gregor
eb6e74a0a6 Handle demangling/remangling for concurrency-related builtin types.
Fixes rdar://75990281.
2021-04-08 23:49:37 -07:00
John McCall
2ba7090fe8 Remove the extra-inhabitant value witness functions.
This is essentially a long-belated follow-up to Arnold's #12606.
The key observation here is that the enum-tag-single-payload witnesses
are strictly more powerful than the XI witnesses: you can simulate
the XI witnesses by using an extra case count that's <= the XI count.
Of course the result is less efficient than the XI witnesses, but
that's less important than overall code size, and we can work on
fast-paths for that.

The extra inhabitant count is stored in a 32-bit field (always present)
following the ValueWitnessFlags, which now occupy a fixed 32 bits.
This inflates non-XI VWTs on 32-bit targets by a word, but the net effect
on XI VWTs is to shrink them by two words, which is likely to be the
more important change.  Also, being able to access the XI count directly
should be a nice win.
2018-12-11 22:18:44 -05:00
Doug Gregor
d92a5e8356 [Runtime] Add metadata for Builtin.Int7
Fixes rdar://problem/45880755.
2018-11-14 09:35:15 -08:00
Saleem Abdulrasool
5ee35666c4 Runtime: add UnknownObject on non-ObjC builds
The UnknownObject type is used for the block convention block pointers.
This is used in libdispatch and we cannot build for Windows without it.
2018-11-03 18:06:11 -07:00
John McCall
abdba1d3f4 Change the integer-literal type from Int2048 to IntLiteral.
Part of SR-290.
2018-10-31 23:14:58 -04:00
John McCall
cf511445e2 Basic support for Builtin.IntegerLiteral. 2018-10-31 18:42:34 -04:00
Saleem Abdulrasool
ff20f2b44f runtime: adjust known metadata for SIMD vector types
Rather than use a function, use a templated structure with a constant
expression to metaprogram the alignment of the type.  NFC.

Adjust the templating for the SIMD vector types.  Use the reserved
spelling for the clang extension, and rename the types.  NFC.

The meat of this change is the explicit template specialization for the
float 3 vector and double 3 vector.  Since they are going to be emitted
as float 4 vector underneath everything, we can simply treat them the
same.  This has a benefit of allowing us to share the same
specialization of the witness tables.  Additionally, it works around a
bug in clang where we cannot correctly decorate the extended type with
Microsoft's ABI (which is a separate issue).  Since this saves some
bytes, this is still beneficial.
2018-10-28 02:06:29 -07:00
Doug Gregor
57f83980f6 Add C type equivalents for Builtin.Int1 and Builtin.Int63 2018-10-26 19:35:45 -07:00
Doug Gregor
e87dea480c [IRGen] Make (most) builtin type metadata round-trippable.
Rather than mapping all of the builtin floating-point and vector
types down to the type metadata symbols for power-of-two integers,
map down to the type metadata symbols provided by the runtime.
This allows us to round-trip type metadata <-> mangled name for all of
the builtin types that have such symbols. When we don’t have a runtime
symbol, we will fail to link if that builtin type gets referenced.
2018-10-26 16:09:21 -07:00
Doug Gregor
65d5d15fc1 [Runtime] Extend known builtin metadata for floating point and vector types.
Expose symbols for metadata for the various builtin floating point types
and vector types. This is used by the demangler to handle builtin names.

This is a narrow fix for rdar://problem/45569984 (where we couldn’t
demangle a builtin vector type). A more extensive fix will require us
to add a general runtime facility for creating opaque type metadata
with specific size/alignment/stride/uniquing name.
2018-10-26 16:05:31 -07:00
David Zarzycki
8231b3a750 [IRGen & Runtime] Remove prefab'ed VWT for reference storage types
The prefab'ed value witness tables for reference storage types are a
premature optimization. Not all scenarios are covered, and those that
are "look suspect" according to John McCall.
2018-07-28 09:43:12 -04:00
Joe Groff
98ee6a5d7d Runtime: Prefab metadata records for Any and AnyObject.
Metadata for these types gets demanded fairly frequently, and it's a decent code size savings not having to emit a runtime call to access them.
2018-03-10 10:15:42 -08:00
Arnold Schwaighofer
fff94ad18c Fix comment of escape and noescape witness tables 2018-02-14 05:32:33 -08:00
Arnold Schwaighofer
74e1cfaeb3 runtime: Implemenation of value witness for @noescape types
We should not need those -- except (at least) for functions passed as
arguments to materializeForSet ...
2018-02-13 04:19:59 -08:00
Arnold Schwaighofer
d981bb1d96 Mangling: noescape functions will be trivial and no longer compatible with escape function types.
Mangle escapeness as part of the type.

Part of:
SR-5441
rdar://36116691
2018-02-06 08:51:43 -08:00
Pavel Yaskevich
07534a6464 [Runtime] NFC: Create a .def file with all supported built-in types 2018-01-23 23:40:13 -08:00
Arnold Schwaighofer
7321153c0e Fix the alignment parameter 2017-04-17 10:33:32 -07:00
Arnold Schwaighofer
1d2e46bbec Runtime: Add support for Builtin.Int512
rdar://31540879
2017-04-17 09:58:42 -07:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
practicalswift
38be6125e5 [gardening] C++ gardening: Terminate namespaces, fix argument names, ...
Changes:
* Terminate all namespaces with the correct closing comment.
* Make sure argument names in comments match the corresponding parameter name.
* Remove redundant get() calls on smart pointers.
* Prefer using "override" or "final" instead of "virtual". Remove "virtual" where appropriate.
2016-12-17 00:32:42 +01:00
Erik Eckstein
9f8b68ae11 Mangling: use macros instead of hard-coded swift symbol names.
This makes it easier to switch between the old and new mangling scheme.
2016-12-02 15:55:30 -08:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Jordan Rose
bc83940301 Make pointer nullability explicit using Optional.
Implements SE-0055: https://github.com/apple/swift-evolution/blob/master/proposals/0055-optional-unsafe-pointers.md

- Add NULL as an extra inhabitant of Builtin.RawPointer (currently
  hardcoded to 0 rather than being target-dependent).
- Import non-object pointers as Optional/IUO when nullable/null_unspecified
  (like everything else).
- Change the type checker's *-to-pointer conversions to handle a layer of
  optional.
- Use 'AutoreleasingUnsafeMutablePointer<NSError?>?' as the type of error
  parameters exported to Objective-C.
- Drop NilLiteralConvertible conformance for all pointer types.
- Update the standard library and then all the tests.

I've decided to leave this commit only updating existing tests; any new
tests will come in the following commits. (That may mean some additional
implementation work to follow.)

The other major piece that's missing here is migration. I'm hoping we get
a lot of that with Swift 1.1's work for optional object references, but
I still need to investigate.
2016-04-11 20:06:38 -07:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
Joe Groff
42c71b7972 Don't mangle directness into type metadata symbols.
Anywhere we can't directly address type metadata in Swift, we've found we need a function call. Directness isn't useful here.

Swift SVN r32626
2015-10-12 17:22:40 +00:00
Joe Groff
4182c44cfe Runtime: Provide prefab value witness tables for unowned and weak references.
Fixes rdar://problem/21315113.

Swift SVN r30291
2015-07-17 00:09:37 +00:00
Joe Groff
45e9c71b69 Fix paste-o.
Swift SVN r30127
2015-07-12 01:06:11 +00:00
Joe Groff
0b54e21629 simd overlay: Use LLVM vector types.
This brings the David Owens benchmark from http://owensd.io/2015/06/27/performance-xcode7-beta-2.html from parity with simd.h-based C to 3x faster.

Before:

RenderGradient ([UInt32].withUnsafeMutablePointer (SIMD))                 │ 7.035851 │ 6.304739 │ 9.815832 │  1.212 │

After:

RenderGradient ([UInt32].withUnsafeMutablePointer (SIMD))                 │ 2.318357 │ 2.223325 │ 2.697981 │ 0.1490 │

This also addresses rdar://problem/21574425, since Builtin.add_VecNxIntM isn't overflow-checked, and overflow checks really aren't wanted when working with vector types directly.

Reapplying now that Nadav's fixed the ARM64 SelectionDAG issue this exposed before, and Arnold's fixed
yet another SelectionDAG issue exposed after that.

Swift SVN r30006
2015-07-09 01:20:01 +00:00
Arnold Schwaighofer
8517b7ba08 Revert "Un-XFAIL test on Linux."
Revert "simd overlay: Use LLVM vector types."

This reverts commit r29922 and r29924.

More arm64 instruction selection errors.

rdar://21703486

Swift SVN r29941
2015-07-07 16:45:08 +00:00
Joe Groff
9a23fa9040 simd overlay: Use LLVM vector types.
This brings the David Owens benchmark from http://owensd.io/2015/06/27/performance-xcode7-beta-2.html from parity with simd.h-based C to 3x faster.

Before:

RenderGradient ([UInt32].withUnsafeMutablePointer (SIMD))                 │ 7.035851 │ 6.304739 │ 9.815832 │  1.212 │

After:

RenderGradient ([UInt32].withUnsafeMutablePointer (SIMD))                 │ 2.318357 │ 2.223325 │ 2.697981 │ 0.1490 │

This also addresses rdar://problem/21574425, since Builtin.add_VecNxIntM isn't overflow-checked, and overflow checks really aren't wanted when working with vector types directly.

Reapplying now that Nadav's fixed the ARM64 SelectionDAG issue this exposed before.

Swift SVN r29922
2015-07-06 22:56:42 +00:00
Joe Groff
e692c87bbf Revert "simd overlay: Use LLVM vector types."
This reverts commit r29891. It causes an LLVM assertion failure in SelectionDAG on appletvos-arm64.

Swift SVN r29893
2015-07-02 17:31:34 +00:00
Joe Groff
8103dfb825 simd overlay: Use LLVM vector types.
This brings the David Owens benchmark from http://owensd.io/2015/06/27/performance-xcode7-beta-2.html from parity with simd.h-based C to 3x faster.

Before:

RenderGradient ([UInt32].withUnsafeMutablePointer (SIMD))                 │ 7.035851 │ 6.304739 │ 9.815832 │  1.212 │

After:

RenderGradient ([UInt32].withUnsafeMutablePointer (SIMD))                 │ 2.318357 │ 2.223325 │ 2.697981 │ 0.1490 │

This also addresses rdar://problem/21574425, since Builtin.add_VecNxIntM isn't overflow-checked, and overflow checks really aren't wanted when working with vector types directly.

Swift SVN r29891
2015-07-02 17:05:29 +00:00
Slava Pestov
bfc90f1586 Runtime: nuke a bit of dead code
NFC

Swift SVN r28425
2015-05-11 18:21:34 +00:00
Dmitri Hrybenko
350248dae5 Reorganize the directory structure under 'stdlib'
The standard library has grown significantly, and we need a new
directory structure that clearly reflects the role of the APIs, and
allows future growth.

See stdlib/{public,internal,private}/README.txt for more information.

Swift SVN r25876
2015-03-09 05:26:05 +00:00