Commit Graph

32 Commits

Author SHA1 Message Date
David Smith
de50b0a387 Eliminate pointer auth overhead in interposable refcount support (#71448)
Fixes rdar://122595662
2024-02-15 18:21:34 -08:00
Mike Ash
6606850232 [Runtime] Add option to remove override point for retain/release.
Add a `SWIFT_STDLIB_OVERRIDABLE_RETAIN_RELEASE` CMake option. When set to true, swift_retain/release and the other functions in InstrumentsSupport.h can be overridden by setting the appropriate global function pointer, as is already the case. When set to false, those function pointers are removed and the functions always go into the default implementation.

Set `SWIFT_STDLIB_OVERRIDABLE_RETAIN_RELEASE` to false when building the minimal stdlib, and set it to true otherwise by default.

rdar://115987924
2023-10-31 15:26:01 -04:00
Saleem Abdulrasool
910fbee14e gardening: make c++98-compat-extra-semi an error
This cleans up 90 instances of this warning and reduces the build spew
when building on Linux.  This helps identify actual issues when
building which can get lost in the stream of warning messages.  It also
helps restore the ability to build the compiler with gcc.
2021-11-27 11:40:17 -08:00
Kuba Mracek
84c4864911 [arm64e] Add Swift compiler support for arm64e pointer authentication 2020-02-27 16:10:31 -08:00
troughton
e156826984 Remove _swift_allocBox_ function pointers. 2018-02-03 10:20:57 +13:00
troughton
cf28ff448c Remove TwoWordPair and use SwiftCC instead. 2018-02-03 09:43:00 +13:00
Greg Parker
e223f1fc9b [IRGen][runtime] Simplify runtime CCs and entry point ABIs (#14175)
* Remove RegisterPreservingCC. It was unused.
* Remove DefaultCC from the runtime. The distinction between C_CC and DefaultCC
  was unused and inconsistently applied. Separate C_CC and DefaultCC are
  still present in the compiler.
* Remove function pointer indirection from runtime functions except those
  that are used by Instruments. The remaining Instruments interface is
  expected to change later due to function pointer liability.
* Remove swift_rt_ wrappers. Function pointers are an ABI liability that we
  don't want, and there are better ways to get nonlazy binding if we need it.
  The fully custom wrappers were only needed for RegisterPreservingCC and
  for optimizing the Instruments function pointers.
2018-01-29 13:22:30 -08:00
Greg Parker
7b9224794e [runtime] Reinstate TwoWordPair hack for swiftcall returns. (#14079)
clang is miscompiling some swiftcall functions on armv7s.
Stop using swiftcall in some places until it is fixed.

Reverts c5bf2ec (#13299).

rdar://35973477
2018-01-23 01:04:01 -08:00
Thomas Roughton
c5bf2ec553 [runtime] Remove TwoWordPair and use the Swift calling convention instead. (#13299) 2017-12-07 19:27:24 -08:00
Arnold Schwaighofer
3ae6d7cb4d runtime/IRGen: return the argument from swift_retain family of functions
On architectures where the calling convention uses the same argument register as
return register this allows the argument register to be live through the calls.

We use LLVM's 'returned' attribute on the parameter to facilitate this.

We used to perform this optimization via an optimization pass. This was ripped
out some time ago around commit 955e4ed652.
By using LLVM's 'returned' attribute on swift_*retain, we get the same
optimization from the LLVM backend.
2017-09-19 07:16:37 -07:00
Hugh Bellamy
63cf2d561e Remove extern "C" from uses of SWIFT_RUNTIME_EXPORT 2017-01-22 18:32:17 +00:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01: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
Roman Levenstein
5d22a59e01 Provide non-atomic versions of many reference counting operations.
Provide the same guarantees regrading the barriers as the atomic versions.
2016-03-30 16:43:05 -07:00
Joe Groff
f7291b21ec Runtime: Build with -fvisibility=hidden.
...and explicitly mark symbols we export, either for use by executables or for runtime-stdlib interaction. Until the stdlib supports resilience we have to allow programs to link to these SPI symbols.
2016-02-08 08:06:02 -08:00
practicalswift
199c4eae2e Consistent use of programming language indicator in top of file comment. 2016-01-04 09:20:19 +01:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +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
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
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
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
Joe Groff
dfac9181dd Runtime: Add ObjC weak referencing support to SwiftObject.
We were missing -_tryRetain, -_isDeallocating, -allowsWeakReference and -retainWeakReference implementations on SwiftObject, so forming an ObjC weak reference to a pure Swift object always failed and produced a nil reference. Fixes rdar://problem/18637774.

This can be reapplied now that we properly call objc_destructInstance on deallocation.

Swift SVN r23070
2014-11-02 21:03:21 +00:00
Greg Parker
330752b749 Revert r22710 and r22711 implementing ObjC weak ref methods on SwiftObject.
This is still incomplete and needs more work. rdar://18637774.


Swift SVN r22717
2014-10-14 01:33:29 +00:00
Joe Groff
82f6260c64 Runtime: Add ObjC weak referencing support to SwiftObject.
We were missing -_tryRetain, -_isDeallocating, -allowsWeakReference and -retainWeakReference implementations on SwiftObject, so forming an ObjC weak reference to a pure Swift object always failed and produced a nil reference. Fixes rdar://problem/18637774.

Swift SVN r22710
2014-10-13 22:12:39 +00:00
Greg Parker
fe8618a3d2 Scrap the custom allocator until we have time to fix it.
The allocator's crimes include:
* It uses OS SPI that must not be used by non-OS apps.
* It does not play well with memory debugging tools like Instruments.
* It does not return memory to the OS in response to memory pressure.
* It is less tested than we would like because many configurations 
  inadvertently turn it off (such as running from Xcode).
* Its per-thread magazine implementation does not actually work.
* Its "try alloc" flag is incompletely implemented and never used.
* Its "zero fill" flag is unimplemented and inconsistently used.



Swift SVN r20757
2014-07-30 14:11:40 +00:00
John McCall
059ed4cd10 Propagate alignment arguments around through the
slow allocation/deallocation APIs.

Swift SVN r18160
2014-05-16 01:40:36 +00:00
Dave Zarzycki
8b0c9d4e74 Heap: Let Instruments ensure that the heap is setup correctly at launch
Swift SVN r17723
2014-05-08 23:12:57 +00:00
Dave Zarzycki
0a0dbdc36c Runtime: make the index <-> size functions easier to lookup dynamically
Swift SVN r17711
2014-05-08 19:25:29 +00:00
Dave Zarzycki
1326006ed8 Runtime heap/introspection: Instruments team feedback
Swift SVN r17274
2014-05-02 21:41:16 +00:00
Dave Zarzycki
1930222f3b Runtime: Instruments support plan B
Rather than go through reentrant and problematic contortions to make Swift
work with the existing Instruments hooks, they agreed to just patch some
globals that we provide to get their logic to be activated.

Swift SVN r17144
2014-05-01 06:39:45 +00:00