Commit Graph

4650 Commits

Author SHA1 Message Date
Slava Pestov
76f1168adf Remove dealloc_ref's [constructor] form since its no longer needed
Swift SVN r32688
2015-10-14 22:50:09 +00:00
Dmitri Hrybenko
57d296772f stdlib: remove _Strideable
Swift SVN r32675
2015-10-14 03:37:19 +00:00
Dmitri Hrybenko
371e189608 stdlib: tighten constraints on MutableCollectionType.SubSequence
Swift SVN r32674
2015-10-14 01:38:12 +00:00
Dave Abrahams
fd4a9cd658 [stdlib] Fix typo in doc comment
Swift SVN r32667
2015-10-13 20:56:57 +00:00
Daniel Dunbar
8f089d20b2 [Linux] Add Glibc overlay support for fcntl stat macros.
Swift SVN r32655
2015-10-13 14:31:34 +00:00
Andrew Trick
f3e5b1d5af Convert unsafeDownCast to use Builtin.castReference.
Generally avoid casting to a raw pointer unless a raw pointer is needed.
Builtin.castReference is now the canonical way to cast reference types.
Canonical generally = better optimizer. In practice this will reduce to
the same SIL since the stdlib code will be optimized.

There are enough unit tests for unsafeDowncast and Builtin.castReference.

I measured no performance regressions.

Swift SVN r32646
2015-10-13 01:07:54 +00:00
Slava Pestov
418ab80da4 Runtime: Implement swift_deallocPartialClassInstance()
Swift SVN r32645
2015-10-13 00:30:14 +00:00
Daniel Dunbar
c9e3c36a21 [Glibc] Complete the Glibc module.map.
- This adds all of the content which is also present in the Darwin module,
   following the same structure. Not every single header is enumerated, but I
   believe this does capture almost all of the interesting top-level things that
   people include directly.

Swift SVN r32628
2015-10-12 18:36:15 +00:00
Joe Groff
42c71b7972 Don't mangle directness into type metadata symbols.
Anywhere we can't directly address type metadata in Swift, we've found we need a function call. Directness isn't useful here.

Swift SVN r32626
2015-10-12 17:22:40 +00:00
Andrew Trick
8007dc8cfa Add Builtin.castReference and internal API _unsafeCastReference.
_unsafeCastReference allows casting of any references types, regardless
of whether they are references to objects or class existentials. The
implementation is responsible for converting between representations.

_unsafeCastReference provides a dynamic check to ensure that the source
and dest are both actually references. If not, the implementation will
trap at runtime. Generally, the optimizer can prove that the source
and dest are references, and promote this cast to an
unchecked_ref_cast bitcast. There is no dynamic check that the
references types are compatible.

This differs from unsafeDownCast in two ways:

(1) The source and dest types are not statically typed
AnyObjects. Therefore, unsafeCastReference can be used when the
surrounding code dynamically handles both reference and nonreference
types.

(2) The source and dest also need not dynamically conform to AnyObject.
Either side of the cast may be a class existential. The primary
requirement is that the source and dest refer to the same reference
counted object.

Swift SVN r32588
2015-10-10 03:39:34 +00:00
Roman Levenstein
0f7722eec6 [runtime-lib] Any Swift mmap /vm_allocate allocations should use a custom tag.
We now have dedicated tags for Swift on Apple operating systems. They are called: VM_MEMORY_SWIFT_RUNTIME and VM_MEMORY_SWIFT_METADATA.
Let's make use of them. This would allow tools like Instruments provide a more detailed analysis and statistics.

For now, we only tag the metadata allocations, as this is the only place where we use mmap at the moment.

rdar://22376248

Swift SVN r32584
2015-10-09 22:28:41 +00:00
David Farler
fb2381124b Fix CoreMedia CMTimeRange overlay != operator
This was ... returning the same thing as the == operator.

Also, integrate the CoreMedia overlay tests from
rdar://problem/20926198, which caught this problem, and port it
to StdlibUnittest.

Swift SVN r32484
2015-10-07 01:27:36 +00:00
Nadav Rotem
6f68cd56c7 Mark the stdlib memcopy and strlen as readonly (pure).
Swift SVN r32476
2015-10-06 23:53:52 +00:00
Dmitri Hrybenko
6536edd68c stdlib: fix coding style
Swift SVN r32425
2015-10-03 21:13:15 +00:00
Dmitri Hrybenko
f7005d520f stdlib: clean up code: arrays of functions work now
Swift SVN r32424
2015-10-03 21:13:07 +00:00
Joe Groff
0cd5aa8c7c Change mangling for the Swift module from 'Ss' to 's'.
'Ss' appears in manglings tens of thousands of times in the standard library and is also incredibly frequent in other modules. This alone is enough to shrink the standard library by 59KB.

