Commit Graph

86 Commits

Author SHA1 Message Date
Joe Groff
cf87b9d571 IRGen: Generate swift_fixLifetime marker as a private stub.
This lets us remove `swift_fixLifetime` as a real runtime entry point. Also, avoid generating the marker at all if the LLVM ARC optimizer won't be run, as in -Onone or -disable-llvm-arc-optimizer mode.
2015-12-21 18:06:18 -08:00
Joe Groff
a5ba9e06cd Runtime: Remove unused swift_allocPOD implementation.
A vestige of the old box implementation that's now dead.
2015-12-21 18:06:18 -08:00
practicalswift
cd7d8dfaff Fix alignment as requested by @gribozavr in #692 2015-12-21 08:54:24 +01:00
practicalswift
176f487d76 Fix incorrect filenames in headers. 2015-12-20 23:59:05 +01:00
zerotypos-found
0c1df3577e Fix typo: a --> an, an --> a. 2015-12-17 15:10:25 +09:00
John McCall
4d1b6e2eb6 Reform the runtime interface for unowned reference-counting.
This is a bit of a hodge-podge of related changes that I decided
weren't quite worth teasing apart:

First, rename the weak{Retain,Release} entrypoints to
unowned{Retain,Release} to better reflect their actual use
from generated code.

Second, standardize the names of the rest of the entrypoints around
unowned{operation}.

Third, standardize IRGen's internal naming scheme and API for
reference-counting so that (1) there are generic functions for
emitting operations using a given reference-counting style and
(2) all operations explicitly call out the kind and style of
reference counting.

Finally, implement a number of new entrypoints for unknown unowned
reference-counting.  These entrypoints use a completely different
and incompatible scheme for working with ObjC references.  The
primary difference is that the new scheme abandons the flawed idea
(which I take responsibility for) that we can simulate an unowned
reference count for ObjC references, and instead moves towards an
address-only scheme when the reference might store an ObjC reference.
(The current implementation is still trivially takable, but that is
not something we should be relying on.)  These will be tested in a
follow-up commit.  For now, we still rely on the bad assumption of
reference-countability.
2015-12-04 13:18:14 -08:00
Erik Eckstein
5e7342633b runtime: add runtime functions for stack promotion of buffers.
These functions are usually lowered away, but can remain if SIL optimizations run but not llvm optimizations.
This is only a workaround. I hope that I can remove the functions soon when we have a better support for buffers in SIL.
2015-11-19 15:18:17 -08:00
Joe Groff
c6b6d346bd Move the SwiftNativeNSXXXBase classes and stubs to SwiftStubs.
Move the ObjC internal declarations to a public runtime header so they can be shared, and rename _swift_deallocClassInstance to the more descriptive name swift_rootObjCDealloc (and make it only available with ObjC interop).
2015-11-13 08:37:12 -08:00
Joe Groff
69a206229d Runtime: Start splitting out stubs only needed by the standard library.
Set up a separate libSwiftStubs.a archive for C++ stub functionality that's needed by the standard library but not part of the core runtime interface. Seed it with the Stubs.cpp and LibcShims.cpp files, which consist only of stubs, though a few stubs are still strewn across the runtime code base.
2015-11-11 17:28:57 -08:00
Michael Gottesman
654ca4e0c5 Move Lazy.h from stdlib/public/runtime => include/swift/Basic
I am going to use this in a unittest for BlotMapVector.
2015-11-02 09:22:30 -08:00
Erik Eckstein
4a1dffec32 Support for stack promotion in the runtime.
NFC yet.




Swift SVN r32928
2015-10-28 00:43:45 +00:00
Slava Pestov
76f1168adf Remove dealloc_ref's [constructor] form since its no longer needed
Swift SVN r32688
2015-10-14 22:50:09 +00:00
Slava Pestov
418ab80da4 Runtime: Implement swift_deallocPartialClassInstance()
Swift SVN r32645
2015-10-13 00:30:14 +00:00
Xin Tong
dca508bfbb This is part of a series of commits to remove reference forwarding for
some of the ARC entry points. rdar://22724641. After this commit,
swift_retain_noresult will be completely replaced by swift_retain.
LLVMARCOpts pass is modified NOT to rewrite swift_retain to
swift_retain_noresult which forward no reference.

Swift SVN r32082
2015-09-18 21:56:50 +00:00
Xin Tong
bc3fe169b4 This is part of a series of commits to remove reference forwarding for some of the ARC entry points. rdar://22724641.
After this commit, swift_retain will return no reference and LLVMARCContract pass is modified NOT to rewrite
swift_retain_noresult to old swift_retain which forwarded the reference.

Swift SVN r32075
2015-09-18 20:35:39 +00:00
Michael Gottesman
121ef3ef9f Revert the series of commits for removing the return value from swift_retain_noresult.
I asked that the patches were split up so I could do post commit review.

This reverts commit r32059.
This reverts commit r32058.
This reverts commit r32056.
This reverts commit r32055.

Swift SVN r32060
2015-09-18 02:31:24 +00:00
Xin Tong
4e46dacc3d Completely replace swift_retain_noresult with swift_retain. this is part of a series of commits
to remove reference forwarding for some of the ARC entry points. rdar://22724641. After this
commit, swift_retain_noresult will be completely replaced by swift_retain and LLVMARCOpts.cpp
will no longer canonicalize swift_retain to swift_retain_noresult as now swift_retain returns no
reference.

