Commit Graph

26 Commits

Author SHA1 Message Date
Doug Gregor
9579390024 [SE-0304] Rename ConcurrentValue to Sendable 2021-03-18 22:48:20 -07:00
Doug Gregor
1a1f79c0de Introduce safety checkin for ConcurrentValue conformance.
Introduce checking of ConcurrentValue conformances:
- For structs, check that each stored property conforms to ConcurrentValue
- For enums, check that each associated value conforms to ConcurrentValue
- For classes, check that each stored property is immutable and conforms
  to ConcurrentValue

Because all of the stored properties / associated values need to be
visible for this check to work, limit ConcurrentValue conformances to
be in the same source file as the type definition.

This checking can be disabled by conforming to a new marker protocol,
UnsafeConcurrentValue, that refines ConcurrentValue.
UnsafeConcurrentValue otherwise his no specific meaning. This allows
both "I know what I'm doing" for types that manage concurrent access
themselves as well as enabling retroactive conformance, both of which
are fundamentally unsafe but also quite necessary.

The bulk of this change ended up being to the standard library, because
all conformances of standard library types to the ConcurrentValue
protocol needed to be sunk down into the standard library so they
would benefit from the checking above. There were numerous little
mistakes in the initial pass through the stsandard library types that
have now been corrected.
2021-02-04 03:45:09 -08:00
Paul Hudson
06f82a53b5 Replaced the majority of ' : ' with ': '. 2019-07-18 20:46:07 +01:00
Ben Cohen
e9d4687e31 De-underscore @frozen, apply it to structs (#24185)
* De-underscore @frozen for enums

* Add @frozen for structs, deprecate @_fixed_layout for them

* Switch usage from _fixed_layout to frozen
2019-05-30 17:55:37 -07:00
Michael Ilseman
cd35876fa5 [Unicode] Publish Unicode ABI
De-genericize one axis of storage buffers to speed up compilation time
of stdlib and user code. Publish the rest as ABI, since we're out of
time to reevaluate the design.
2018-11-15 11:06:33 -08:00
Johannes Weiss
11b6bb3417 fix documentaion for the Unicode.ParseResult
The previous documentation was not accurate. It said that the length of
the error returned would be the length of the valid prefix. In case of
no valid prefix however the code will still return 1, contrary to the
documentation.
I fixed the documentation by adding the guarantee that the error length
will always be positive and removing the information about the valid
prefix as we might want to change the precise algorithm in the future.
2018-11-14 12:13:42 +00:00
Michael Ilseman
4ddfd30787 [stdlib] Remove dead code 2018-11-09 13:39:59 -08:00
Michael Ilseman
b62241aba4 [string] Cleanup and remove init-from-CString inlinability 2018-05-13 07:38:55 -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
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
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
ef6b5c4795 Add missing @_inlineable attributes and deinits 2017-09-29 11:26:56 -07: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
Doug Gregor
3b47b16a47 [Stdlib] Eliminate the _UnicodeEncoding_ protocol.
This protocol was only used to fake recursive protocol conformances;
collapse it into _UnicodeEncoding.
2017-09-12 06:34:10 -07:00
Dave Abrahams
ceff7a5573 [stdlib] Rewrite UTF16.transcodedLength 2017-06-03 13:08:11 -07:00
Dave Abrahams
562fd79aa6 [stdlib] Encode small Characters as UTF-16
This takes care of the standard library portion, but we need a new
BuiltinUTF16ExtendedGraphemeClusterLiteralConvertible protocol in order to
fully recover the performance of character literals.

Note that part of the character_literals.swift test is currently disabled.  That
will need to be fixed before we can merge this work.
2017-06-01 20:57:25 -07:00
Dave Abrahams
41c244a065 [stdlib] Unicode[Encoding|Parser] => Unicode.[Encoding|Parser] 2017-05-11 17:21:39 -07:00
Dave Abrahams
ddf7ad517f UnicodeScalar => Unicode.Scalar 2017-05-11 15:23:25 -07:00
Dave Abrahams
97f875ad84 [stdlib] De-underscore Unicode "namespace" 2017-05-11 15:23:25 -07:00
Dave Abrahams
c616b180ce [stdlib] Revise comments per proposed revisions to SE-0163 2017-05-09 18:37:20 -07:00
Dave Abrahams
e7b32f9dc9 [stdlib] UnicodeEncoding: hide/internalize APIs we're not sure about
The best high-level APIs for decoding/transcoding are still under active
investigation.  It's likely we want more views.  Therefore, leave
de-underscored/public only the lowest-level APIs for now.
2017-05-09 10:20:29 -07:00
Dave Abrahams
c5d6880053 [stdlib] Add ASCII UnicodeEncoding, drop uses of legacy codecs
Preparation for new C-string interop.
2017-05-07 20:43:44 -07:00
Erik Eckstein
a5ddde2d45 stdlib: make a few structs @_fixed_layout to fix the resilience build.
This is a follow-up fix for making struct constructors inline(__always) in
155db0a4bd: Let Character literals, which fit into 64 bits, be folded into a single integer constant.
and
d8f1caf4a6: Inline all the new low-level bits

If we decide that this structs should not have fixed layout we must re-evaluate the performance difference of not being able to inline
the struct constructors.
2017-05-04 16:08:08 -07:00
Dave Abrahams
d8f1caf4a6 Inline all the new low-level bits 2017-05-03 09:53:30 -07:00
Dave Abrahams
feea061d32 [stdlib] Move new Unicode decoders into the stdlib
No expected change in benchmarks, as legacy components aren't using this yet.
2017-05-01 17:08:08 -07:00