Commit Graph

4650 Commits

Author SHA1 Message Date
Dmitri Gribenko
a9f8d97d3e Replace 'unsigned int' with 'unsigned'
'unsigned' is more idiomatic in LLVM style.
2016-02-27 16:20:27 -08:00
Dmitri Gribenko
2fe3a39ad3 Fix call sites of unsafeBitCast() in the Glibc overlay 2016-02-27 16:49:44 -07:00
Chris Lattner
0b2cf15566 Merge pull request #1472 from PatrickPijnappel/patch-3
[stdlib] Fix outdated comment
2016-02-27 14:06:49 -08:00
practicalswift
34188788a1 [gardening] Sort file listings in CMakeLists.txt files 2016-02-27 19:50:30 +01:00
Patrick Pijnappel
ff253ecec0 Fix outdated comment 2016-02-27 22:54:23 +11:00
Nadav Rotem
493f4e3747 [CodeSize] Disable the inlining of measureExtendedGraphemeCluster.
I am using Erik's inliner analysis tool to identify areas where the inliner is
too aggressive. In this commit I disabled the inlining of the method
measureExtendedGraphemeCluster. This change reduced the size of the swift
standard library by about 45k (2% of the .text size). I did not see any
performance regressions on the performance test suite.
2016-02-26 14:48:39 -08:00
Daniel Duan
2bc78b8c09 [stdlib] update for 'inout' adjustment (SE-0031) 2016-02-26 12:02:29 -08:00
Dmitri Gribenko
836e7785f9 stdlib: UTF16.measure() => .transcodedLength() 2016-02-25 15:06:00 -08:00
Dmitri Gribenko
6bb8045a72 stdlib: add better argument labels to transcode() 2016-02-25 14:53:52 -08:00
Dmitri Gribenko
1f4d8e20ed stdlib: UnicodeScalar.escape() => .escaped() 2016-02-25 14:39:47 -08:00
Dmitri Gribenko
5f4fec74f8 stdlib: remove UnicodeScalar.init() 2016-02-25 14:39:47 -08:00
Jordan Rose
b319e3da32 stdlib: Adjust to insert(contentsOf:at:) and append(contentsOf:)
instead of insertContents(of:at:) and appendContents(of:),
originally insertContentsOf(_:at:) and appendContentsOf(_:)
per internal discussion.
2016-02-25 12:50:39 -08:00
swiftix
17a2106e3a Merge pull request #1429 from swiftix/wip-prespecializations-module
Move pre-specializations of popular types away from the stdlib.

This saves 4%-5% of code size in libswiftCore.dylib.
2016-02-25 12:44:36 -08:00
Xi Ge
95fe01d874 Module groups: Array is a sub-group of collection. 2016-02-25 12:35:27 -08:00
Xi Ge
01f7c5b489 [cmake] Make stdlib depend on the Json group info file. 2016-02-25 12:35:27 -08:00
Max Moiseev
488b464f10 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-25 12:21:56 -08:00
Roman Levenstein
8dff92ad4d Move pre-specializations of popular types away from the standard library.
Pre-specializations were only used by Onone builds, but were kept inside the standard library dylyb anyways. This commit moves all the pre-specializations into a dedicated Swift module and a dynamic library, which are only used by Onone builds.