Swift SVN r32058
2015-09-18 01:51:17 +00:00
Xin Tong
955e4ed652 Change swift_retain/swift_retain_n to return no value. this is part of a series of commits
to remove reference forwarding for some of the ARC entry points. rdar://22724641. After this
commit, swift_retain will be the same as swift_retain_noresult, returning no reference.
LLVMARCContract pass is also modified NOT to rewrite swift_retain_noresult to the
old swift_retain which forwards the reference.

Swift SVN r32055
2015-09-18 00:41:35 +00:00
Xin Tong
275daaf750 recommiting. r31989. Implement weak/unowned retain_n/release_n entry points. rdar://22629226
Swift SVN r31991
2015-09-16 16:01:16 +00:00
Mark Lacey
fff32395cc Revert "Implement weak/unowned retain_n/release_n entry points. rdar://22629226"
This reverts commit r31989 because it broke the build due to a faulty
assert that fires in the refcounting unit test.

Swift SVN r31990
2015-09-16 06:15:31 +00:00
Xin Tong
206673b95d Implement weak/unowned retain_n/release_n entry points. rdar://22629226
Swift SVN r31989
2015-09-16 05:35:09 +00:00
David Farler
9e4d52c9cb Reinstate watchOS and other SDK overlays to build against the public SDKs.
Un-revert the below commits with the following addition:
add declarations for posix_spawn related APIs to SwiftPrivateDarwinExtras.
posix_spawn-related APIs aren't available in the public SDKs, so force past
the availability by creating our own stubs in the internal DarwinExtras
library.

r31244, r31245

CMake: build all platforms except watchOS using the public SDK

Covers rdar://problem/21145996.
A step towards rdar://problem/21099318.

Switch SDK overlays to use the public SDK

I had to cut the dependency on CrashReporterClient.h and reimplement
some of that code inline in the Swift runtime.  This shoud be OK (even
though not very clean), since the layout of CrashReporter sections is
ABI.

rdar://21099318

Swift SVN r31252
2015-08-14 22:09:49 +00:00
Dmitri Hrybenko
c75fc00cec Revert "CMake: build all platforms except watchOS using the public SDK"
This reverts commit r31244.  It broke the buildbot.

Swift SVN r31247
2015-08-14 18:56:15 +00:00
Dmitri Hrybenko
dd38372fb7 CMake: build all platforms except watchOS using the public SDK
Covers rdar://problem/21145996.
A step towards rdar://problem/21099318.

Swift SVN r31244
2015-08-14 17:26:04 +00:00
Slava Pestov
1628bfc3e2 SIL: Split dealloc_ref into [constructor] and [destructor] kinds
dealloc_ref [destructor] is the existing behavior. It expects the
reference count to have reached zero and the isDeallocating bit to
be set.

The new [constructor] variant first drops the initial strong
reference.

This allows DI to properly free uninitialized instances in
constructors. Previously this would fail with an assertion if the
runtime was built with debugging enabled.

Progress on <rdar://problem/21991742>.

Swift SVN r31142
2015-08-11 18:38:00 +00:00
Slava Pestov
89f2af6bb3 Random comment fixes split off from another patch, NFC
Swift SVN r31140
2015-08-11 18:37:52 +00:00
Mish Awadah
10bdef0936 Revert "CMake: build all platforms except watchOS using the public SDK"
This reverts commit cd3f1ba7d1ee2397817e1a165209fdeab8a1c004.

Reverting this b/c it is breaking buildbots with the following:
CMake Error at CMakeLists.txt:522 (message):
  CrashReporterClient library is required, but it was not found

Swift SVN r31047
2015-08-06 06:12:23 +00:00
Dmitri Hrybenko
271acdfcab CMake: build all platforms except watchOS using the public SDK
Covers rdar://problem/21145996.
A step towards rdar://problem/21099318.

Swift SVN r31041
2015-08-06 04:28:05 +00:00
Michael Gottesman
839a4d7737 Track retain_n and release_n in dtrace as single retains, releases.
Swift SVN r30395
2015-07-20 06:34:58 +00:00
Erik Eckstein
57c5de4491 [llvm-arc-opts] Optimize strong_retain_unowned/strong_release pairs.
Replaces a swift_retainUnowned/swift_release pair with a swift_checkUnowned, if possible.
For details see rdar://problem/21297936




Swift SVN r30262
2015-07-16 13:46:18 +00:00
Michael Gottesman
4ce5cdad17 [llvm-arc-opts] Implement swift_{retain,release}_n.
rdar://21803771

Swift SVN r30204
2015-07-15 00:03:03 +00:00
Joe Groff
a9e69dda79 IRGen/Runtime: Mark indirect cases in an enum's field type infos.
And use this information in EnumMirror to project boxed payloads when we encounter them.

Swift SVN r29866
2015-07-02 00:00:42 +00:00
Joe Groff
d7d3ff2b10 IRGen/Runtime: Keep the payload offset inside both compiler- and runtime-generated box metadata.
A missing link in our polymorphic box projection story, and likely a perf improvement for the generic case as well.

Swift SVN r29835
2015-07-01 04:51:56 +00:00
Joe Groff
2630dba793 Runtime: Rename Box2 functions to Box.
Swift SVN r29763
2015-06-27 18:10:17 +00:00
Joe Groff
8ec59e5c11 Runtime: Implementation for generic typed boxes.
Provide new swift_{alloc,dealloc,project}Box2 entry points that allocate, project, and deallocate typed boxes using runtime-instantiated metadata. Give these a new metadata kind, so that external tools recognize the difference and can interpret the metadata appropriately.

Swift SVN r29714
2015-06-26 00:06:17 +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