Commit Graph

627 Commits

Author SHA1 Message Date
Joe Groff
1d9d153136 IRGen: Consistently mangle protocol names in protocol descriptors with the _Tt prefix.
Since protocol descriptors look like ObjC Protocol objects, we want to mangle the type prefix into their names to make them obviously Swift mangled names, but we were only doing this for @objc protocols, not native protocols. For consistency, do the same thing with native descriptors, and update the runtime type display code to match. Fixes rdar://problem/19691574.

Swift SVN r25014
2015-02-05 20:04:20 +00:00
Dave Abrahams
94965036d5 [stdlib] Move ObjC Mirrors out of Foundation
These mirrors are the default mirrors that get used for all objective-C
object, including some that aren't defined in Foundation:

  import Dispatch
  println(dispatch_get_global_queue(0,0))

This example isn't fixed yet, because we need to pull all the string
bridging goop out of Foundation and into the core standard library.

Swift SVN r25012
2015-02-05 19:18:33 +00:00
Dave Abrahams
a89c2e11ae [stdlib] Create shims for CFString access in core
...and use these shims in place of our previous inelegant dispatch
through 'C' code.

Swift SVN r25010
2015-02-05 19:18:31 +00:00
Joe Groff
8e1e6665a7 IRGen: Start a type verifier to fuzz static type info against runtime type info.
We've had a rash of bugs due to inconsistencies between how IRGen and the runtime think types are laid out. Add a '-verify-type-layout' mode to the frontend that causes IRGen to emit a bunch of code that compares its static assumptions against what the runtime value witness does.