Swift SVN r32409
2015-10-02 22:39:44 +00:00
Dave Abrahams
06e32293a4 [stdlib] Attempt to fix linux build
An Array's buffer is a ContiguousArrayBuffer on Linux.

Swift SVN r32323
2015-09-29 23:52:24 +00:00
Dave Abrahams
243b528fac [stdlib] Array refactoring: simplify all array subscript checking
Swift SVN r32314
2015-09-29 22:38:59 +00:00
Dave Abrahams
ee60b5f0e2 [stdlib] Array refactoring: rewrite ArrayBuffer._isValidSubscript
Swift SVN r32313
2015-09-29 22:38:58 +00:00
Dave Abrahams
cfe877bc0a [stdlib] Array refactoring: s/hoistedIs/was/
Swift SVN r32312
2015-09-29 22:38:57 +00:00
Dave Abrahams
b1e98fe3e1 [stdlib] Array refactoring: s/NoTypeCheck/TypeChecked/
First in a long series of commits to clean up the array implementation
and make it maintainable by the stdlib team.

Swift SVN r32311
2015-09-29 22:38:56 +00:00
Dave Abrahams
5cf32911fb Array: Improve function, parameter names and add documentation
NFC.

Swift SVN r32310
2015-09-29 22:38:53 +00:00
Dave Abrahams
7985035342 Squash a warning
Swift SVN r32306
2015-09-29 21:28:50 +00:00
Andrew Trick
08bc41849e Remove from unsafeBitCast argument--it doesn't need an address.
Swift SVN r32300
2015-09-29 15:42:38 +00:00
Dmitri Hrybenko
779e506a09 StdlibUnittest: rename isSequenceType to expectSequenceType for uniformity
Swift SVN r32296
2015-09-29 03:07:26 +00:00
Dmitri Hrybenko
b41986e95c StdlibUnittest: make isSequenceType and expectCollectionType more strict
These constraints should be on the SequenceType and CollectionType
protocols, but we can't express them in the language today.

Swift SVN r32295
2015-09-29 03:07:25 +00:00
Dmitri Hrybenko
7afb88f2aa StdlibUnittest: put complex generic constraints in the same order everywhere
Swift SVN r32294
2015-09-29 03:07:24 +00:00
Arnold Schwaighofer
599a438015 Don't force to grow the buffer everytime we make it unique
rdar://22873620

