Commit Graph

4650 Commits

Author SHA1 Message Date
Michael Gottesman
121ef3ef9f Revert the series of commits for removing the return value from swift_retain_noresult.
I asked that the patches were split up so I could do post commit review.

This reverts commit r32059.
This reverts commit r32058.
This reverts commit r32056.
This reverts commit r32055.

Swift SVN r32060
2015-09-18 02:31:24 +00:00
Xin Tong
36f04d1cd6 fix a build break on linux for swift_retain returns no reference.
Swift SVN r32059
2015-09-18 01:54:20 +00:00
Xin Tong
4e46dacc3d Completely replace swift_retain_noresult with swift_retain. 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 and LLVMARCOpts.cpp
will no longer canonicalize swift_retain to swift_retain_noresult as now swift_retain returns no
reference.

Swift SVN r32058
2015-09-18 01:51:17 +00:00
Dmitri Hrybenko
db77b54b3c StdlibUnittest: if the stacktrace is empty, don't print "stacktrace:"
Swift SVN r32057
2015-09-18 01:30:15 +00:00
Xin Tong
cebd28956a fix a build break on linux for swift_retain returns no reference.
Swift SVN r32056
2015-09-18 00:53:44 +00:00
Xin Tong
955e4ed652 Change swift_retain/swift_retain_n to return no value. 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 be the same as swift_retain_noresult, returning no reference.
LLVMARCContract pass is also modified NOT to rewrite swift_retain_noresult to the
old swift_retain which forwards the reference.

Swift SVN r32055
2015-09-18 00:41:35 +00:00
David Farler
53de8f9329 Add math.h to the Glibc module
Swift SVN r32052
2015-09-17 23:39:04 +00:00
David Farler
120ac7541c Move the glibc module to stdlib/public
Swift SVN r32050
2015-09-17 23:13:10 +00:00
Xin Tong
275daaf750 recommiting. r31989. Implement weak/unowned retain_n/release_n entry points. rdar://22629226
Swift SVN r31991
2015-09-16 16:01:16 +00:00
Mark Lacey
fff32395cc Revert "Implement weak/unowned retain_n/release_n entry points. rdar://22629226"
This reverts commit r31989 because it broke the build due to a faulty
assert that fires in the refcounting unit test.

Swift SVN r31990
2015-09-16 06:15:31 +00:00
Xin Tong
206673b95d Implement weak/unowned retain_n/release_n entry points. rdar://22629226
Swift SVN r31989
2015-09-16 05:35:09 +00:00
Joe Groff
dd97410f94 IRGen: Check class constraint when casting metatypes to AnyObject.Type.
Fixes rdar://problem/22643781.

Swift SVN r31971
2015-09-15 21:40:15 +00:00
Dmitri Hrybenko
0a22034d65 GameplayKit overlay: add explicit tvOS availability
rdar://22707844

Patch by Dave Schaefgen.

Swift SVN r31970
2015-09-15 20:41:18 +00:00
Xin Tong
ba677a96b6 Implement bridgeObjectRetain_n/Release_n in swift runtime. rdar://22108790
Swift SVN r31965
2015-09-15 18:53:11 +00:00
Dmitri Hrybenko
4f114006ab stdlib: fix the comment on removeFirst() to not refer to the 'n' parameter
Swift SVN r31954
2015-09-15 00:51:06 +00:00
Dmitri Hrybenko
7ef312e7f1 stdlib: add comments for Set.contains()-insert() pattern in tests
Swift SVN r31930
2015-09-14 20:50:19 +00:00
Dmitri Hrybenko
cf19c6c532 stdlib: format a code snippet as a code block
rdar://22422749

Swift SVN r31922
2015-09-14 06:29:25 +00:00
Dmitri Hrybenko
2ff89aa40e stdlib: fix comment on ArraySlice.startIndex
ArraySlice.startIndex is not necessarily zero anymore.

rdar://22633052

Swift SVN r31921
2015-09-14 05:40:14 +00:00
Dmitri Hrybenko
67944589d6 stdlib: improve index invalidation guarantees for removeFirst()
Slice types that are RangeReplaceable (like ArraySlice) now slice
themselves in removeFirst().  Previously, these types were picking up
the wrong default implementation, and they were going through
replaceRange(), which caused all indices to be invalidated.  The new
implementation preserves all indices.

rdar://22536664

Swift SVN r31918
2015-09-12 04:35:51 +00:00
Michael Gottesman
16016ab06e Change the leaks detector to use Lazy so that we leak it on exit rather than invoking a static destructor.
Swift SVN r31905
2015-09-11 19:43:43 +00:00
Xin Tong
64135ef2ee Implement unknownRetain_n/Release_n entry points
rdar://21945003

