Optimize accessing Swift Arrays from ObjC

This commit is contained in:
David Smith
2019-10-15 13:29:42 -07:00
parent 9cbed94062
commit d9cef0afef
3 changed files with 106 additions and 22 deletions

View File

@@ -541,8 +541,6 @@ ArrayTestSuite.test("BridgedToObjC/Verbatim/objectAtIndex") {
expectEqual(idValue0, unsafeBitCast(a.object(at: 0) as AnyObject, to: UInt.self))
expectEqual(idValue1, unsafeBitCast(a.object(at: 1) as AnyObject, to: UInt.self))
expectEqual(idValue2, unsafeBitCast(a.object(at: 2) as AnyObject, to: UInt.self))
expectAutoreleasedKeysAndValues(unopt: (0, 3))
}
for indexRange in [
@@ -602,8 +600,6 @@ ArrayTestSuite.test("BridgedToObjC/Verbatim/getObjects") {
buffer.deallocate()
_fixLifetime(a)
expectAutoreleasedKeysAndValues(unopt: (0, 3))
}
ArrayTestSuite.test("BridgedToObjC/Verbatim/copyWithZone") {
@@ -721,8 +717,6 @@ ArrayTestSuite.test("BridgedToObjC/Verbatim/BridgeBack/Reallocate") {
expectEqual(idValue0, unsafeBitCast(a.object(at: 0) as AnyObject, to: UInt.self))
expectEqual(idValue1, unsafeBitCast(a.object(at: 1) as AnyObject, to: UInt.self))
expectEqual(idValue2, unsafeBitCast(a.object(at: 2) as AnyObject, to: UInt.self))
expectAutoreleasedKeysAndValues(unopt: (0, 3))
}
ArrayTestSuite.test("BridgedToObjC/Verbatim/BridgeBack/Adopt") {
@@ -812,7 +806,6 @@ ArrayTestSuite.test("BridgedToObjC/Custom/objectAtIndex") {
expectEqual(idValue2, unsafeBitCast(a.object(at: 2) as AnyObject, to: UInt.self))
expectEqual(3, TestBridgedValueTy.bridgeOperations)
expectAutoreleasedKeysAndValues(unopt: (0, 3))
}
for indexRange in [
@@ -874,7 +867,6 @@ ArrayTestSuite.test("BridgedToObjC/Custom/getObjects") {
_fixLifetime(a)
expectEqual(3, TestBridgedValueTy.bridgeOperations)
expectAutoreleasedKeysAndValues(unopt: (0, 3))
}
ArrayTestSuite.test("BridgedToObjC/Custom/copyWithZone") {
@@ -1011,8 +1003,6 @@ ArrayTestSuite.test("BridgedToObjC/Custom/BridgeBack/Cast") {
expectEqual(idValue0, unsafeBitCast(a.object(at: 0) as AnyObject, to: UInt.self))
expectEqual(idValue1, unsafeBitCast(a.object(at: 1) as AnyObject, to: UInt.self))
expectEqual(idValue2, unsafeBitCast(a.object(at: 2) as AnyObject, to: UInt.self))
expectAutoreleasedKeysAndValues(unopt: (0, 3))
}
ArrayTestSuite.test("BridgedToObjC/Custom/BridgeBack/Reallocate") {
@@ -1045,8 +1035,6 @@ ArrayTestSuite.test("BridgedToObjC/Custom/BridgeBack/Reallocate") {
expectEqual(idValue0, unsafeBitCast(a.object(at: 0) as AnyObject, to: UInt.self))
expectEqual(idValue1, unsafeBitCast(a.object(at: 1) as AnyObject, to: UInt.self))
expectEqual(idValue2, unsafeBitCast(a.object(at: 2) as AnyObject, to: UInt.self))
expectAutoreleasedKeysAndValues(unopt: (0, 3))
}
ArrayTestSuite.test("BridgedToObjC/Custom/BridgeBack/Adopt") {