Commit Graph

21665 Commits

Author SHA1 Message Date
Dmitri Hrybenko
4f921ad60b Unbreak iOS build
Swift SVN r18002
2014-05-13 13:27:39 +00:00
Dmitri Hrybenko
2cc8fe40d4 stdlib/printing: replace four printing systems with one new one
The old ones were:

- print/println
- printAny
- printf
- Console

The new printing story is just print/println.  Every object can be printed.
You can customize the way it is printed by adopting Printable protocol.  Full
details in comments inside stdlib/core/OutputStream.swift.

Printing is not completely finished yet.  We still have ReplPrintable, which
should be removed, string interpolation still uses String constructors, and
printing objects that don't conform to Printable will result in printing
mangled names.


Swift SVN r18001
2014-05-13 13:07:59 +00:00
Doug Gregor
795f568898 Start diagnosing the use of '`' rather than '#', with a Fix-It.
<rdar://problem/16891828>.

Swift SVN r17982
2014-05-13 00:03:05 +00:00
Doug Gregor
1efd9fba5b Start accepting '#' in addition to '`' to mark a keyword argument <rdar://problem/16891828>.
Update the standard library, tests, diagnostics, and Fix-Its.

Swift SVN r17981
2014-05-13 00:03:04 +00:00
Doug Gregor
93f7ac2e48 Fix the name of the initializer for initWithObjectsAndKeys.
Swift SVN r17974
2014-05-12 23:21:44 +00:00
Doug Gregor
73528dc0e0 Enable importing factory methods as initializers by default.
Finishes <rdar://problem/16509024>.

Swift SVN r17972
2014-05-12 23:01:20 +00:00
Ted Kremenek
fad874708e Adjust test cases.
Swift SVN r17964
2014-05-12 22:01:52 +00:00
Dave Zarzycki
806d2decd2 Runtime: Fix an oversight with the previous gmalloc fix
Swift SVN r17951
2014-05-12 19:30:17 +00:00
Dave Zarzycki
504701bda5 Runtime heap: defer to gmalloc when gmalloc is loaded
<rdar://problem/13318927> jDisable allocation cache when using gmalloc

Swift SVN r17950
2014-05-12 19:24:03 +00:00
Dave Zarzycki
f618a98ec4 Runtime: Remove swift_getClassMetadata()
Greg's arclite hack is much better. See also: <rdar://problem/16735599>

Swift SVN r17945
2014-05-12 18:24:24 +00:00
Ted Kremenek
49d4fca14d Rename UTF16Scalars to UnicodeScalarView.
Implements <rdar://problem/16821900>.

Swift SVN r17899
2014-05-11 23:51:07 +00:00
Dmitri Hrybenko
2dc5ed55e0 runtime: add hacks for stdlib: runtime calls to perform casts to existential
types that are protocols


Swift SVN r17866
2014-05-11 01:26:04 +00:00
Jordan Rose
d410bd0acd [CMake] Re-enable -autolink-force-load to cause the buildbot to fail.
I can't reproduce this locally, so I'll need to run this on the buildbot
and inspect the output.

Swift SVN r17795
2014-05-09 19:11:11 +00:00
Dave Zarzycki
b92b64617b Heap: avoid reentrancy when Instruments enables ObjectAlloc
We need a custom but simple map table for two reasons:
1) To precisely control our allocations to avoid reentrancy via Instruments.
2) To prepare for out-of-process introspection via Mach VM calls.

This fixes: <rdar://problem/16718231> Swift allocator must not call malloc nor global operator new

Swift SVN r17769
2014-05-09 08:56:37 +00:00
Greg Parker
fba2e4bd7c Add overlay covers for DISPATCH_QUEUE_CONCURRENT and DISPATCH_SOURCE_TYPE_*.
Swift SVN r17766
2014-05-09 07:06:10 +00:00
Argyrios Kyrtzidis
786ab593dd Revert "[CMake] Build the SDK overlays with -autolink-force-load."
This reverts commit r17752, because it caused link failures of Interpreter and stdlib tests.

Swift SVN r17758
2014-05-09 04:02:54 +00:00
Jordan Rose
20fb4513e2 [CMake] Fix dependencies for swiftDispatch.
Without proper dependencies among the overlays, we may try to load an
outdated overlay module while building another overlay.

Swift SVN r17753
2014-05-09 01:20:34 +00:00
Jordan Rose
90c5fbe029 [CMake] Build the SDK overlays with -autolink-force-load.
Final part of <rdar://problem/16829587>

Swift SVN r17752
2014-05-09 01:20:33 +00:00
Argyrios Kyrtzidis
4f0776936a [stdlib] Dispatch depends on Darwin.
Swift SVN r17749
2014-05-09 01:04:44 +00:00
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
Greg Parker
f1d020e11a <rdar://16848707> Add Dispatch overlay with covers for some libdispatch macros.
Swift SVN r17693
2014-05-08 09:47:00 +00:00
Ted Kremenek
05e9efb093 Don't compile XCTest overlay as being Application Extension safe.
Swift SVN r17682
2014-05-08 04:49:00 +00:00
Dmitri Hrybenko
63c5a145b4 stdlib: factor out _SwiftNSFastEnumerationState initialization
Swift SVN r17624
2014-05-07 12:54:17 +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
7f29548040 [stdlib] Re-alphabetize CMakeLists.txt
Swift SVN r17489
2014-05-05 21:24:45 +00:00
Dave Abrahams
23f98db278 [stdlib] A .utf16 property for String
Also, test the .utf8 property

Swift SVN r17488
2014-05-05 21:23:48 +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
Ted Kremenek
3d248270ca Add prototype for KVO API overlay ("KVOContext") to NSObject, and provide test case.
This change adds a new variant of "addObserver:forKeyPath:options:context:"
that takes a "KVOContext" instead of an unsafe void*.  The variant
delegates to the original method, but first 'retain's the object
before turning it into an unsafe pointer.  The API is then matched
with a variant of 'removeObserver:forKeyPath:context:' which
delegates to the original method and then 'release's it.

This vision here is that Swift clients of this API will use this
variant, and not the unsafe one.  A refinement (later) is to
not expose the original methods at all, and provide a new method
'observeValueForKeyPath:ofObject:change:kvoContext:' that implements
a thunk that delegates to 'observeValueForKeyPath:ofObject:change:context:'
and does the void* cast (which the code in the test case does).

This needs to go through API review; names are strawman names.

Swift SVN r17325
2014-05-03 20:06:28 +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
Ted Kremenek
050fd53af7 Rename UncheckedOptional to ImplicitlyUnwrappedOptional.
Swift SVN r17232
2014-05-02 06:13:57 +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
Greg Parker
4c9c52fb81 <rdar://15931346> Fix KVO.
* Temporarily turn on -link-objc-runtime by default. This will be 
  removed again in rdar://16753644.
* Symlink XcodeDefault.xctoolchain's copies of arclite into the Swift build's 
  resource directory so tests can see it.
* Enable the KVO test.


Swift SVN r17132
2014-05-01 01:39:23 +00:00
Dave Zarzycki
fcd4667f08 Runtime heap: add some missing locking
Swift SVN r17104
2014-04-30 19:29:56 +00:00