This reduces the code size of libswiftCore.dylib by 4%-5%.
2016-02-25 11:23:15 -08:00
John McCall
3ce1ba3e65 Only store the minimal requirements in generic metadata, where
"minimal" is defined as the set of requirements that would be
passed to a function with the type's generic signature that
takes the thick metadata of the parent type as its only argument.
2016-02-25 10:33:33 -08:00
John McCall
29d036c176 Restore the linked list of all instantiations used by LLDB, which I accidentally broke while reshuffling code. 2016-02-25 09:13:31 -08:00
Roman Levenstein
dbf233318b swift_allocObject should be exposed as a visible runtime entry. 2016-02-25 08:46:57 -08:00
practicalswift
a686c74403 [gardening] Fix recently introduced typo: "nofify" → "notify" 2016-02-25 15:13:54 +01:00
Roman Levenstein
801e45b5f1 Set proper linkage on external declarations of runtime functions implementations. 2016-02-25 05:31:01 -08:00
Roman Levenstein
99fd8b6080 Rename some macros based on the PR review comments.
- use  the SWIFT prefix for all macros
- make names of some macros shorter
2016-02-25 05:31:00 -08:00
Roman Levenstein
de3b850ce8 Use more descriptive names for calling conventions.
Rename RuntimeCC into DefaultCC
Rename RuntimeCC1 into RegisterPreservingCC
Remove RuntimeCC0 because it was identical to DefaultCC.
2016-02-25 05:31:00 -08:00
Roman Levenstein
1d7cca9b07 Fix the failing Linux build.
Don't generate global function pointers if the platforms does not need to provide Obj-C interoperability.
2016-02-25 05:31:00 -08:00
Roman Levenstein
634579aae2 Move RuntimeFunctions.def into a shared location.
RuntimeFunctions.def was used only by IRGen so far. But it is going to be used by the runtime library as well.
2016-02-25 05:30:59 -08:00
Roman Levenstein
68b6181642 Annotate runtime functions using the newly introduced annotations from runtime/Config.h.
This makes sure that runtime functions use proper calling conventions, get the required visibility, etc.

We annotate the most popular runtime functions in terms of how often they are invoked from Swift code.
- Almost all variants of retain/release functions are annotated to use the new calling convention.
- Some popular non-reference counting functions like swift_getGenericMetadata or swift_dynamicCast are annotated as well.

The set of runtime functions annotated to use the new calling convention should exactly match the definitions in RuntimeFunctions.def!
2016-02-25 05:30:59 -08:00
Roman Levenstein
adb5c7347b Auto-generate global symbols for those run-time functions that require it.
Generate global symbols which are function pointers to the actual implementations of runtime entry points.
This is done only for entry points using the new calling convention or for those entry points which explicitly require it.
2016-02-25 05:30:59 -08:00
John McCall
fc261045a5 Optimize the number of accesses performed on ConcurrentMap
and MetadataCache and fix a re-entrancy bug in metadata
instantiation.

The re-entrancy bug is that we were holding the instantiation
lock of a metadata cache while instantiating metadata.  Doing
so prevents us from creating a different instantiation if
it's needed by the outer instantiation.  This is already
possible, but it's much more likely in a patch I'm working on
to only store the minimal metadata for generic parameters
in generic types.

The same bug could also show up as a deadlock between threads,
so a recursive lock would not be a good fix.  Instead, we add
a condition variable to the metadata cache.  When fetching
metadata, we look for a node in the concurrent map, eagerly
creating an empty one if none currently exists.  If lookup
finds an empty node, we wait on the condition variable for
the node to become populated.  If lookup succeeds in creating
an empty node, we instantiate the metadata, grab the lock,
populate the node, and notify the condition variable.

Safely creating an empty node without any metadata present
requires us to move the key data into the map entry.  That,
plus a few other invariant shifts, makes it sensible to
give the user of ConcurrentMap more control over the
allocation of map nodes and the layout of keys.  That, in
turn, allows us to change the contract so that keys can be
more complex than just a hash code.  Instead of incrementing
hash codes and re-performing the lookup, we just insist
that lookup keys be totally ordered.

For now, I've kept the uniform use of hash codes as a
component of the key for MetadataCaches.  However, hash
codes aren't really profitable for small keys, and we should
probably use direct comparisons instead.

We should also switch the safer metadata caches (i.e. the
ones that don't involve calling an arbitrary instantiation
function, like MetatypeMetadataCache) over to directly use
ConcurrentMap.