Swift SVN r24918
2015-02-03 16:47:25 +00:00
Joe Groff
7191b87759 Runtime: Don't touch potentially ObjC unowned-referenced objects to determine their species.
ObjC unowned references are backed by an ObjC weak reference which will eagerly deallocate the object when it's strongly released, so in an unknown-refcount situation, we can't safely dereference the object pointer to determine its Swiftness. We can, however, look at the side table of weak references; if there's an entry for this object, then it's reliably an ObjC object (or it's some other object that got allocated in the reclaimed space for the dead object, but that's a race we fundamentally can't win with this broken design). Fixes rdar://problem/18091547 (modulo the aforementioned reallocation race).

Swift SVN r24825
2015-01-29 22:49:45 +00:00
Graham Batty
625ddfdd97 Correct scope change of objc id var and explain.
Swift SVN r24821
2015-01-29 20:58:19 +00:00
Graham Batty
383dd5d6c4 Moves dangling objc variable declaration into #if.
Swift SVN r24820
2015-01-29 20:24:02 +00:00
Joe Groff
7e78ff68d1 IRGen/Runtime: Make dynamic metatype-to-AnyObject casts work.
Bonus fix for rdar://problem/19624697.

Swift SVN r24808
2015-01-28 23:06:45 +00:00
Nadav Rotem
b1ca4bfab5 Move the concurrent utilities to the /include directory
Swift SVN r24699
2015-01-24 01:08:03 +00:00
Nadav Rotem
e506c33ed6 Fix a typo
Swift SVN r24698
2015-01-24 01:07:59 +00:00
Greg Parker
6d72340259 [runtime] Add -[SwiftObject isNSString__] et al. for Foundation's use.
rdar://19503750


Swift SVN r24668
2015-01-23 01:43:42 +00:00
Graham Batty
057c27f009 Disable existential metatype casting on non-objc.
Also fixes getting the size of an instance of a class to
work without it when objective-c interop is turned off.

Swift SVN r24477
2015-01-16 20:27:54 +00:00
Dmitri Hrybenko
83f5a45f24 stdlib/runtime: re-enable CrashReporter
Fold the contents of CrashReporterClient.a into the Swift runtime.

rdar://19482263

Swift SVN r24443
2015-01-15 10:13:02 +00:00
Greg Parker
512a088483 <rdar://19404150> Disable crash log messages; they break the static libraries.
Swift SVN r24442
2015-01-15 09:00:40 +00:00
John McCall
a027f3bc46 Flesh out the pinning API to cover all the cases
we need for arrays.

Swift SVN r24421
2015-01-14 19:14:24 +00:00
Enrico Granata
1099342fcd Fix an issue with my previous patch, where I didn't correctly add the new Float and Double cases in all code paths; and as a result I could get away with assigning a double value to a supposedly float payload without issue
Swift SVN r24377
2015-01-12 23:33:29 +00:00
Enrico Granata
729b90e087 Split the floating-point QuickLook object in two: Float and Double for respectively single and double precision values
This allows reflection clients a more detailed perspective on what precision values they are inspecting, and is largely meant to support improvements to the way Xcode represents floating point numbers in the playgrounds UI (rdar://19124310)



Swift SVN r24372
2015-01-12 19:54:58 +00:00
John McCall
f3dc58667d Improve the typing of materializeForSet callbacks to
use a thin function type.

We still need thin-function-to-RawPointer conversions
for generic code, but that's fixable with some sort of
partial_apply_thin_recoverable instruction.

Swift SVN r24364
2015-01-11 21:13:35 +00:00
John McCall
6a91f7a172 Various improvements to the function-type ABI.
Teach IRGen and the runtime about the extra inhabitants
of function pointers, and take advantage of that in
thin and thick function types.

Also add runtime entrypoints for thin function type
metadata.

Swift SVN r24346
2015-01-10 01:45:37 +00:00
Nadav Rotem
5b28adadae Add a comment about the use of the function attribute.
Swift SVN r24235
2015-01-07 01:09:11 +00:00
Nadav Rotem
15532a0fb5 Avoid calling bzero in Optional.init() by specializing the common tagbyte sizes.
Swift SVN r24234
2015-01-07 00:58:27 +00:00
Nadav Rotem
b75f58c27f Cleanup: refactor the metadata generation part of the code to a new function. NFC.
Swift SVN r24232
2015-01-07 00:25:10 +00:00
Dmitri Hrybenko
f996883fd6 SwiftObject.mm: explicitly include some headers that are used on Apple
ObjC platofrms

Swift SVN r24175
2015-01-05 07:18:11 +00:00
Dmitri Hrybenko
9dd5f658ad CMake: Linux builds
The variable we were using was not defined, and the if() statement was
not properly terminated.

Swift SVN r24155
2014-12-26 11:13:27 +00:00
Michael Gottesman
24b98cf55c Convert llvm_unreachable => crash.
Swift SVN r24133
2014-12-23 23:47:06 +00:00
Nadav Rotem
4069a4091d Specialize the memcpy in swift_getEnumCaseSinglePayload for the case of small constant values.
The libc memcpy implementation is not optimized for the case of constant count
values (because of the function's interface) and is not inlineable. Using the local
implementation allows us to eliminate the trampoline in the call and optimize for
small constants.

This gives a 4% boost on Prims.

Swift SVN r24131
2014-12-23 23:05:59 +00:00
Nadav Rotem
a8395e2895 A small cleanup. NFC.
Swift SVN r24130
2014-12-23 23:05:58 +00:00
Dmitri Hrybenko
6670bb76ec Rewrite the CMake build system
Swift SVN r24124
2014-12-23 22:15:30 +00:00
Nadav Rotem
22b722d1c3 Document and explain which parts of the cache are locked.
Swift SVN r24098
2014-12-23 03:01:12 +00:00
Nadav Rotem
9dbd84932c Document some parts of the conformance search process. NFC.
Swift SVN r24093
2014-12-23 00:32:16 +00:00
Nadav Rotem
e2bd14ddfe Fix an 80-col violation.
Swift SVN r24092
2014-12-23 00:32:15 +00:00
Nadav Rotem
c9308b75b7 Remove the locks from the fast path of swift_conformsToProtocol
Swift SVN r24091
2014-12-23 00:32:15 +00:00
Nadav Rotem
fbd3264662 Whitespace.
Swift SVN r24090
2014-12-23 00:32:15 +00:00
Nadav Rotem
a4a835f712 Refactor the code that searches the conformance cache into a new method. NFC.
Swift SVN r24089
2014-12-23 00:32:14 +00:00
Nadav Rotem
65589c8c7a Whitespace
Swift SVN r24088
2014-12-23 00:32:14 +00:00
Nadav Rotem
0d6888dfa6 Refactor the code that installs the dylib inspection callbacks. NFC.
Swift SVN r24087
2014-12-23 00:32:11 +00:00
Dmitri Hrybenko
d6406875d8 Annotate runtime functions that use the Swift +1 parameter convention
with NS_RELEASES_ARGUMENT

Swift SVN r24057
2014-12-20 04:11:44 +00:00
Dmitri Hrybenko
4f819a9cf7 Remove an NSSet.copyObjectPointers() API that was unintentionally added
Swift SVN r24054
2014-12-20 03:01:34 +00:00
Dmitri Hrybenko
9177107940 stdlib/Hashing: move the hash seed variable to C++ code to avoid
dispatch_once calls on every load from it

Performance improvements, as reported by the perf testing buildbot:

Histogram       -18.81%
TwoSum          -17.42%
RGBHistogram    -9.65%

Regressions:

InsertionSort                5.59%
ArrayOfRef                   3.99%
SwiftStructuresInsertionSort 5.29%
PrimeNum                     6.09%

These regressions are bogus.  The tests that "regressed" don't do any
hashing at all.

Swift SVN r23995
2014-12-17 23:45:29 +00:00
Nadav Rotem
e9ba57a342 Replace std::function with llvm::function_ref to avoid memory allocation for large lambdas.
This class does not own the callable and does not allocate memory.

Swift SVN r23952
2014-12-16 00:47:28 +00:00
Nadav Rotem
d7e6386850 Revert "Get rid of a memory allocation on each call to the getXXXMetadata functions."
This reverts r23919.

Swift SVN r23951
2014-12-16 00:47:25 +00:00
Dmitri Hrybenko
e87bcff79d stdlib: move String.{lowercaseString,uppercaseString} to the core
library

Swift SVN r23936
2014-12-15 09:47:03 +00:00
Nadav Rotem
e9ffbd6707 Get rid of a memory allocation on each call to the getXXXMetadata functions.
We were using std::function that allocated memory. Unfortunately c++ lambdas
don't have a type so I had to make the function findOrAdd templated on the
type of the callback. This is not a big deal since the class is already
templated and there is a single call site.

Swift SVN r23919
2014-12-14 05:43:23 +00:00
Maxwell Swadling
63462e64d0 [stdlib] Added ASCII fast path for string hashing
Swift SVN r23896
2014-12-12 22:22:58 +00:00
Dmitri Hrybenko
2a19887dec Allow SWIFT_RUNTIME_CLOBBER_FREED_OBJECTS to work on non-Darwin
Swift SVN r23826
2014-12-10 04:34:19 +00:00
Joe Groff
343f35a81c Runtime: Make sure the superclass of a class is realized before we instantiate it.
Fixes a crash when some programs were run in JIT mode; they instantiated a JITed class before the ObjC subclass was realized. Send a message to super to realize the class before we try to readClassPair it. Fixes rdar://problem/19170232.

Swift SVN r23825
2014-12-10 01:12:29 +00:00
John McCall
3b4e0d307e Intrinsic support for pinning.
Using the intrinsics is obnoxious because I needed them
to return Builtin.NativeObject?, but there's no reasonable
way to safely generate optional types from Builtins.cpp.
Ugh.

Dave and I also decided that there's no need for
swift_tryPin to allow a null object.

Swift SVN r23824
2014-12-10 00:52:48 +00:00
Nadav Rotem
de706b1ae6 Whitespace
Swift SVN r23821
2014-12-09 23:51:26 +00:00
Nadav Rotem
ddfe1cc876 Use size_t for the hash type and fix the undefined behavior that came from shifts on 32bit targets.
Swift SVN r23814
2014-12-09 22:31:27 +00:00
Joe Groff
f229161b9b Runtime: Fix memory management in swift_ClassMirror_quickLookObject.
rdar://problem/18513769. Add tests that exercise all the code paths to ensure we keep everything balanced.

Swift SVN r23773
2014-12-07 20:55:24 +00:00