Commit Graph

17 Commits

Author SHA1 Message Date
Michael Gottesman
636b5f67f0 [runtime] Add support for an asserts only debugging routine called swift_dumpTrackedAccesses().
This makes it easy to perform printf debugging in the debugger. I have found it
to be useful in understanding programs around exclusivity quickly.
2018-04-19 21:37:12 -07:00
Andrew Trick
89d96bff4e Runtime support for nontracking begin_access.
There are multiple reasons to do this. Primarily this is
useful as an optimization. Whenever analysis can determine that no
potentially conflicting access occurs within the scope, the access can
be demoted to "nontracking". It is also useful as an escape hatch for
future code deploying to older runtimes. For example, if a future access
scope may cross threads, and the older runtime doesn't know how to
migrate threads.

See <rdar://problem/37507434> add a flag to swift_beginAccess to inform
the runtime that an access might migrate between threads
2018-03-27 12:04:32 -07:00
Greg Parker
1a0e3e7c31 [runtime] Don't use C++ thread_local on two old Apple simulators.
32-bit iOS 9 simulator and 32-bit watchOS 2 simulator do not support
C++ thread_local, even though clang's has_feature(cxx_thread_local)
thinks they do.

rdar://35063043
2017-10-19 16:55:19 -07:00
Saleem Abdulrasool
ef70671f77 runtime: clean up some warnings
This is a smorgasbord of warning cleanups in the runtime.  This just
adjusts the casts for the various types.  There were a number of casts
which lost const qualifiers on the type.
2017-09-17 16:20:16 -07:00
Jordan Rose
9c10398514 [runtime] Expose reportToDebugger as swift_reportToDebugger.
...so that the overlays can use it. See next commit.
2017-07-13 11:18:41 -07:00
Andrew Trick
91405a7f91 Remove the hash function from the runtime's exclusive access checks.
I expect this to improve the following Onone benchmarks:
- 1.09x accessGlobal
- 1.08x accessInMatSet
- 1.06x accessIndependent

And the preexisting benchmarks:

| TEST                    | DELTA | SPEEDUP   |
|                         |       |           |
| Random                  | -7.9% | **1.09x** |
| MatMul                  | -7.6% | **1.08x** |
| XorShift                | -7.2% | **1.08x** |
| PolymorphicCalls        | -6.2% | **1.07x** |
| NopDeinit               | -6.1% | **1.06x** |
| Ary                     | -6.0% | **1.06x** |
| Integrate               | -5.8% | **1.06x** |
| StringWalk              | -5.5% | **1.06x** |
| ArrayInClass            | -5.2% | **1.06x** |
| MultiFileTogether       | -5.2% | **1.06x** |
| DictionaryHashableClass | -5.2% | **1.05x** |
| MultiFileSeparate       | -4.9% | **1.05x** |
2017-06-29 16:32:35 -07:00
Kuba (Brecka) Mracek
8cb95b8fcd Improve reporting of @objc inference issues from the Swift runtime (#10406)
* Extend Swift runtime issue reporting for @objc inference to include details about the declaration of the method (that is missing the @objc annotation) and a suggested fix-it. This changes the ABI of RuntimeErrorDetails, so we're also bumping the version.

* Update SwiftObject.mm
2017-06-22 21:35:48 -07:00
Kuba (Brecka) Mracek
d29557bd24 Change the signature of reportToDebugger and _swift_runtime_on_report to avoid using 'bool'. It's much easier to work with native-width integers only in LLDB. (#10523) 2017-06-22 21:22:27 -07:00
John McCall
4399bd37fa Fix some embarrassing list-management bugs with the exclusivity runtime
which can arise when accesses are not strictly nested.
2017-06-21 19:04:46 -04:00
Kuba (Brecka) Mracek
fec8d72ea3 Debugger hook/breakpoint for issue reporting from the Swift runtime (#10293)
* Implements a debugger hook (breakpoint) API and data structure. This structure is passed to the debugger and describes extra information about a fatal error or a non-fatal warning, which should be logged as a runtime issue.

This debugger hook is then used from two places, which currently only log to stderr:
- Runtime exclusivity violations.
- Swift 3 implicit Obj-C entrypoints.

A subsequent LLDB support will be able to catch these callbacks and show the runtime issues in a better way than just logging them to stderr.  When the debugger is not attached, this shouldn't have any effect.
2017-06-19 14:28:19 -07:00
Kuba (Brecka) Mracek
a5a59f5aed [runtime] Enhance output from dynamic exclusivity violations. Print current stacktrace and the symbolicated frame of the previous conflicting access. (#9501) 2017-05-12 20:28:28 -07:00
practicalswift
8a26719344 [gardening] Fix duplicate include. 2017-05-11 16:04:48 +02:00
John McCall
ab250848b4 Downgrade dynamic exclusivity failures to a warning in Swift 3 compatibility mode. 2017-05-10 14:44:59 -04:00
John McCall
e01c31a17c Remember a PC in the exclusivity-tracking set and report it during failures. 2017-05-10 14:44:56 -04:00
John McCall
2525710017 Make the exclusivity-set tracking a singly-linked list.
We'll use this space for something else in a follow-up.
2017-05-10 01:35:34 -04:00
Devin Coughlin
73aabd73f7 [Exclusivity] Fix insertion/remove in AccessSet in runtime.
And add some basic tests for trapping on accesses to globals.
2017-04-27 15:38:07 -07:00
John McCall
6c16cfaa14 Implement a basic dynamic-enforcement runtime and teach IRGen to use it. 2017-04-18 11:23:43 -04:00