Commit Graph

37 Commits

Author SHA1 Message Date
Xiaodi Wu
cef11cd82e [stdlib][NFC] Final renamings for new integer parsing implementations. 2021-04-02 10:20:04 -04:00
Xiaodi Wu
c40c90402a [stdlib] Address reviewer comments and make some minor edits to string-to-integer parsing. 2021-04-01 13:03:56 -04:00
Xiaodi Wu
5d943f46bd [stdlib] Further simplify string-to-integer parsing and change some inlining choices. 2021-03-29 12:08:28 -04:00
Xiaodi Wu
0319bdc966 [gardening] Fix tab size inconsistency. 2021-03-29 11:30:48 -04:00
Xiaodi Wu
529891c911 [stdlib] Simplify implementation of string-to-integer parsing. 2021-03-29 11:27:21 -04:00
Xiaodi Wu
ebad4bbb5d [stdlib] Specialize FixedWidthInteger.init(_:radix:). 2021-03-29 10:19:22 -04:00
Xiaodi Wu
cc8a351cc1 [stdlib] Never inline two more string-to-integer parsing methods. 2021-03-29 09:02:41 -04:00
Xiaodi Wu
7c333b8e44 [stdlib] Never inline fallback helper methods when parsing strings to integers. 2021-03-28 22:22:50 -04:00
Xiaodi Wu
a9c57c3bcd [stdlib] Make FixedWidthInteger.init?(_:radix:) always inlined, and fix a think-o. 2021-03-28 20:44:11 -04:00
Xiaodi Wu
ad992f48dd [stdlib][SR-7556] Re-implement string-to-integer parsing. 2021-03-28 16:49:09 -04:00
Paul Hudson
06f82a53b5 Replaced the majority of ' : ' with ': '. 2019-07-18 20:46:07 +01:00
Ben Cohen
1673c12d78 [stdlib] Replace "sanityCheck" with "internalInvariant" (#20616)
* Replace "sanityCheck" with "internalInvariant"
2018-11-15 20:50:22 -08:00
Michael Ilseman
c749123297 [String] DCE and drop inlinable
Remove some more inlinable annotations and drop dead code.
2018-11-15 11:06:30 -08:00
Michael Ilseman
4ab45dfe20 [String] Drop in initial UTF-8 String prototype
This is a giant squashing of a lot of individual changes prototyping a
switch of String in Swift 5 to be natively encoded as UTF-8. It
includes what's necessary for a functional prototype, dropping some
history, but still leaves plenty of history available for future
commits.

My apologies to anyone trying to do code archeology between this
commit and the one prior. This was the lesser of evils.
2018-11-04 10:42:40 -08:00
Ben Cohen
dd2f3b4386 [stdlib] More inalienable auditing (#18925)
* Removing FIXME from methods also marked always/never

* Unavailable/deprecated things don't need inlining

* Trivial implementations

* Enum namespaces

* Unsafe performance of opaque/raw pointer

* Dump doesn't need to be fast

* Error paths shouldn't require inlining

* Consistency with surrounding code

* Lazy performance needs specialization
2018-08-23 18:52:21 -07:00
Michael Ilseman
e907d11dbc [stdlib] Drop @inlinable if @inline(never).
Aggressively remove all `@inlinable` from any function that's
`@inline(never)` to see the impact.

`@inlinable @inline(never)` is a potential code smell. While it might
expose some optimization and specialization opportunities to the
optimizer, it's most commonly a sign that more thought is needed.
2018-04-25 18:30:33 -07:00
Slava Pestov
2e5aef9c8d stdlib: Remove redundant @usableFromInline attributes 2018-04-06 00:02:30 -07:00
Slava Pestov
e1f50b2d36 SE-0193: Rename @_inlineable to @inlinable, @_versioned to @usableFromInline 2018-03-30 21:55:30 -07:00
Michael Ilseman
6970238635 [gardening] code formatting; NFC 2018-03-13 15:32:20 -07:00
Michael Ilseman
e7c418b0fa [comments] Annotate places we don't use _StringGuts visitor. NFC
Adds some comments for sections of code that doesn't adopt the
visitation pattern, or have inefficiencies discovered as part of this
work. Additionally, mutating methods generally do not use the visitor
scheme.
2018-03-13 15:32:19 -07:00
Michael Ilseman
1229af8e0f [string] Adopt _StringGuts visitor pattern.
Use the visitor pattern in most of the opaque-by-hand call
sites. Inspecting the compiler output does not show excessive and
unanticipated ARC, but there may need to be further tweaks.

One downside of the visitor pattern as written is that there's extra
shuffling around of registers for the closure CC. Hopefully this will
also be fixed soon.
2018-03-13 15:32:19 -07:00
Michael Ilseman
12fe85fad1 [string] Establish opaque branching pattern.
Stop inlining _asOpaque into user code. Inlining it bloats user code
as there's a bit-test-and-branch to a block containing the _asOpaque
call, followed up some operations to e.g. manipulate the range or
re-align the calling convention, etc., followed by a final branch to
opaque stdlib code.

Instead, branch directly into opaque stdlib code. In theory, this
means that supporting all opaque patterns can be done with minimal
bloat. On ARM, this is a single tbnz instruction.
2018-03-13 15:32:19 -07:00
Michael Ilseman
444796a66b [gardening] Strip trailing whitespace; NFC 2018-03-13 15:32:19 -07:00
Michael Ilseman
3be2faf5d3 [String] Initial implementation of 64-bit StringGuts.
Include the initial implementation of _StringGuts, a 2-word
replacement for _LegacyStringCore. 64-bit Darwin supported, 32-bit and
Linux support in subsequent commits.
2018-01-21 12:32:26 -08:00
Max Moiseev
53b8419279 [stdlib] Make all the stdlib APIs @_inlineable
This change in theory should allow us to remove a special stdlib-only
sil-serialize-all compilation mode.

<rdar://problem/34138683>
2017-09-29 11:26:56 -07:00
Maxim Moiseev
52259b714b Merge pull request #11193 from xwu/lossless-integers
[stdlib] Conform fixed-width integer types to LosslessStringConvertible
2017-07-28 20:10:07 -07:00
Nate Cook
a7ce287a53 Merge branch 'master' into integers-revised 2017-07-28 12:23:48 -05:00
Xiaodi Wu
add2bce944 Revise doc comments and add test 2017-07-26 22:57:28 -05:00
Max Moiseev
1c3e597928 [stdlib] Get rid of ArithmeticOverflow type 2017-07-26 11:09:36 -07:00
Maxim Moiseev
a5ff35cd41 [stdlib] extendingOrTruncating: => truncatingIfNeeded: 2017-07-26 11:09:36 -07:00
Xiaodi Wu
f817803d01 Conform fixed-width integer types to LosslessStringConvertible 2017-07-25 21:57:42 -05:00
Ben Cohen
92bc5b7829 Switch Int/Float inits + join to be on StringProtocol 2017-07-25 08:28:22 -07:00
Roman Levenstein
ecff16cba3 Reduce code size of the stdlib
This should reduce the code size of the stdlib by 1.5%.
2017-06-03 14:22:12 -07:00
Arnold Schwaighofer
3f7fcfadeb Address review comments
Rename _parseASCIIOutlined to _parseASCIISlowPath.
Change doc comment to regular comment.
2017-06-02 11:27:42 -07:00
Arnold Schwaighofer
d289236f79 stdlib: Move _parseASCIIOutlined into the FixedWidthInteger extension 2017-06-02 07:24:20 -07:00
Arnold Schwaighofer
d457adb776 stdlib: Outline integer parsing code in FixedWidthInteger.init(_: radix:) on the slow paths
This reduces code size by 20k on an app that uses this function.

rdar://32519912
2017-06-01 15:18:54 -07:00
Dave Abrahams
c67977a881 [stdlib] Replace Integer Parsing Code 2017-05-18 07:00:34 -07:00