Commit Graph

185 Commits

Author SHA1 Message Date
Adrian Prantl
af7198811c silence warnings.
Swift SVN r15839
2014-04-02 22:54:34 +00:00
Dave Zarzycki
43680748d5 Runtime: more dead code deletion
Swift SVN r15834
2014-04-02 21:39:51 +00:00
Dave Zarzycki
4c97c67a82 Runtime: remove stray debugging hook
Swift SVN r15819
2014-04-02 18:46:02 +00:00
Dave Zarzycki
96d1f4760e Runtime heap: mixed fixes that make debugging easier
Swift SVN r15818
2014-04-02 18:46:00 +00:00
Dave Zarzycki
e1a60eae86 Runtime: Use 'auto' more. NFC.
Swift SVN r15817
2014-04-02 18:45:59 +00:00
John McCall
1071ac6d05 Update standard library and test suite for importing
ObjC pointer types as UncheckedOptional.

Some of these changes are totally necessary; others may
simply reflect language/implementation work that hasn't
been done yet.

If anything seems particularly objectionable, bugs welcome.

Swift SVN r15783
2014-04-02 09:37:14 +00:00
John McCall
f1180f5e6d in order to work correctly for non-@objc protocols.
Language features like erasing concrete metatype
values are also left for the future.  Still, baby steps.

The singleton ordinary metatype for existential types
is still potentially useful; we allow it to be written
as P.Protocol.

I've been somewhat cavalier in making code accept
AnyMetatypeType instead of a more specific type, and
it's likely that a number of these places can and
should be more restrictive.
When T is an existential type, parse T.Type as an
ExistentialMetatypeType instead of a MetatypeType.

An existential metatype is the formal type
 \exists t:P . (t.Type)
whereas the ordinary metatype is the formal type
 (\exists t:P . t).Type
which is singleton.  Our inability to express that
difference was leading to an ever-increasing cascade
of hacks where information is shadily passed behind
the scenes in order to make various operations with
static members of protocols work correctly.

This patch takes the first step towards fixing that
by splitting out existential metatypes and giving
them a pointer representation.  Eventually, we will
need them to be able to carry protocol witness tables

Swift SVN r15716
2014-04-01 00:38:28 +00:00
Dave Zarzycki
d8e39d106a Runtime: finish SwiftObject
<rdar://problem/12640667> Implement SwiftObject root class

Swift SVN r15706
2014-03-31 23:10:39 +00:00
Dave Zarzycki
0e8de87f05 Runtime: more SwiftObject API completeness
Swift SVN r15696
2014-03-31 22:50:19 +00:00
Dave Zarzycki
09f2e9ed57 WIP Runtime: Zone cleanup to use C++ more. NFC.
All of the malloc zone APIs are clumsy object-oriented design in C, but that
does not mean we should be too. This should clarify the design more too.

Swift SVN r15690
2014-03-31 20:06:16 +00:00
John McCall
9490da8a1f Inform the runtime that metatype values have extra inhabitants.
Swift SVN r15665
2014-03-31 05:49:18 +00:00
Dave Zarzycki
095633f4ba Runtime: Enable Instruments object lifecycle support
One needs to either set SWIFT_ZONE_DEBUG before launch or call SPI.

Swift SVN r15586
2014-03-28 20:46:40 +00:00
Dave Zarzycki
ce0c5899d8 Runtime: crude enumeration to generate statistics
This is foundational work for 'leaks', etc.

Swift SVN r15490
2014-03-26 06:13:03 +00:00
Joe Groff
f2ed6dd49b Reflection: Add additional dispositions and an 'AttributedString' QuickLookObject case.
<rdar://problem/16412965> and <rdar://problem/16413366>.

Swift SVN r15438
2014-03-25 02:55:20 +00:00
Joe Groff
08a6a68f41 Runtime: Don't double-free existential containers when destroying them generically.
Fixes <rdar://problem/16384633>.

