Commit Graph

6 Commits

Author SHA1 Message Date
Joe Groff
7b2a6e5e8d IRGen: Emit the "done" check for Builtin.once inline.
This matches how dispatch_once works in C, dramatically cutting the cost of a global accessor by avoiding the runtime call in the hot path and giving the global a unique branch for the CPU to predict away. For now, only do this for Darwin; non-ObjC platforms don't necessarily expose their "done" value as ABI like ours do.

While we're here, change "once" to take a thin function pointer. We don't ever emit global initializers with context dependencies, and this simplifies the runtime glue between swift_once and dispatch_once/std::call_once a bit.

Swift SVN r28166
2015-05-05 15:35:57 +00:00
Graham Batty
eba89b15fe Implemented swift_once with C++11 call_once.
Swift SVN r22972
2014-10-27 17:16:26 +00:00
Dmitri Hrybenko
c2d80c2589 Change swift_once_t to be actually pointer-sized on non-Darwin
Swift SVN r22384
2014-09-30 13:19:16 +00:00
Dmitri Hrybenko
0197e15a0e Runtime: untie swift_once from libdispatch
<rdar://problem/18499385> [Linux] Implement swift_once

Swift SVN r22383
2014-09-30 12:02:15 +00:00
Dave Zarzycki
a85b2a3d78 Runtime: Rename Alloc.* to HeapObject.* (NFC)
Swift SVN r14228
2014-02-21 20:12:07 +00:00
Joe Groff
562e2bfff6 Runtime: Add swift_once function.
For now, just shim over dispatch_once.

Swift SVN r10514
2013-11-16 03:11:17 +00:00