-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[stdlib] Set, Dictionary: Resilient Cocoa indices, vol 2 #19612
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
lorentey
commented
Sep 28, 2018
- Fix effects annotations
- Replace typed storage reference with two BridgeObjects. This covers all future variants I can think of.
Replace the single typed storage reference with two _BridgeObjects; this should give us plenty of space to play around with alternative representations.
@swift-ci please test |
@@ -412,17 +412,34 @@ extension _CocoaSet { | |||
@usableFromInline | |||
internal struct Index { | |||
@usableFromInline | |||
internal var storage: Storage | |||
internal var _object: Builtin.BridgeObject | |||
@usableFromInline |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think these need to be usableFromInline
anymore, do they?
(Though if you do remove it, please do it in a follow-up. We need to get those optimize-test bots back sooner rather than later.)
Build failed |
Good, now it's failing on macOS, too. Let's see if I can find out why. |
And this is an unoptimized test, too. |
return _isUnique_native(&storage) | ||
} | ||
|
||
@usableFromInline | ||
internal mutating func copy() -> Storage { | ||
internal mutating func copy() -> _CocoaDictionary.Index { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should not be mutating, nor @usableFromInline
guard _isNativePointer(_storage) else { | ||
return false | ||
} | ||
unowned(unsafe) var storage = _bridgeObject(toNative: _storage) | ||
return _isUnique_native(&storage) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is quite broken; the result of Index._asCocoa
is never unique, so checking uniqueness here will never succeed. This needs to be moved to the top-level index.
stdlib/public/core/SetBridging.swift
Outdated
@@ -362,7 +362,7 @@ extension _CocoaSet: _SetBuffer { | |||
internal func formIndex(after index: inout Index) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
formIndex(after:)
is not exposed in Dictionary
nor Set
; only the index(after:)
variants ever get called.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And the @_effects
attribute obviously doesn't apply on it.
@swift-ci test |
@swift-ci please smoke benchmark |
Latest commits fix issues uncovered in tests, including the optimized tests regression. |
Build comment file:Performance: -O
Performance: -Osize
Performance: -Onone
How to read the dataThe tables contain differences in performance which are larger than 8% and differences in code size which are larger than 1%.If you see any unexpected regressions, you should consider fixing the regressions before you merge the PR. Noise: Sometimes the performance results (not code size!) contain false alarms. Unexpected regressions which are marked with '(?)' are probably noise. If you see regressions which you cannot explain you can try to run the benchmarks again. If regressions still show up, please consult with the performance team (@eeckstein). Hardware Overview
|