Swift SVN r15338
2014-03-21 21:55:36 +00:00
Dave Zarzycki
c2b486fb91 Runtime: assert on trivial double-free()s
Swift SVN r15336
2014-03-21 21:32:10 +00:00
Dave Zarzycki
c9d5bd8a92 Runtime: fix a leak during thread exit
Swift SVN r15334
2014-03-21 20:59:10 +00:00
Joe Groff
3f6b616211 Runtime: 'destroyPOD' needs to at least deallocate the box.
Fixes <rdar://problem/16245165>.

Swift SVN r15328
2014-03-21 17:56:06 +00:00
Dave Zarzycki
2b412b4626 Runtime: fix a copy-and-paste error
<rdar://problem/16386805> Assertion failed: (bytes != 0), function swift_slowDealloc

Swift SVN r15325
2014-03-21 05:52:04 +00:00
Dave Zarzycki
c07ebee7b1 Runtime: make generic non-assembly entry points use atomics
Our conditional use of atomics goal will have to wait until 2.0.

Swift SVN r15305
2014-03-20 23:32:07 +00:00
Dave Zarzycki
2cd0940d16 Runtime: make 'vmmap' tool report better data
Swift SVN r15296
2014-03-20 21:02:06 +00:00
Dave Zarzycki
2f4d679fd0 Runtime: Drop the "raw" label on normal memory. NFC.
DI defined away the need for zeroed memory.

Swift SVN r15293
2014-03-20 20:42:27 +00:00
Dave Zarzycki
bd9ce4d42c Runtime: remove dead code
Swift SVN r15291
2014-03-20 20:30:02 +00:00
Dave Zarzycki
6e27d2db1e Runtime: Cleanup constants. NFC.
Swift SVN r15272
2014-03-20 18:20:19 +00:00
Dave Zarzycki
f0777b69b4 Runtime: malloc zone huge allocation support
Swift SVN r15271
2014-03-20 18:20:17 +00:00
Dave Zarzycki
9816e2ab05 Runtime: the Swift heap/zone
Good:
* We now no longer wrap the system malloc zone.
* Tiny allocation quantum is pointer sized, not 16 bytes.
* Far less metadata overhead than the system malloc zone.
Bad:
* Our heap density isn't quite as good as the default zone. This is a O(1)
  versus O(N) tradeoff. The default malloc zone has been trending in this
  direction too.
TODO:
* Introspection
* Tune secondary fast paths
* Huge allocations

Swift SVN r15269
2014-03-20 17:43:56 +00:00
Joe Groff
002701fd77 Reflection: Implement magic mirror destructuring for classes.
Destructure classes by counting their superclass instance, if any, as their first child, followed by their stored properties.

Swift SVN r15268
2014-03-20 17:43:16 +00:00
Joe Groff
a9c2a7d5b8 Reflection: Implement a magic mirror for structs.
Use the newly-minted field type vector accessors to provide magic mirror destructuring for all structs!

Swift SVN r15261
2014-03-20 02:41:07 +00:00
Joe Groff
4f2656cc7c Runtime: Prefab metadata for Builtin.Int128 (and for similar-sized Float* types).
Swift SVN r15259
2014-03-20 02:02:28 +00:00
Jordan Rose
934eacea61 BlockShims: fix shims with repeated use of BOOL.
Our shim symbols weren't using substitutions, but the real manglings do.

<rdar://problem/16368602>

Swift SVN r15252
2014-03-20 00:07:52 +00:00
Dave Zarzycki
784630d9b2 Runtime: Fix assembly CFI data
This should fix: <rdar://problem/16188027>

Swift SVN r15249
2014-03-19 21:24:42 +00:00
Joe Groff
c76cb6f6db Reflection: Have 'QuickLookObject.Int' take an Int64, and add a UInt(UInt64) case.
So we can accurately represent all common integer types.

Swift SVN r15237
2014-03-19 15:31:52 +00:00
Joe Groff
dcd47ec879 Reflection: Add QuickLookObject tags for ints and floats.
Playgrounds want to be able to represent numbers different from strings, so provide different tags for types that represent numbers distinct from strings. Set up the Int and Double mirrors to return quick look objects of the appropriate cases, and hook up the magic ObjC mirror to do the same for NSNumbers. <rdar://problem/16360758>

