Commit Graph

21502 Commits

Author SHA1 Message Date
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
John McCall
d9e4d6f2ad Add the Unmanaged library type.
Swift SVN r16796
2014-04-25 02:16:04 +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
Joe Groff
5ea0a0734e UIKit overlay: Add our own designated initializers for UIActionSheet and UIAlertView.
The true designated initializers take a variadic argument, which we can't directly support in Swift, so we'll map those definitions to refer to versions that drop the variadic parameters altogether, and reimplement the variadic interface in the overlay.

Swift SVN r16711
2014-04-23 19:52:39 +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
Argyrios Kyrtzidis
65971bc7f4 [CMake] ObjectiveC module depends on the Darwin one.
Swift SVN r16675
2014-04-22 23:48:26 +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
Greg Parker
629e7f59b4 Prevent direct ObjC isa dereference when using ObjCClassWrapperMetadata.
This fixes several tests on arm64.


Swift SVN r16666
2014-04-22 22:14:35 +00:00
Dave Zarzycki
15d7225d72 Runtime: more cmake fun
There really ought to be a better way to reason about the internal SDK.

Swift SVN r16649
2014-04-22 06:47:01 +00:00
Dave Zarzycki
61aec09671 Runtime: optimize dynamicCast for pure Swift scenarios
This is r16606 plus a fix to detect unsafe conditional dynamic casts of ObjC
objects.

Swift SVN r16648
2014-04-22 06:05:42 +00:00
Dave Zarzycki
ca34d1f438 Runtime: More internal SDK support
Swift SVN r16647
2014-04-22 05:38:23 +00:00
Dave Zarzycki
f84efe1da8 Runtime: more cmake internal SDK fun
Swift SVN r16642
2014-04-22 03:41:47 +00:00
John McCall
8681963bcb A couple of long-overdue renames.
Builtin.ObjectPointer -> Builtin.NativeObject
Builtin.ObjCPointer -> Builtin.UnknownObject

Swift SVN r16634
2014-04-22 00:17:08 +00:00
Greg Parker
b6a5152e09 Revert r16606 because it crashes on arm64.
Swift SVN r16629
2014-04-21 22:29:02 +00:00
Dave Zarzycki
accd058682 Runtime: fix a silly cmake mistake
Swift SVN r16626
2014-04-21 21:48:26 +00:00
Dave Zarzycki
f87e9ba3d5 Runtime: optimize dynamicCast for pure Swift scenarios
Swift SVN r16606
2014-04-21 04:34:09 +00:00
Dave Zarzycki
c3bc1fb9c4 Runtime: always inline our crash() function
This function only trashes one register on x86_64 and therefore makes crash
reports easier to debug.

Swift SVN r16604
2014-04-21 04:34:05 +00:00
Joe Groff
5b1f1f523d Runtime: Walk up superclass chains in swift_conformsToProtocol.
Fixes <rdar://problem/16624349>.

Swift SVN r16556
2014-04-18 23:41:44 +00:00
Joe Groff
ebe5f4620c Don't include the module in protocol conformance manglings.
The cost of hacks to swift_conformsToProtocol is starting to outweigh any benefit to being principled here. We'll get a linker error now if multiple modules declare a conformance for the same type to the same protocol, but that's arguably a good thing for 1.0 anyway, since we aren't set up to get that right in other ways.

Swift SVN r16554
2014-04-18 23:13:40 +00:00
Joe Groff
e5bb7741f4 #if out function that's unused without objc ivar introspection.
Swift SVN r16533
2014-04-18 17:23:07 +00:00
Ted Kremenek
423296e1fc Start generating embedded Info.plist files for Swift dylibs.
Swift SVN r16511
2014-04-18 07:48:45 +00:00
Joe Groff
a57e955635 Reflection: Disable visiting objc ivars in the default mirror.
We can't do this reliably without crashing, because framework types often lie about their layout and/or leave junk pointers in ivars.

Swift SVN r16491
2014-04-18 03:22:56 +00:00
Joe Groff
822aa300e8 Remove BlockShims.mm.
Swift SVN r16485
2014-04-18 01:07:12 +00:00
Arnold Schwaighofer
45ffb41adf Remove AssertDebug hack and fixup make files
When we build the standard libary with -parse-stdlib the frontend sets the
assert configuration to 'DisableReplacement'. Constant replacement does not take
place and the call to the builtin function 'assert_configuration' call stays in
the serialize SIL of the swiftmodule.

