Kuba Mracek
b8bd832fba
[embedded] Add IVarDestroyers into class metadata, add support for throws in initializers
2024-03-26 20:52:17 -07:00
Kuba Mracek
8f247e2d36
[embedded] Add swift_isUniquelyReferenced_native into the embedded runtime
2024-03-25 11:51:01 -07:00
Doug Gregor
3fa07a0e7a
Implement swift_willThrow variant for typed throws.
...
`swift_willThrow` is called with an error right before it is thrown.
This existing entrypoint requires an already-boxed error existential;
with typed errors, we don't have the error existential on hand, so we
would need to allocate the box to throw a typed error. That's not okay.
Introduce a new `swift_willThrowTypedImpl` entry point into the runtime
that will first check for the presence of an error handler and, if one
is present, box the error to provide to the error handler. This
maintains the no-allocations path for typed errors while still
allowing existing error handlers to work.
This new entrypoint isn't available on older Swift runtimes, so create
a back-deployable shim called by the compiler. On new-enough platforms,
this will call through to `swift_willThrowTypedImpl`. On older
platforms, we drop the error and don't call the registered will-throw
handler at all. This is a compromise that avoids boxing when throwing
typed errors, at the cost of a slightly different experience for this
new feature on older runtimes.
Fixes rdar://119828459.
2024-02-05 15:06:55 -08:00
Kuba Mracek
6383d05ea1
[embedded] Fix calling convention on embedded runtime APIs (switch @_silgen_name for @_cdecl)
2024-01-29 15:37:46 -08:00
Kuba Mracek
2c30b0a0e2
[embedded] Resolve ptrauth crashes by signing HeapObjects's isa pointers in embedded Swift
2024-01-22 16:45:07 -08:00
Kuba Mracek
943c7c2ee5
[embedded] Drop 'public' from forward declaration of arc4random_buf
2023-12-20 14:04:35 +01:00
Kuba Mracek
d3849fe843
[embedded] Use @_extern(c) instead of @_silgen_name on arc4random_buf
2023-12-13 11:28:17 -08:00
Kuba Mracek
2f0883ab24
[embedded] Add Set to the embedded stdlib
2023-12-13 11:28:17 -08:00
Erik Eckstein
c8db45907f
EmbeddedRuntime: add swift_willThrow
2023-11-08 16:23:28 +01:00
Kuba Mracek
95d5d71d51
[embedded] Add asserts on predicate value into swift_once
2023-10-30 09:10:30 -07:00
Kuba Mracek
b057417e52
[embedded] Make embedded swift_once thread-safe
2023-10-29 20:33:43 -07:00
Kuba Mracek
6900efe42c
[embedded] Fix an LLVMARCOpts crash by avoiding direct calls to swift_retain/swift_release
2023-10-18 14:44:18 -07:00
Kuba Mracek
c8a5ac0142
[embedded] Use Builtin.RawPointer as the argument type on swift_release_n
2023-10-13 20:55:58 -07:00
Kuba Mracek
e9961323d8
[embedded] Avoid using Optional in the forward declared free() function in EmbeddedRuntime
2023-10-03 11:29:11 -07:00
Kuba (Brecka) Mracek
75838507d8
Merge pull request #68929 from kubamracek/embedded-sdk3
...
[embedded] Resolve empty -sdk path warning in embedded stdlib build, take 3
2023-10-03 07:02:19 -07:00
Kuba (Brecka) Mracek
0d2f98a368
Merge pull request #68912 from kubamracek/embedded-closures-heap
...
[embedded] Support closures with captures and promoting locals to refcounted heap objects
2023-10-03 07:00:46 -07:00
Kuba Mracek
d579c62fee
[embedded] Resolve empty -sdk path warning in embedded stdlib build, take 3
2023-10-02 17:55:02 -07:00
Kuba Mracek
c6d0e4f76f
[embedded] Support closures with captures and promoting locals to refcounted heap objects
2023-10-02 09:45:45 -07:00
Kuba Mracek
a3f2984bf7
[embedded] Use atomics in swift_isUniquelyReferenced_nonNull_native too
2023-09-29 20:43:56 -07:00
Kuba Mracek
436f1993cb
[embedded] Use atomic load/store/rmw in embedded runtime refcounting implementation
2023-09-29 17:36:45 -07:00
Kuba (Brecka) Mracek
17ba4aefba
Merge pull request #68820 from kubamracek/embedded-static-object
...
[embedded] Add swift_initStaticObject to the embedded runtime
2023-09-29 13:16:48 -07:00
Kuba (Brecka) Mracek
967bc84d46
Merge pull request #68821 from kubamracek/embedded-retain-n
...
[embedded] Implement retain_n and release_n in the embedded runtime
2023-09-29 13:16:28 -07:00
Kuba Mracek
b9613368f6
[embedded] Check for refcount underflow in embeddded runtime
2023-09-28 09:50:25 -07:00
Kuba Mracek
bcd7d3f9ec
[embedded] Implement retain_n and release_n in the embedded runtime
2023-09-27 22:55:43 -07:00
Kuba Mracek
85f3b240cf
[embedded] Add swift_initStaticObject to the embedded runtime
2023-09-27 22:21:03 -07:00
Kuba Mracek
7704674620
[embedded] Use -1 as the swift_once predicate indicator, to match Darwin expectations in the compiler
2023-09-27 19:53:38 -07:00
Kuba Mracek
b718c506da
[embedded] Fix arm64e pointer signing in embedded heap object destruction
2023-09-26 16:13:03 -07:00
Kuba Mracek
01298a0ddd
[embedded] Expand embedded runtime to handle stack promoted refcounted objects
2023-09-26 09:48:40 -07:00
Kuba Mracek
a835c6ba1f
[embedded] -O and -Osize embedded runtime
2023-09-25 21:28:37 -07:00
Kuba Mracek
cf1d19eb89
[embedded] Add immortalRefCount constant and add TODO comments about refcounting
2023-09-25 19:51:19 -07:00
Kuba Mracek
0758e7da85
[embedded] Use posix_memalign from shims instead of manual declaration
2023-09-25 19:51:19 -07:00
Kuba Mracek
86ad378928
[embedded] Add a simple Swift runtime, written in embedded Swift
2023-09-25 19:51:19 -07:00