LLDB's requirement that we maintain a linked list of metadata
cache instantiations with a known layout means we can't yet
remove the CacheEntry's redundant copy of the generic
arguments.
2016-02-25 01:11:57 -08:00
Dmitri Gribenko
f6b271913b stdlib: replace UnicodeDecodingResult.isEmptyInput with Equatable 2016-02-24 21:01:35 -08:00
Dmitri Gribenko
63ec99b186 stdlib: add argument labels to UTF16._copy() 2016-02-24 19:55:57 -08:00
Dmitri Gribenko
3c93ccc4f7 stdlib: apply API guidelines and fix coding style in SwiftNativeNSArray.swift 2016-02-24 19:55:57 -08:00
Dmitri Gribenko
68bf4ae8ce stdlib: apply API guidelines in Unicode.swift 2016-02-24 19:55:57 -08:00
Dmitri Gribenko
7b3e9c3409 stdlib: fix coding style 2016-02-24 19:55:57 -08:00
Dmitri Gribenko
9a0c50b82f stdlib: add argument labels in _StringBufferIVars 2016-02-24 19:55:56 -08:00
Chris Lattner
92566e3fd8 Merge pull request #1438 from glessard/renamed-weak
Update comment to reflect the renaming of weakRelease
2016-02-24 18:44:00 -08:00
Dmitri Gribenko
5cffdeedd8 Merge pull request #1440 from cwillmor/swift-3-api-guidelines
stdlib: Audit StringUTF16.swift, StringUTF8.swift for Swift 3 naming.
2016-02-24 18:30:54 -08:00
Jordan Rose
e4e9c71d8f StdlibUnittest: Rename enum cases and static vars to match API guidelines. 2016-02-24 18:23:59 -08:00
Jordan Rose
f922084180 stdlib: Rename miscellaneous enum cases and static vars. 2016-02-24 17:46:14 -08:00
Jordan Rose
8fdee4ad3c stdlib: Rename some implementation details of mirrors/reflection. 2016-02-24 17:46:13 -08:00
Jordan Rose
e5ae60aafc stdlib: Rename some helpers inside UnicodeTrie. NFC. 2016-02-24 17:46:13 -08:00
Jordan Rose
e45dfe09c6 stdlib: Rename 'Native'/'Cocoa' representations inside Dictionary/Set.
...and then because of a compiler bug (SR-806), rename the helper
properties to 'asNative' and 'asCocoa'.

None of this is API, so there is no migration information.
2016-02-24 17:46:12 -08:00
Jordan Rose
979e4a8e34 stdlib: Rename {Float,Double.CGFloat}.NaN to 'nan'
This follows the API guidelines and is consistent with the printed form.
'quietNaN' does not change, though.
2016-02-24 17:46:12 -08:00
Jordan Rose
1a5f23e424 stdlib: Adjust names of hand-imported NSCocoaError/NSURLError cases. 2016-02-24 17:46:11 -08:00
Jordan Rose
b71f7440f0 stdlib: Rename cases in XCTest._XCTThrowableBlockResult.
This is a non-public enum, so there's no migration needed.
2016-02-24 17:46:11 -08:00
Jordan Rose
81905be8dd Rename _BridgedNSError._NSErrorDomain to _nsErrorDomain.
This isn't strictly necessary, since it's an implementation detail, but
it's consistent with the following changes.
2016-02-24 17:46:10 -08:00
Chris Willmore
c305ea03e4 stdlib: Audit StringUTF16.swift, StringUTF8.swift for Swift 3 naming. 2016-02-24 17:29:24 -08:00
Dmitri Gribenko
f3389273ba stdlib: String indices: samePositionIn(_:) => samePosition(in:) 2016-02-24 16:29:27 -08:00
Chris Willmore
2ddb6106e4 stdlib: Audit API for Swift 3 preposition, first-arg label rules
This commit is the result of auditing the following files:

* StringBuffer.swift
* StringCharacterView.swift
* StringCore.swift
* StringInterpolation.swift.gyb
* StringLegacy.swift
2016-02-24 16:11:20 -08:00
Max Moiseev
bb3eaaf308 Merging in latest master 2016-02-24 15:10:25 -08:00