Commit Graph

30 Commits

Author SHA1 Message Date
Doug Gregor
25485858f9 Enable strict memory safety in the SwiftOnoneSupport module 2025-02-26 14:28:05 -08:00
Matt Zanchelli
be13b470aa Fix typos
becuase -> because
preceeds -> precedes
initalizer -> initializer
intialize -> initialize
libary -> library
notfication -> notification
reciever -> receiver
collecton -> collection
exlcusive -> exclusive
techincal -> technical
compatability -> compatibility
setps -> steps
accomodate -> accommodate
brakcet -> bracket
fraciton -> fraction
programm -> program
concequently -> consequently
ecoding -> encoding
timeIntervalforSelfEnd -> timeIntervalForSelfEnd
2020-12-21 18:44:03 -05:00
Anthony Latsis
b0205fa87c stdlib: Place @_semantics prespecialization requirement target under correct constraints 2020-06-13 04:49:56 +03:00
Andrew Trick
d8a3b1eef5 Guard _ArrayBuffer with #if _runtime(_ObjC) 2019-04-16 10:14:22 -07:00
Andrew Trick
700f81613b Rewrite SwiftOnoneSupport and add missing required prespecialization symbols.
In the prior revision, this file combined two approaches:

- the old approach of doing some fun things with arrays and hoping
  that any important public and internal generic symbols will happen
  to be specialized

- the new approach of explicitly specializing a generic symbol by
  annotating a dummy "proxy" function with the actual generic mangled
  name, then calling that proxy with an argument of the type to be
  specialized.

Unfortunately, the symbols exposed by SwiftOnoneSupport have become
ABI. Therefore, the old approach can break over time because changes
to the compiler and standard library will affect which symbols happen
to be specialized. It can be extremely difficult to debug why those
symbols have gone missing.

The new approach will work to ensure ABI stability, but the
implementation was incomplete and the style of implementation would
not work in many cases. It was still relying on the old approach to
cover the generic symbols that weren't explicitly specialized. Also,
it wasn't clear to anyone reading the source what specializations of
those generic symbols are intended and required by the ABI.

This commit completely removes the old approach to prespecialization.

All generic symbols required by the ABI are now explicitly listed.

There are now several different proxy functions declared as methods
within the generic type that they represent. The parameter types of
each proxy function now match the parameter types of the generic
function. This guarantees that the compiler can correctly apply the
proxy function's subsitution map to the generic function's generic
signature. For example, it now handles subtitution of dependent types
(like Range<T>), substitutions that are not in the first parameter
position, and subsitition that occur in multiple parameters.

The proxy functions are now directly invoked with the concrete
argument type needed for specialization. There's no other incidental
code.

It is now possible to read this source and understand which standard
library functions need to be prespecialized on which types.
2019-04-15 20:51:35 -07:00
Erik Eckstein
218cc9b187 Add some pre-specializations for internal stdlib functions in SwiftOnoneSupport
It's very unlikely that those functions are really referenced by Onone executables, but we want to be ABI compatible.
Also, there is no guarantee that this version of SwiftOnoneSupport will always trigger all symbol to be pre-specialized.
If the optimizer changes, we might need to add other explicit pre-specializations of internal stdlib symbols.

rdar://problem/48924409
2019-03-25 14:57:03 -07:00
Ben Cohen
412a045f71 [stdlib] JAFIA (#19074)
* Lazy/generic types needing specialization

* Move DictionaryLiteral typealias to compatibility shims file

* Static String is mainly transparent so needs no inlining

* UnboundedRange hack doesn't need inlining

* Unmanaged needs unsafe performance

* Onone enum namespace

* Output stream specialize-never and calls to lock/unlock don't need inlining

* no need for @_frozen on internal enum

* DropWhile needs lazy-performance
2018-09-19 19:41:06 -07:00
Slava Pestov
e1f50b2d36 SE-0193: Rename @_inlineable to @inlinable, @_versioned to @usableFromInline 2018-03-30 21:55:30 -07:00
Jordan Rose
9034ba617b Ban @_fixed_layout on enums in favor of @_frozen
In theory there could be a "fixed-layout" enum that's not exhaustive
but promises not to add any more cases with payloads, but we don't
need that distinction today.

(Note that @objc enums are still "fixed-layout" in the actual sense of
"having a compile-time known layout". There's just no special way to
spell that.)
2018-03-20 14:49:10 -07:00
Sho Ikeda
415ee8d703 [gardening] Change static internal to internal static for consistency
Before the changes:

- `git grep "internal static " | wc -l`: 161
- `git grep "static internal " | wc -l`: 10
2018-03-13 02:29:56 +09:00
Sho Ikeda
077aa52cc5 [gardening][SwiftOnoneSupport] Replace let _ with _ 2018-03-11 11:20:39 +09:00
Max Moiseev
e13ec74702 Merge branch 'master' into prespecialize-enum 2018-01-10 09:50:08 -08:00
Max Moiseev
5650f80937 [stdlib] Annotate types with @_fixed_layout
This will allows us to build the standard library in resilient mode by
default, hopefully, without performance regression.

<rdar://problem/36362648>
2018-01-09 14:46:30 -08:00
Max Moiseev
2093df6798 Use enum instead of an empty struct [NFC] 2018-01-09 13:15:33 -08:00
Erik Eckstein
76f281510f Remove @_semantics("optimize.sil.never")
The replacement is @_optimize(none)
2017-11-16 14:11:52 -08:00
Max Moiseev
ff105c5ab2 [benchmark] Eliminate usages of String.characters and CharacterView
To avoid compiler warnings.
<rdar://problem/34750654>
2017-10-04 15:50:34 -07:00
Dave Abrahams
ddf7ad517f UnicodeScalar => Unicode.Scalar 2017-05-11 15:23:25 -07:00
Roman Levenstein
506b2b1591 Merge pull request #6582 from djwbrown/djwbrown-OnoneSupport-reversed
[Onone][prespecialize] Added iteration through reversed() arrays.
2017-01-06 08:37:43 -08:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
Dylan Brown
0e024a694b [Onone][prespecialize] Added iteration through reversed() arrays.
In response to [SR-3334], which pointed out a large cost to iteration over
ReversedRandomAccessCollections at optimization level -Onone. By adding
iteration through a.reversed() in the _Prespecialize struct, we can get to
about the same performance as forward iteration.
2016-12-27 00:00:18 +02:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Dmitri Gribenko
8fc9cf9c1e SwiftOnoneSupport: remove unused type 2016-06-22 11:16:13 -07:00
Trent Nadeau
6e327b4ddb Updated stdlib to use @discardableResult and _ = . 2016-05-11 22:53:37 -04:00
practicalswift
db452dcbe9 [gardening] "[ a, b ]" → "[a, b]" 2016-04-17 21:26:08 +02:00
Roman Levenstein
27bcabcde3 Improve handling of pre-specializations.
This commit does not result in any visible functionality changes yet.
This is a preparation for some changes on the swift-3-indexing branch.
2016-04-13 15:49:36 -07:00
Manav Gabhawala
7928140f79 [SE-0046] Implements consistent function parameter labels by discarding extraneous parameter names and adding _ where necessary 2016-04-06 20:21:58 -04:00
Max Moiseev
a49dab6bf8 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-29 12:08:52 -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
Todd Fiala
8ff40a3a22 Revert "Move pre-specializations of popular types away from the standard library."
This reverts commit 4d4c2cdba9.
2016-02-22 21:18:32 -08:00
Roman Levenstein
4d4c2cdba9 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 5%.
2016-02-22 07:54:44 -08:00