Swift SVN r31902
2015-09-11 19:28:18 +00:00
Dave Abrahams
07c47326cb [stdlib] Integer Prototype: get most signifcant bit
Swift SVN r31898
2015-09-11 18:40:47 +00:00
Joe Groff
fd820f53e6 Runtime: Factor out _dynamicCastToFunction.
NFC

Swift SVN r31895
2015-09-11 16:47:07 +00:00
Joe Groff
57ba78e4c5 Runtime: Fix goto-fail-ism in function casts.
'break' in a for loop breaks out of the loop, not the switch. Oops. Fixes rdar://problem/22576226.

Swift SVN r31888
2015-09-11 05:01:38 +00:00
David Farler
3d453552fb Install Glibc module.map in the stdlib install component
This module map was missing in the buildbot_linux preset's install
components because it doesn't include stdlib-experimental. This file
is actually critical to use the C library on Linux.

Fixes rdar://problem/22645751

Swift SVN r31879
2015-09-11 01:40:17 +00:00
Joe Groff
0bf684c30d Runtime: Fix leak in failure path for dynamicCastClassToValueViaObjCBridgeable.
Caught by the leaks runner on DollarReduce perf test. Fixes rdar://problem/22646089.

Swift SVN r31873
2015-09-11 00:05:25 +00:00
David Farler
de8c7a3a2f Provide muloti4 on all archs, not just arm64.
Although this builtin is provided by clang rt builtins,
it isn't provided by libgcc, which is the default
runtime library on Linux, even when compiling with clang.
This implementation is copied here to avoid a new dependency
on compiler-rt on Linux.

Open up the ifdef to include non-Apple (i.e. Linux) builds.

rdar://problem/22616842

Swift SVN r31848
2015-09-10 02:18:37 +00:00
Argyrios Kyrtzidis
742f65c66b [stdlib] Fix comment of _ColorLiteralConvertible, NFC.
Swift SVN r31847
2015-09-10 02:03:16 +00:00
Joe Groff
3ff48d95c4 Runtime: Fix memory leak when swift_dynamicCast does a copy_on_success bridging cast.
In the course of preparing the bridging object to be bridged to a Swift value, we forwarded the cast flags to _dynamicCastUnknownClass unaltered, which caused a leak for copy-on-success casts since it introduced an extra retain. Fix this by simplifying _dynamicCastUnknownClass to have no retain/release behavior of its own. Fixes rdar://problem/22587077.

Swift SVN r31841
2015-09-10 00:51:10 +00:00
Enrico Granata
db4c6e4ab1 It is not necessary to return a quick look object for range - the summary takes good enough care of it
Swift SVN r31776
2015-09-08 21:03:31 +00:00
Nadav Rotem
da49bf2733 Revert "[stdlib] Move Low-Level Integers into stdlib"
This reverts commit r31707.

Swift SVN r31736
2015-09-07 04:57:07 +00:00
Dave Abrahams
e06ed15ece [stdlib] Move Low-Level Integers into stdlib
This should fix the build; the builtins for Int128 needed to be
generated in the stdlib.

Swift SVN r31707
2015-09-05 03:09:54 +00:00
Arnold Schwaighofer
1b8cd94410 stdlib: Half the size of dictionary get/set operations inlined into user code
Reapply of 31644 with fix for building on linux.

Mark one method on the cocoa path noinline and outline the cocoa path for
maybeGet.

Swift SVN r31648
2015-09-03 01:07:06 +00:00
Xi Ge
df3dd4564b Revert "stdlib: Half the size of dictionary get/set operations inlined into user code"
To unblock Swift master Incremental RA.

Swift SVN r31645
2015-09-03 00:19:29 +00:00
Arnold Schwaighofer
932bb37a4f stdlib: Half the size of dictionary get/set operations inlined into user code
Mark one method on the cocoa path noinline and outline the cocoa path for
maybeGet.

Swift SVN r31644
2015-09-02 23:35:37 +00:00
Jordan Rose
845513d359 [ClangImporter] Always treat dispatch_block_t as @convention(block).
Some GCD APIs rely on the pointer identity of blocks, so avoid bridging
when possible. The easiest way to do this was to use our existing rules
for special-casing typedefs.

The summary text for dispatch_block_t comes from the actual GCD headers.

rdar://problem/22432170

Swift SVN r31634
2015-09-02 18:31:51 +00:00
Arnold Schwaighofer
aeece6bc1f stdlib: DRY and disable inlining of code to curb code growth
This halves the code size of array append inlined into user code.

