Commit Graph

85 Commits

Author SHA1 Message Date
Mike Ash
fa5888fb3f [Stdlib][Overlays] Rename various classes to avoid conflicting ObjC names.
Old Swift and new Swift runtimes and overlays need to coexist in the same process. This means there must not be any classes which have the same ObjC runtime name in old and new, because the ObjC runtime doesn't like name collisions.

When possible without breaking source compatibility, classes were renamed in Swift, which results in a different ObjC name.

Public classes were renamed only on the ObjC side using the @_objcRuntimeName attribute.

This is similar to the work done in pull request #19295. That only renamed @objc classes. This renames all of the others, since even pure Swift classes still get an ObjC name.

rdar://problem/46646438
2019-01-15 12:21:20 -05:00
Ben Cohen
1673c12d78 [stdlib] Replace "sanityCheck" with "internalInvariant" (#20616)
* Replace "sanityCheck" with "internalInvariant"
2018-11-15 20:50:22 -08:00
Karoy Lorentey
671de071c6 [stdlib] Audit @_fixed_layout usage in collection storage classes
- Remove __SwiftNativeNSEnumerator from the ABI. (It’s only used in internal classes and in the Objective-C runtime.)
- Remove inlinability of init() and deinit for all the __SwiftNativeNSFoo superclasses except Array’s and Data’s.
2018-11-12 20:53:10 +00:00
Karoy Lorentey
ad8276f14c [stdlib] Array: Remove some deferred bridging details from ABI
- __SwiftNativeNSArrayWithContiguousStorage.withUnsafeBufferOfObjects
- __ContiguousArrayStorageBase._getNonVerbatimBridgingBuffer()
- __ContiguousArrayStorageBase._getNonVerbatimBridgedCount()
- Most __SwiftDeferredNSArray members
2018-10-26 23:53:34 +01:00
Karoy Lorentey
a8f29a3ce5 [stdlib] Simplify _HeapBuffer; limit its scope and rename to _BridgingBuffer
- HeapBuffer was at the wrong abstraction level, for no good reason. We have ManagedBuffer for the general case; we don’t need a slightly less general variant of it.
- Current usages of HeapBuffer are hyper specific: they all are flat buffers of AnyObjects, facilitating bridging. It makes sense to dedicate _HeapBuffer for this single usecase.
- Introduce a dedicate ManagedBuffer subclass for bridging buffers. This will make it slightly easier to recognize these in heap dumps.
- Inlinability audit.
2018-10-26 23:53:06 +01:00
Mike Ash
317451c8ee [Runtime][Stdlib][Overlays] Add comments to all the renamed classes explaining the rename and noting that the old name cannot be used due to conflicts.
rdar://problem/35768222
2018-09-20 12:07:30 -04:00
Mike Ash
798edb9d0e [Runtime][Stdlib][Overlays] Rename various Objective-C classes and methods that would conflict when loading old Swift libraries into a process alongside ABI-stable libraries.
rdar://problem/35768222
2018-09-13 16:55:10 -04:00
Ben Cohen
a6952decab [stdlib] Remove inlineable annotation from transparent functions (#17800)
* Remove inlineable annotation from transparent functions
2018-07-07 08:47:02 -07:00
Karoy Lorentey
23c630ac92 [stdlib] Add @usableFromInline to internal typealiases that need it
This fixes 3659 warnings in the standard library.
2018-06-18 16:34:19 +01: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
Ben Cohen
d8d7edf89d [stdlib][NFC] Warning cleanup (#14727)
* Remove Countable use from _ArrayBufferProtocol

* Mark _SwiftNativeNSArrayWithContiguousStorage's init @nonobjc

* Give {Closed}Range a _customIndexOfEquatableElement, supressing warning for _customContainsEquatableElement near-miss

* Eliminate CharacterView.init warning, since it's hard to supress and these things warn constantly.
2018-02-20 11:42:32 -08:00
Erik Eckstein
2e4ecb425e stdlib: make the destructor of _SwiftNativeNSArrayWithContiguousStorage inlinable on linux
... as it is for ObjC runtimes.
This is need for the optimizer to do certain optimizations, like object outlining.

rdar://problem/34758773
2018-01-19 11:32:35 -08:00
eeckstein
b126b62256 Revert "Optimization changes to completely fold OptionSet literals" 2018-01-18 22:05:07 -08:00
Erik Eckstein
228bf53f27 stdlib: make the destructor of _SwiftNativeNSArrayWithContiguousStorage inlinable on linux
... as it is for ObjC runtimes.
This is need for the optimizer to do certain optimizations, like object outlining.

rdar://problem/34758773
2018-01-18 18:27:17 -08:00
Slava Pestov
d0d4b61837 stdlib: Fix resilient build on Linux 2017-12-20 23:42:08 -08:00
taylor swift
c85880899d implement SE 184: add allocation methods to Unsafe buffer pointers, drop all parameters from deallocation, adjust namings, and add repeated-value assignment methods 2017-11-17 21:28:03 -08:00
Slava Pestov
278425a62a stdlib: Remove unnecessary @_inlineable and @_versioned declarations 2017-10-31 13:37:38 -07:00
Max Moiseev
a24998a5b1 [stdlib] Add missing @_fixed_layout attributes to fix resilience build 2017-10-02 15:19:06 -07:00
Maxim Moiseev
98b875a6e5 Fix compilation errors 2017-09-29 11:26:56 -07: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
cc225eb9fa [Stdlib] Silence all warnings about deprecated @objc inference.
This eliminates 26 Objective-C entry points that we never intended to expose, but that came “for free” with the @objc inference rules.
2017-03-31 21:53:55 -07:00
Slava Pestov
2141c1515b stdlib: Remove obsolete FIXME: comment 2017-03-23 22:20:08 -07:00
Roman Levenstein
29ad714bb7 Annotate stdlib functions to get a good performance even in resilient mode, when -sil-serialize-all is disabled
This commit mostly improves the performance of arrays and ranges.
It does not cover Strings, Dictionaries and Sets yet.
2017-03-16 19:46:11 -07:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01: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
ben-cohen
d34f3ee96d Remove dummy Void args working around fixed typechecker bug – ABI FIXME #26 2016-10-11 17:56:42 -07:00
practicalswift
fa7fbdb8b0 [gardening] Remove redundant nil-initialization of optional variable
From the Swift documentation:

"If you define an optional variable without providing a default value,
 the variable is automatically set to nil for you."
2016-09-18 07:40:07 +02:00
Erik Eckstein
266a5f90bd stdlib: Use builtin tail-allocated arrays instead of ManagedBuffer to allocate contiguous array buffers.
This reduces the amount of SIL generated for array operations significantly.
The generated code should be mostly the same (modulo different inlining decisions).
2016-09-16 11:02:19 -07:00
Dmitri Gribenko
fbb3cf35a5 Revert "New SIL instructions to support tail-allocated arrays in SIL." 2016-09-15 00:25:25 -07:00
Erik Eckstein
1201d96cb2 stdlib: Use builtin tail-allocated arrays instead of ManagedBuffer to allocate contiguous array buffers.
This reduces the amount of SIL generated for array operations significantly.
The generated code should be mostly the same (modulo different inlining decisions).
2016-09-14 14:54:18 -07:00
Nicholas Maccharoli
e8b15ca17d [stdlib] simplify repeat to while 2016-09-02 12:06:01 +09:00
Michael Ilseman
b7c9eddd11 [noescape by default] drop @noescape from stdlib 2016-08-04 16:09:01 -07:00
Rintaro Ishizaki
091506315b [SE-0101] Implement: Reconfiguring sizeof and related functions into MemoryLayout struct
As of now:

* old APIs are just marked as `deprecated` not `unavaiable`. To make it
  easier to co-operate with other toolchain repos.
* Value variant of API is implemented as public @private
  `_ofInstance(_:)`.
2016-07-30 03:09:28 +09:00
Andrew Trick
0b75ee975e Remove "illegal" UnsafePointer casts from the stdlib.
Update for SE-0107: UnsafeRawPointer

This adds a "mutating" initialize to UnsafePointer to make
Immutable -> Mutable conversions explicit.

These are quick fixes to stdlib, overlays, and test cases that are necessary
in order to remove arbitrary UnsafePointer conversions.

Many cases can be expressed better up by reworking the surrounding
code, but we first need a working starting point.
2016-07-28 20:42:23 -07:00
Andrew Trick
c125528600 Use a UnsafeMutableRawPointer in SwiftNativeNSArray.getObjects()
In order to conform to the memory model.
2016-07-27 08:05:55 -07:00
Luke Larson
74e0498015 Revert "Update master to build with Xcode 8 beta 3, OS X 10.12, iOS 10, tvOS 10, and watchOS 3 SDKs."
This reverts commit 62d1fa760c.
2016-07-19 15:18:17 -07:00
Mishal Shah
62d1fa760c Update master to build with Xcode 8 beta 3, OS X 10.12, iOS 10, tvOS 10, and watchOS 3 SDKs. 2016-07-19 22:31:34 +02:00
Andrew Trick
0230efc614 Rename UnsafePointer assign/initialize and eliminate Backward variants. (#3585)
Also fixes the comments to clarify that source and self memory
must be disjoint.
2016-07-18 15:15:47 -07:00
Chris Lattner
4fd8418ba7 move the stdlib to put noescape and autoclosure on the type, instead of
the parameter.  Progress towards SE-0049.
2016-04-14 23:13:43 -07:00
Jordan Rose
bc83940301 Make pointer nullability explicit using Optional.
Implements SE-0055: https://github.com/apple/swift-evolution/blob/master/proposals/0055-optional-unsafe-pointers.md

- Add NULL as an extra inhabitant of Builtin.RawPointer (currently
  hardcoded to 0 rather than being target-dependent).
- Import non-object pointers as Optional/IUO when nullable/null_unspecified
  (like everything else).
- Change the type checker's *-to-pointer conversions to handle a layer of
  optional.
- Use 'AutoreleasingUnsafeMutablePointer<NSError?>?' as the type of error
  parameters exported to Objective-C.
- Drop NilLiteralConvertible conformance for all pointer types.
- Update the standard library and then all the tests.

I've decided to leave this commit only updating existing tests; any new
tests will come in the following commits. (That may mean some additional
implementation work to follow.)

The other major piece that's missing here is migration. I'm hoping we get
a lot of that with Swift 1.1's work for optional object references, but
I still need to investigate.
2016-04-11 20:06:38 -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
4da439d406 copy(withZone:) => copy(with:) in ShadowProtocols 2016-03-08 15:50:59 -08:00
Dmitri Gribenko
3c93ccc4f7 stdlib: apply API guidelines and fix coding style in SwiftNativeNSArray.swift 2016-02-24 19:55:57 -08:00
Dave Abrahams
64a5165ecf stdlib: deinitializePointee(_) => deinitialize()
Tacking "Pointee" on just for unary operations (and especially
operations with an optional count) created inconsistency.
2016-02-23 15:34:20 -08:00
Max Moiseev
40b1a0b7e0 [stdlib] all sorts of require renamed back to precondition 2016-02-19 18:21:29 -08:00
Dmitri Gribenko
dd75aed67a Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-17 14:40:05 -08:00
Dmitri Gribenko
efaa39ea79 stdlib: add first argument labels and some other changes to conform to API guidelines 2016-02-15 23:47:54 -08:00
Max Moiseev
3a3984877a Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-15 15:43:34 -08:00