Swift SVN r32280
2015-09-28 20:47:23 +00:00
Andrew Trick
21e7b06e77 Migrate the unsafeBitCast API to use Builtin.reinterpretCast.
This avoids unnecessary address-taking. Instead use the builtin that directly
supports unsafe casts. The optimizer now follows clear rules for
Builtin.reinterpretCast (so it's safe to use) and knows how to optimize it.

Swift SVN r32268
2015-09-28 01:58:30 +00:00
Andrew Trick
9055b274ee Use bridgeToRawPointer instead of unsafeBitCast.
Swift SVN r32264
2015-09-27 00:55:37 +00:00
Dmitri Hrybenko
03d3e4d2eb SDK overlay: LAErrorDomain not actually available on 8.0-8.2, adjust availability
rdar://22755624

Swift SVN r32259
2015-09-26 07:37:29 +00:00
Arnold Schwaighofer
66275a3ad8 Replace handrolled max by max.
Swift SVN r32250
2015-09-25 23:37:29 +00:00
Arnold Schwaighofer
9ec0c2391d Nuke the CollectionType implementation from _BitMap.
It is dead code.

Swift SVN r32249
2015-09-25 23:37:23 +00:00
Arnold Schwaighofer
fd00a80029 HashedCollections: Fix code only executed if compiled with internal checks enabled
Swift SVN r32247
2015-09-25 22:47:33 +00:00
Arnold Schwaighofer
6c88b414cd Fix _BitMap's endIndex function
Swift SVN r32246
2015-09-25 22:19:14 +00:00
Arnold Schwaighofer
a5e75311af stdlib: Implement Dictionary using a structs of arrays strategy
Instead of Optional entries use a third bitmap array to mark whether an entry is
valid. This representation saves space (because individual entries don't have a
alignment padding slack) and simplifies ARC's job leading to better performance.

Speedup measured (before/after) at -O:

DictionaryHashableClass`````````3.1
DollarFilter````````````````````1.3
DollarMap```````````````````````1.3
DollarReduce````````````````````1.4
JSONHelperDeserialize```````````1.4
NSDictionaryImplicitConversion``1.4
NSXMLParser`````````````````````1.3

Speedup measured (before/after) at -Onone:

DictOfArraysToArrayOfDicts``````1.3
Dictionary``````````````````````3.5
Dictionary2`````````````````````3.2
Dictionary3`````````````````````3.2
DictionaryHashableClass`````````1.9
DictionaryHashableStruct````````2.4
DictionaryRemove````````````````3.3
DictionarySwap``````````````````2.5
DollarFilter````````````````````1.2
DollarMap```````````````````````1.2
DollarReduce````````````````````1.3
Forest``````````````````````````1.8
Histogram```````````````````````1.6
JSONHelperDeserialize```````````1.6
NSDictionaryImplicitConversion``1.3
Prims```````````````````````````2.9
RGBHistogram````````````````````1.4

rdar://22173734

Swift SVN r32244
2015-09-25 22:05:15 +00:00
Arnold Schwaighofer
6e51e15a59 Add _sizeInBytes to fixed point types.
Swift SVN r32243
2015-09-25 22:05:15 +00:00
Arnold Schwaighofer
cc4e41cb3e Add a ispod builtin and _isPOD function to the stdlib
The builtin returns true if the argument type is a POD type: needs no special
handling for copy and destruct operations.

Swift SVN r32242
2015-09-25 22:05:14 +00:00
Dmitri Hrybenko
f57947a7e0 stdlib: fix capitalization issues in documentation comments
Patch by Nate Cook.

rdar://22054901

Swift SVN r32226
2015-09-25 17:13:54 +00:00
Dmitri Hrybenko
153d95efc6 SwiftShims: don't redeclare libc functions
Clang importer thinks that SwiftShims is the primary module where they
live, and this confuses code completion.

rdar://22488333

Swift SVN r32218
2015-09-25 03:33:50 +00:00
Dmitri Hrybenko
9da0b57178 stdlib: Add an initializer to RangeReplaceableCollectionType from SequenceType
rdar://19815116

Swift SVN r32213
2015-09-24 23:20:13 +00:00
Dmitri Hrybenko
1c0bb69a32 stdlib: add removeFirst() and removeLast() functions to slices
It is an oversight that we didn't add these when we were converting to
protocol extensions.

Swift SVN r32144
2015-09-22 02:50:33 +00:00
Dmitri Hrybenko
d695f35b3c StdlibUnittest: rename SpliceTest to InsertContentsOfTest
Swift SVN r32138
2015-09-22 00:23:13 +00:00
Dmitri Hrybenko
f7612273cf stdlib: simplify AnyGenerator API
Change the non-final class into a struct, and migrate global functions
into initializers.

rdar://21878289

Swift SVN r32137
2015-09-22 00:23:10 +00:00
Dmitri Hrybenko
384ec05ae4 stdlib: stop using Builtin types in UnicodeScalar
There is no reason for that now, and using Swift types simplifies code.

Swift SVN r32109
2015-09-21 01:33:10 +00:00
Dmitri Hrybenko
4375a463a7 stdlib: rename Int**.value and Float**.value to _value per naming convention
rdar://21357661

Swift SVN r32096
2015-09-20 00:01:13 +00:00
Xin Tong
6fe7d89678 This is part of a series of commits to remove reference forwarding
for some of the ARC entry points. rdar://22724641. After this commit,
swift_unknownRetain will forward no reference.

Swift SVN r32083
2015-09-18 22:14:03 +00:00
Xin Tong
dca508bfbb This is part of a series of commits to remove reference forwarding for
some of the ARC entry points. rdar://22724641. After this commit,
swift_retain_noresult will be completely replaced by swift_retain.
LLVMARCOpts pass is modified NOT to rewrite swift_retain to
swift_retain_noresult which forward no reference.

Swift SVN r32082
2015-09-18 21:56:50 +00:00
Xin Tong
bc3fe169b4 This is part of a series of commits to remove reference forwarding for some of the ARC entry points. rdar://22724641.
After this commit, swift_retain will return no reference and LLVMARCContract pass is modified NOT to rewrite
swift_retain_noresult to old swift_retain which forwarded the reference.

Swift SVN r32075
2015-09-18 20:35:39 +00:00
Dmitri Hrybenko
a2e1dc5fb7 stdlib: remove some workarounds for compiler bugs from ExistentialCollection
Swift SVN r32066
2015-09-18 03:37:03 +00:00