Commit Graph

270 Commits

Author SHA1 Message Date
Dave Zarzycki
06731bbe21 Heap feedback: rename _swift_zone_init_ to _swift_zone_initImpl
Swift SVN r17729
2014-05-08 23:20:49 +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
Joe Groff
1dce36edd2 Make 'T.self is U.Type' work.
Fix up all of type-checking, SILGen, IRGen, and the runtime to support checked casts of metatypes. <rdar://problem/16847453>

Swift SVN r17719
2014-05-08 22:55:14 +00:00
Enrico Granata
720478bf96 Add a URL case to QuickLookObject
This is to be used by playgrounds to provide a better sidebar representation of web pages than simply showing the URL text

Part of rdar://16799088



Swift SVN r17710
2014-05-08 19:15:36 +00:00
Dave Abrahams
3606513c36 [stdlib] Factor out _fixLifetime
Apparently Builtin.fixLifetime isn't yet respected
(<rdar://problem/16464507>) and calls to that and swift_keepAlive were
getting scattered around randomly.  Let's have a convenient library
function instead.

Swift SVN r17493
2014-05-05 23:21:47 +00:00
Dave Abrahams
c20f08c596 [stdlib] Don't bake refcounting details into apps
DaveZ says: In the future we're likely to store "associated objects,"
which will make inlining the introspection of the reference count
problematic.

Swift SVN r17481
2014-05-05 19:26:43 +00:00
Enrico Granata
46780871a8 Add a separate .Sprite quickLookObject type for SpriteKit objects
We still want to send out image data for those, but UI consumers need to be able to differentiate - should they so desire - a true image from a software sprite rendered in pictorial form

Part of the fix for rdar://16806238



Swift SVN r17471
2014-05-05 18:17:12 +00:00
Joe Groff
c76da32358 runtime: Cache the results of swift_conformsToProtocol.
Playground and array bridging code spends a lot of time here, so instead of brazenly dlsyming each and every time we want to look up a conformance, cache results in a DenseMap. <rdar://problem/16809482>

Swift SVN r17464
2014-05-05 17:41:37 +00:00
John McCall
bafeb84a56 Generate unique type metadata for foreign classes.
Swift SVN r17430
2014-05-05 06:45:42 +00:00
Enrico Granata
88e841ce10 Mis-ordering of cases - thanks Joe!
Swift SVN r17391
2014-05-04 18:05:46 +00:00
Enrico Granata
cb53af1bd1 Add a View tag to the QuickLookObject enum
This tag is meant to trade in image data, but be explicit about the fact that this is a "screenshot" of a UI view rather than a plain ol' picture

Fixes the swift library part of rdar://16796532



Swift SVN r17390
2014-05-04 18:03:13 +00:00
Greg Parker
3353e15270 [runtime] Don't free() a static empty string.
iOS device's CrashReporterClient is currently a no-op that is 
incompatible with malloc/free usage.


Swift SVN r17375
2014-05-04 09:13:34 +00:00
Greg Parker
cb94a2be54 [runtime] Use asl_log() instead of asl_log_message() to log to system console.
asl_log_message() is not available on OS X 10.9.


Swift SVN r17373
2014-05-04 08:21:37 +00:00
Doug Gregor
f3c390e94b Disable use of asl_log_message for now
Swift SVN r17318
2014-05-03 17:12:04 +00:00
Greg Parker
47efdd9885 [runtime] Write fatal error messages to crash logs (where available).
Swift SVN r17306
2014-05-03 02:57:32 +00:00
Dave Zarzycki
1326006ed8 Runtime heap/introspection: Instruments team feedback
Swift SVN r17274
2014-05-02 21:41:16 +00:00
John McCall
c57dac63ae Use the first element of structs and tuples as a source
for extra inhabitants.

For structs in particular, this eliminates a major source
of abstraction penatlies.  For example, an optional struct
containing an object pointer is now represented the same
way as an optional object pointer, which is critical for
correctly importing CF types as Unmanaged<T>!.

In time, we should generalize this to consider all elements
as sources for extra inhabitants, as well as exploiting
spare bits in the representation, but getting the
single-element case right really provides the bulk of the
benefit.

This commit restores r17242 and r17243 with a fix to use
value witnesses that actually forward the right type metadata
down.  We were already generating these value witnesses in
the dependent struct VWT pattern, but I was being too clever
and trying to use the underlying value witness directly.

Swift SVN r17267
2014-05-02 20:17:14 +00:00
Joe Groff
05a9a266e4 Revert "Use the first element of an enum as a source for"
This reverts commit r17242. We can't simply forward tuple element extra
inhabitant witnesses for the same reason laid out in the previous commit.

Swift SVN r17252
2014-05-02 16:22:44 +00:00
Joe Groff
0e6ec12b57 Revert "Use the first element of a struct as a source for"
This reverts commit r17243. We can't just forward the extra inhabitant payloads
from a field, because they will end up receiving metadata for the incorrect
type and crashing.

Swift SVN r17251
2014-05-02 16:22:41 +00:00
John McCall
c0e4242bec Use the first element of a struct as a source for
extra inhabitants.

Obviously this should eventually be generalized to
take from any element, but this is good enough to
give us zero-cost abstraction via single-field structs.

Contains some bugfixes for the tuple-extra-inhabitant
changes as well, because test coverage for optional
structs is obviously quite a bit richer than for
optional tuples.

All of this is leading towards unblocking IRGen for
importing CFStringRef as Unmanaged<CFString>!.

Swift SVN r17243
2014-05-02 10:29:55 +00:00
John McCall
422df2e3bb Use the first element of an enum as a source for
extra inhabitants.

This is obviously not as general as it should be,
but it actually helps a lot.

I started doing enums assuming it would teach me
something about how to do it for structs, and it
kindof worked.

Swift SVN r17242
2014-05-02 10:29:53 +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
Dave Zarzycki
fcd4667f08 Runtime heap: add some missing locking
Swift SVN r17104
2014-04-30 19:29:56 +00:00
Dave Zarzycki
d0e88b4060 Mangler hack for various subsystems feedback
Swift SVN r17069
2014-04-30 04:20:54 +00:00
Dave Zarzycki
5338ad9223 Runtime: add a crude mangler for Interface Builder
Someday we'll have time to disentagle the real mangler from the rest of the compiler. For now, this is a hack.

<rdar://problem/16671220> Add a simple mangler API just for handling "Module.ClassName" and "Module.ProtocolName" cases

Swift SVN r17066
2014-04-30 03:13:23 +00:00
Enrico Granata
4fb2175901 The default Mirror implementation used to have a special case for NSString-typed things, such that they would quicklook as their own string data
However, this broke for Swift subclasses of NSString because the Swift mirror took precedence over the ObjC NSString choice
Notably, it broke for NSContiguousString

This patch fixes that by explicitly making NSString reflectable, so that its subclasses will automagically do the right thing here

Fixes rdar://16758974



Swift SVN r17059
2014-04-30 00:06:54 +00:00
Enrico Granata
39a45d8004 Add a custom Mirror for NSRange, and export a Range(UInt64, UInt64) as the quicklook object for it
This is the last chunk of stdlib work for rdar://16681498


Swift SVN r17040
2014-04-29 19:11:07 +00:00
Enrico Granata
9ab5cea296 Add a new case to the QuickLookObject enum: Logical(Bool)
This is meant to represent to UI consumers the notion of a logical truth value
Previously, we were using a String case to represent such values, but that loses potentially useful information to UI layers

This fixes rdar://16719431



Swift SVN r17037
2014-04-29 16:36:40 +00:00
Joe Groff
71678b4bdf IRGen/Runtime: Expose the 'isBitwiseTakable' bit in the value witness flags.
Set a bit for types that are non-bitwise-takable, and calculate it as part of runtime struct and enum layout. Include 'bitwise takable' as part of the runtime 'is inline' calculation to be consistent with the compile-time policy change in r17008.

Swift SVN r17036
2014-04-29 15:23:14 +00:00
Dave Zarzycki
fae27e3357 Runtime: provide inline friendly isa mask/shift variables for 1.0
<rdar://problem/16663586> provide a global isa mask so v-table dispatch doesn't have to call object_getClass

Swift SVN r16980
2014-04-28 15:33:41 +00:00
Doug Gregor
18c4ef0cf0 Revert r16960, which is causing build failures due to missing _objc_debug_isa_class_mask.
Swift SVN r16978
2014-04-28 13:41:12 +00:00
Dave Zarzycki
e5f7cddded Runtime: provide inline friendly isa mask/shift variables for 1.0
<rdar://problem/16663586> provide a global isa mask so v-table dispatch doesn't have to call object_getClass

Swift SVN r16960
2014-04-28 05:47:55 +00:00
Ted Kremenek
49f393920a Rename bridging "convert" functions to start with '_'.
This is part of our poor-man's internal compiler SPI hiding
in the standard library.  We don't want these functions showing
up in code completion, etc.

Swift SVN r16916
2014-04-27 05:13:19 +00:00
Dave Zarzycki
6da5c57926 Runtime: part 1 of work to enable CoreData
Until we lock down the Swift ABI and ship with the OS, we need to be resilient
in the face of ObjC dynamic subclassing and OS changes. In practice, this means
that we need to have a swift runtime ABI to read the isa out of objects. I've
added it as of r. See: swift_getClassMetadata()

We can and will optimize swift_getClassMetadata into a single instruction once
we lockdown our ABI and ship with the OS.

See also: <rdar://problem/16735599>

Swift SVN r16889
2014-04-26 20:00:08 +00:00
John McCall
f3d4513721 Turn some 64-bit metadata fields into 32-bit fields.
We really don't need to support individual objects
this large, much less more than 4 billion fields in
a single type.

Also rearrange the fields to bring the instance
size/alignment fields closer to the class header,
just for a minor locality win.

Swift SVN r16879
2014-04-26 09:43:39 +00:00
Dave Zarzycki
ff84cce42b Runtime: conditional fallback to pthreads given we don't ship with the OS
<rdar://problem/15169581> Custom allocation cache cannot assume OS implementation details for 1.0

Swift SVN r16842
2014-04-25 20:57:03 +00:00
Dave Zarzycki
7fedcbcffc Runtime: standards compliance feedback
Swift SVN r16828
2014-04-25 18:28:26 +00:00
Dave Zarzycki
128027dd4d Runtime: abort on resurrection
Also fix a latent bug in the logic in the disabled code to scribble over memory durring dealloc.

<rdar://problem/15855042> QoI: abort on resurrection

Swift SVN r16827
2014-04-25 18:16:59 +00:00
Joe Groff
5c2bd67459 Runtime: Sync QuickLookObject in the runtime with recent stdlib additions.
Swift SVN r16823
2014-04-25 15:00:08 +00:00
Joe Groff
f29a156e83 IRGen/Runtime: Add value witness slots for array witnesses.
Add value witnesses for destroyArray, initializeArrayWithCopy, and initializeArrayWithTake{FrontToBack,BackToFront}, and fill out the runtime value witness table implementations. Stub out the IRGen ones for now.

Swift SVN r16772
2014-04-24 22:25:26 +00:00
Dave Zarzycki
5e5a369b96 Runtime: Renable proxying and dynamic cast support
As it turns out, Swift classes can stumble into having a non-pointer isa.
This might be a problem for 1.0, but that is beyond the scope of this bug.

Swift SVN r16721
2014-04-23 22:06:39 +00:00
Jordan Rose
0da44e23c3 [CMake] Only look for libCrashReporterClient.a in the SDK.
...if one is set.

Swift SVN r16718
2014-04-23 21:37:33 +00:00
Greg Parker
be6ba21fd9 Revert r16648 because it crashes on arm64.
Swift SVN r16696
2014-04-23 09:11:36 +00:00
Greg Parker
b691055649 Fix an incorrect use of Swift metadata in an ObjC class. Add assertions to
catch such uses in the future.


Swift SVN r16695
2014-04-23 08:55:02 +00:00
Dave Zarzycki
f59141d434 Runtime: far better cmake logic for CrashReporter
From what I've been able to test, this does the right thing in all of the
scenarios I tested.

Swift SVN r16685
2014-04-23 03:45:07 +00:00
Ted Kremenek
03a8dc1f52 Remove linking CrashReportClient.a until the CMake logic is refined to be portable.
Currently this prevents building Swift on 10.9.

Right now CrashReportClient.a is used regardless of the SDK being used,
and the CMake logic does a check for the .a across different platforms
and SDKs without checking what the build product target OS actually is.
The current logic somewhat works because the SDKs will be in different
Platforms, but it is fragile.

Swift SVN r16678
2014-04-23 00:13:30 +00:00
Chris Lattner
411e5baf02 revert r16670, which included more than it should have.
Swift SVN r16671
2014-04-22 22:51:26 +00:00
Chris Lattner
4fc1154ca7 implement <rdar://problem/16692437> shadowing loop labels should be an error
Swift SVN r16670
2014-04-22 22:50:46 +00:00
Joe Groff
02e95c2866 stdlib: Use #if to clean up platform-dependent branching in VarArgs implementation.
NFC, but we kill a needless runtime stub.

Swift SVN r16669
2014-04-22 22:38:15 +00:00
Greg Parker
1121b2c132 Revert r16666 because I think my test configuration was wrong.
Swift SVN r16667
2014-04-22 22:24:57 +00:00