Commit Graph

1324 Commits

Author SHA1 Message Date
Max Moiseev
885b564bf5 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-03-09 17:16:37 -08:00
Xi Ge
94e999f312 ModuleGroup: Add several missing files to their groups. 2016-03-09 17:09:34 -08:00
Max Moiseev
bcc08b6c3c fixing availability attribute hint for joinWithSeparator 2016-03-09 17:38:31 -07:00
Max Moiseev
aacc0f8293 merging RangeReplaceableCollectionType into RangeReplaceableCollection 2016-03-09 16:17:00 -08:00
Max Moiseev
02006f20bc Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-03-09 16:05:03 -08:00
Arnold Schwaighofer
8df5ed5c53 Merge pull request #1599 from aschwaighofer/tune_withUnsafeMutableBufferPointer_for_inlining
Force inlining of Array.withUnsafeMutableBufferPointer
2016-03-09 13:36:48 -08:00
Dmitri Gribenko
2b342cdc19 Merge pull request #1568 from rintaro/simplify-transcode
[stdlib] Simplify transcode implementation
2016-03-09 13:05:05 -08:00
Arnold Schwaighofer
3738178a43 Force inlining of Array.withUnsafeMutableBufferPointer
We do this to enable removal of the closure (allocation).

The size of the libSwiftCore.dylib grows by 300 bytes. A program (such as
benchmark/single-source/unit-tests/StackPromo.swift) that uses one invocation of
withUnsafeMutableBufferPointer shrinks by roughly 500 bytes.
2016-03-09 13:01:05 -08:00
Ted Kremenek
838d5864ba Merge pull request #1498 from ianpartridge/print-using-fwrite
[stdlib] Use fwrite(3) in _Stdout.write()
2016-03-08 21:52:42 -08:00
Arnold Schwaighofer
3676671b7f Merge pull request #1587 from aschwaighofer/stack_promote_with_unsafe_mutable_buffer_pointer
Mark Array.withUnsafeMutableBuffer as not escaping the array storage.
2016-03-08 19:39:28 -08:00
Arnold Schwaighofer
b5f018a4b1 Mark Array.withUnsafeMutableBuffer as not escaping the array storage.
This is safe because the closure is not allowed to capture the array according
to the documentation of 'withUnsafeMutableBuffer' and the current implementation
makes sure that any such capture would observe an empty array by swapping self
with an empty array.

Users will get "almost guaranteed" stack promotion for small arrays by writing
something like:

  func testStackAllocation(p: Proto) {
    var a = [p, p, p]
    a.withUnsafeMutableBufferPointer {
      let array = $0
      work(array)
    }
  }

It is "almost guaranteed" because we need to statically be able to tell the size
required for the array (no unspecialized generics) and the total buffer size
must not exceed 1K.
2016-03-08 19:37:47 -08:00
Jordan Rose
2a5a8903e4 Revert "[stdlib] Add @noescape to output parameter of UnicodeCodecType.encode" 2016-03-08 17:29:56 -08:00
Max Moiseev
4da439d406 copy(withZone:) => copy(with:) in ShadowProtocols 2016-03-08 15:50:59 -08:00
Max Moiseev
1fae0d1325 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-03-08 12:48:48 -08:00
Rintaro Ishizaki
4f1a4ecd62 [stdlib] Add @noescape to output parameter of UnicodeCodecType.encode
Conformance:
 - UTF8.encode
 - UTF16.encode
 - UTF32.encode

Related functions:
 - transcode
 - String._encode
 - _StringCore.encode
2016-03-08 17:34:15 +09:00
Max Moiseev
7fe6916bf6 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-03-07 12:10:47 -08:00
Rintaro Ishizaki
1b54593362 [stdlib] Simplify transcode implementation 2016-03-08 02:04:32 +09:00
Dmitri Gribenko
449869ccae stdlib: Remove dead code in String and UnicodeScalar 2016-03-06 02:46:21 -08:00
Ted Kremenek
90ce8daf0b Merge pull request #1552 from hughbe/stdlib-newlines
[gardening] Remove double new lines from stdlib files
2016-03-05 14:40:04 -08:00
Hugh Bellamy
c1b25bb32f [gardening] Remove double new lines from stdlib files 2016-03-05 15:44:54 +00:00
Dmitri Gribenko
43a5d4cf55 stdlib: rename Array.appendContents(of:) to Array.append(contentsOf:) 2016-03-04 14:39:14 -08:00
Max Moiseev
cf4bafe9e3 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-03-03 13:22:03 -08:00
Ian Partridge
1fcf15b150 [stdlib] Ignore errors from fwrite() 2016-03-02 17:29:18 +00:00
Dmitri Gribenko
27c4074bb1 stdlib: docs: fix a reference to a type that does not exist 2016-03-01 14:59:23 -08:00
Ian Partridge
1ee493218b [stdlib] Add _fixLifetime() to avoid ARC leak 2016-03-01 22:23:39 +00:00
Max Moiseev
859db53d87 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-03-01 12:56:26 -08:00
Ian Partridge
fbf11ce054 [stdlib] Fix indentation 2016-03-01 20:49:53 +00:00
Ian Partridge
9412c21345 [stdlib] Use fwrite(3) in ASCII fastpath only 2016-03-01 20:18:32 +00:00
Max Moiseev
a61d9d04f5 [stdlib] availability attributes for UnsafePointer.destroy 2016-03-01 10:38:01 -08:00
Ian Partridge
259d57bbe7 [stdlib] Use fwrite(3) in print() 2016-03-01 15:55:52 +00:00
Dmitri Gribenko
56785e81a6 Merge pull request #1477 from PatrickPijnappel/patch-3
[stdlib] Rewrite UTF8._isValidUTF8()
2016-02-29 13:12:24 -08:00
Max Moiseev
e48f452a2e Merge remote-tracking branch 'origin/swift-3-api-guidelines' into swift-3-api-guidelines 2016-02-29 12:15:33 -08:00
Max Moiseev
a49dab6bf8 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-29 12:08:52 -08:00
Patrick Pijnappel
7c7be3dc00 [stdlib] Add @testable for _isValidUTF8() 2016-02-29 08:09:46 +11:00
Patrick Pijnappel
3543664088 [stdlib] Replace usage of UTF8._numTrailingBytes()
The checks are technically different (previous check only rejected malformed initial code units, not all malformed sequences). Which is more correct is debatable, but since _buffer is only filled by transcoding from UTF-16 it should always be well-formed anyway and the difference is not very relevant.
2016-02-28 21:19:27 +11:00
Patrick Pijnappel
f783558111 [stdlib] Refactor UTF8._isValidUTF() to be useable throughout stdlib
This is as a replacement for usages of UTF8._numTrailingBytes().
Note that the sanityCheck was redundant at both call sites.
2016-02-28 18:48:41 +11:00
Xi Ge
f195adba80 Module group: suggested by @gribozavr, move ExistentialCollection.swift to collection/type-erased group. 2016-02-27 21:14:38 -08:00
Patrick Pijnappel
04f760d836 [stdlib] Fix comments 2016-02-28 16:12:11 +11:00
Patrick Pijnappel
95ea76717c [stdlib] Rewrite UTF8._isValidUTF8() 2016-02-28 15:38:52 +11: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