IRGen replaces the function call to the assert_configuration builtin function by
the value for Debug (0). The resuling standard library dylib hence contains the
debug version of the standard library assert function.

Frontend optimization flags can now determine whether asserts should be executed
or not.

This commit removes the SWIFT_ASSERTS cmake flag.

rdar://16458612

Swift SVN r16473
2014-04-17 22:05:43 +00:00
Dave Zarzycki
211afa943f Runtime: better crash debugging/reporting
Swift SVN r16426
2014-04-16 21:37:16 +00:00
Enrico Granata
942676abb2 Everyone loves a good Mirror, and this commit has plenty of them!
With this check-in, we get Mirrors for IntXX, UIntXX, Float32, and we don't lose the existing ones for Double, Int, String and Bool

This fixes rdar://16517273 and will make playgrounds able to display more data more often more consistently!



Swift SVN r16418
2014-04-16 17:16:06 +00:00
Doug Gregor
b74c29eb64 Fix linking of the crash reporter client.
Swift SVN r16381
2014-04-15 23:45:15 +00:00
Enrico Granata
e86fc505e4 '6AppKit' is 7 characters, not 8
Swift SVN r16380
2014-04-15 23:39:33 +00:00
Dave Zarzycki
43ee06e3cc Runtime: abort if ObjC code tries to manually allocate a pure swift class
Related: <rdar://problem/16531502>

Swift SVN r16378
2014-04-15 22:26:05 +00:00
Enrico Granata
b7372d3ccc r16374 won't do us any good without this
Swift SVN r16375
2014-04-15 19:08:27 +00:00
Ted Kremenek
3fff062f8d Extend print(Double) precision to 15 digits.
Double's like '0.9999999' were being printed as '1.0'.

'print' isn't a first-class I/O library anyway; it's main use right
now is accurate reporting in the REPL.

Fixes <rdar://problem/16603548>.

Swift SVN r16305
2014-04-14 07:13:15 +00:00
Enrico Granata
77e57c99c4 Enable the runtime to discover protocol conformances for types wrapped from ObjC
The strategy we are using is to obtain the class name from the ObjC runtime (as apparently nominal type descriptor for ObjC-wrapped types do not contain a useful name string) and then crafting the appropriate mangled name for the witness
Also, make AppKit another source of conformances. We currently have custom conformances for Reflectable that we are in Foundation (NSURL) and AppKit (NSView) - if more modules need to have custom mirrors, we might end up having to expand the list



Swift SVN r16280
2014-04-13 17:11:54 +00:00
John McCall
862d50ac1c Change the layout of opaque existentials so that
the value buffer comes first.

The motivation for doing this is similar to the
motivation for moving it for class existentials:
it eliminates the need for an offset for the most
common accesses, which is particularly important
for the generic value witnesses.

Also try to hard-code that layout in fewer places,
or at least static_assert the places that have to
do so.

Swift SVN r16279
2014-04-13 07:43:08 +00:00
Doug Gregor
8d4964bc98 Turn on namespacing of Objective-C class names.
The actual logic to do this is simple; the vast majority of this
commit is just a pile of changes to test cases to reflect the fact
that Objective-C metadata now includes the module name for each class
and the mangling of Swift-defined @objc classes no longer goes into
the "So" namespace for Objective-C classes. Finishes
<rdar://problem/15506580>.


Swift SVN r16274
2014-04-13 04:48:53 +00:00
John McCall
46d35ed288 Change the layout of class existentials to put the instance
pointer first.

This most important effect of this is that accesses to that
field don't need to be dynamically offsetted past an arbitrary
number of value witnesses, which is pretty nice for the
generic value witnesses.

Swift SVN r16243
2014-04-12 02:13:16 +00:00
Joe Groff
d1121a3d86 Reflection: Blacklist NSURL from default mirror functionality.
Its layout information in the ObjC runtime is a complete lie, so we crash if we try to use it to introspect the object. Fixes <rdar://problem/16592777>.

Swift SVN r16228
2014-04-11 21:05:34 +00:00