Swift SVN r15219
2014-03-19 02:27:22 +00:00
Joe Groff
589fe7f930 Reflection: Move the less magic parts into Swift.
Only the bits that actually need to grovel metadata really need to be written in C++, so define away hopefully most of the potential for memory safety or corruption bugs from screwing up calling convention matchups by moving most of the magic mirror implementations into pure Swift.

Swift SVN r15180
2014-03-18 01:12:30 +00:00
Dave Abrahams
f465e34f88 [stdlib] Generate NSDictionaryBase
We'll need to apply the same tricks we're using for Array to Dictionary
and String, so prepare to generate base classes for those buffers as
well.  Actually generate and use the one for Dictionary, but don't
actually bridge it yet.

Swift SVN r15167
2014-03-17 23:12:19 +00:00
John McCall
40be8390c3 Factor BlockShims.mm to make it easier to change the
mangling of imported ObjC pointer types.

Swift SVN r15130
2014-03-17 07:02:00 +00:00
Dave Zarzycki
b8d736ffc7 stdlib: NSSwiftArrayBase magic
Swift SVN r15086
2014-03-14 22:34:46 +00:00
Dave Zarzycki
49bee35d1a Runtime: magic numbers are bad
Swift SVN r15012
2014-03-13 23:15:07 +00:00
Joe Groff
3827f6b1af Reflection: Set the metadata of default ObjC quicklook object Anys correctly.
We want the metadata of the ObjC class, not the opaque Builtin.ObjCPointer metadata. This allows the Any to actually be downcast to an expected type on the client side.

Swift SVN r15009
2014-03-13 21:59:44 +00:00
Dave Zarzycki
1ef22d5e03 Runtime: make the thread-specific logic work with the public SDK
Swift SVN r15007
2014-03-13 21:32:45 +00:00
Dave Zarzycki
dbd1c1a2bf Runtime: zap dead code
Swift SVN r15005
2014-03-13 21:21:13 +00:00
Jordan Rose
5509605e1d Add a void(^)(NSError*, NSString*) block shim.
Requested by Beto in <rdar://problem/16306097>.

Swift SVN r14986
2014-03-13 00:41:55 +00:00
Dave Abrahams
0aa818f680 [stdlib] Delete obsolete verification functions
These functions were used for runtime assertions that are now being
checked at compile-time.

Swift SVN r14983
2014-03-12 23:59:46 +00:00
Joe Groff
75da504b42 Reflection: Add more cases to QuickLookObject.
Add 'Sound', 'Color', and 'BezierPath', as requested by Enrico, as well as a '_Raw' case that can be used for internal experimentation.

Swift SVN r14978
2014-03-12 22:42:27 +00:00
Joe Groff
6c576f110b Hide the implementation details of String from MagicMirror.
NFC, just reduce the possibility of forming Strings without going through a stdlib-approved interface.

Swift SVN r14977
2014-03-12 22:42:26 +00:00
Ted Kremenek
a31041f9f1 Placate -Wunreachable-code by using #else for alternative code.
Swift SVN r14929
2014-03-11 21:51:50 +00:00
Dave Zarzycki
cde57afc89 stdlib: do not forward malloc_size()
malloc_size() also is used to determine which zone owns a given allocation.

<rdar://problem/16293435> malloc_size is getting called recursively

Swift SVN r14928
2014-03-11 21:48:14 +00:00
Greg Parker
f9d2685a2e Correct a range check. Fix some build warnings.
Swift SVN r14920
2014-03-11 16:04:14 +00:00
Joe Groff
0c55845cc1 Replace Greg's r14771 with a slightly less outrageous hack.
Implicit conversions to and from an unsigned long long enum class give us the calling convention we want for swift_allocBox without totally destroying the API for C callers.

Swift SVN r14919
2014-03-11 16:01:13 +00:00
Joe Groff
2f720aebdb Reflection: Add a 'disposition' property to Mirror.
Playgrounds want to present aggregate-like values with fixed children, such as structs and classes, differently from container-like values with variable amounts of children, like arrays and dictionaries, so add a property to Mirror that describes the disposition of the value being reflected.

Swift SVN r14827
2014-03-08 05:37:56 +00:00