Swift SVN r31603
2015-09-01 16:45:05 +00:00
Arnold Schwaighofer
314e5d9378 stdlib: Remove dead code
Swift SVN r31602
2015-09-01 16:45:04 +00:00
Arnold Schwaighofer
55e4795972 stdlib: Fix formatting.
Swift SVN r31601
2015-09-01 16:45:04 +00:00
Arnold Schwaighofer
de90e57428 stdlib: Reformulate to make ARC's job easier
The extra control-flow seems to inhibit ARC and we end up with an extra
retain-release regressing LevenshteinDistance by 40%.

rdar://22479186

Swift SVN r31588
2015-08-31 18:02:12 +00:00
Joe Groff
773eadb9f2 IRGen/Runtime: Populate the runtime protocol conformance table with relative references.
By using relative references, either directly to symbols internal to the current TU, or to the GOT entry for external symbols, we avoid unnecessary runtime relocations, and we save space on 64-bit platforms, since a single image is still <2GB in size. For the 64-bit standard library, this trades 26KB of fake-const data in __DATA,__swift1_proto for 13KB of true-const data in __TEXT,__swift2_proto. Implements rdar://problem/22334380.

Swift SVN r31555
2015-08-28 18:07:22 +00:00
Arnold Schwaighofer
eb3d5e4d4a Revert "stdlib: Move the darwin String implementation over to use the ICU library."
Revert "Add test cases to exercise the native String vs cocoa buffer String path."
Revert "stdlib: Add back a test I removed"
Revert "stdlib: Fix hasPrefix,hasSuffix tests"
Revert "stdlib: Add documentation for the cached ascii collation tables"

This reverts commit 31493, 31492, 31491, 31490, 31489.

There are linking errors in SwiftExternalProjects (we probably have to link
against libicucore somewhere).

Swift SVN r31543
2015-08-27 21:02:32 +00:00
Arnold Schwaighofer
9fd52b9123 stdlib: Instead of calling reserveCapacity in Array.init(_uninitializedCount)
directly construct a buffer of the right size

This safes a uniqueness check and unecessary code bloat when inlining
reserveCapacity.

rdar://22446738

Swift SVN r31540
2015-08-27 20:07:07 +00:00
Joe Groff
43d620c7e0 IRGen: Export direct metadata symbols at the address point of the metadata object.
This is more resilient, since we want to be able to add more information behind the address point of type objects. The start of the metadata object is now an internal "full metadata" symbol.

Note that we can't do this for known opaque metadata from the C++ runtime, since clang doesn't have a good way to emit offset symbol aliases, so for non-nominal metadata objects we still emit an adjustment inline. We also aren't able to generate references to aliases within the same module due to an MC bug with alias refs on i386 and armv7 (rdar://problem/22450593).

Swift SVN r31523
2015-08-27 05:18:38 +00:00
Joe Groff
f705c561e3 Revert "IRGen: Export direct metadata symbols at the address point of the metadata object."
This reverts commit r31515. It causes an LLVM error on the release bots.

Swift SVN r31516
2015-08-27 01:44:56 +00:00
Joe Groff
8e2ce60f5b IRGen: Export direct metadata symbols at the address point of the metadata object.
This is more resilient, since we want to be able to add more information behind the address point of type objects, and also makes IR a lot less cluttered. The start of the metadata object is now an internal "full metadata" symbol.

Note that we can't do this for known opaque metadata from the C++ runtime, since clang doesn't have a good way to emit offset symbol aliases, so for non-nominal metadata objects we still emit an adjustment inline.

Swift SVN r31515
2015-08-27 01:34:22 +00:00
Nadav Rotem
7a49d7e334 [codesize] Keep _print_unlocked in the swift dylib.
We keep most of our printing code in the swift dylib but we missed
this method in our last refactoring.

Swift SVN r31508
2015-08-26 22:14:19 +00:00
Nadav Rotem
c96a127f6c [codesize] Force _dictionaryBridgeToObjectiveC to stay in the swift dylib.
Keeping this method in the swift dylib saves a few kilobytes for each
specialization of dictionary. This function is not on the critical
performance path and we don't gain much from pulling it and specializing
it in user code.

Swift SVN r31507
2015-08-26 22:14:18 +00:00
Nadav Rotem
b93256503a [codesize] Keep _assertionFailed in the swift dylib.
This commit annotates _assertionFailed with an attribute
that will keep in in the swift dylib. We don't care about
the performance of this function because it happens when
the program crashes. Keeping it in the swift dylib helps
in reducing the code size of the user app because it keeps
more of the printing and string.utf8 logic in the dylib.

Swift SVN r31506
2015-08-26 22:14:12 +00:00
Arnold Schwaighofer
2277086eb4 stdlib: Add documentation for the cached ascii collation tables
Swift SVN r31493
2015-08-26 15:14:22 +00:00