Skip to content

[Devirtualizer] Handle default witnesses for generic requirements. #5571

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

Merged

Conversation

DougGregor
Copy link
Member

The witness thunks for default witnesses are different from the
witness thunks for normal witnesses, because default witnesses take
Self (the whole conforming type) rather than having it substituted
away. Cope with this difference while still substituting the innermost
generic parameters for a generic requirement.

The witness thunks for default witnesses are different from the
witness thunks for normal witnesses, because default witnesses take
'Self' (the whole conforming type) rather than having it substituted
away. Cope with this difference while still substituting the innermost
generic parameters for a generic requirement.
@DougGregor
Copy link
Member Author

@swift-ci please benchmark

@swift-ci
Copy link
Contributor

swift-ci commented Nov 1, 2016

Build comment file:

Optimized (O)

Regression (0)

Improvement (0)

No Changes (143)

TEST OLD_MIN NEW_MIN DELTA (%) SPEEDUP
PopFrontArrayGeneric 1116 1094 -2.0% 1.02x(?)
ObjectiveCBridgeToNSDictionary 16947 16654 -1.7% 1.02x(?)
StringHasPrefix 742 738 -0.5% 1.01x(?)
StaticArray 2800 2785 -0.5% 1.01x(?)
ObjectiveCBridgeStubURLAppendPathRef 231884 229324 -1.1% 1.01x(?)
DictionaryRemove 4623 4598 -0.5% 1.01x(?)
ObjectiveCBridgeFromNSArrayAnyObject 76101 75640 -0.6% 1.01x(?)
ObjectiveCBridgeStubDataAppend 2959 2937 -0.7% 1.01x(?)
ObjectiveCBridgeStubNSDateMutationRef 11915 11840 -0.6% 1.01x(?)
MapReduce 361 357 -1.1% 1.01x(?)
ArrayLiteral 1193 1183 -0.8% 1.01x(?)
Dictionary2OfObjects 3421 3399 -0.6% 1.01x(?)
ArraySubscript 1441 1436 -0.3% 1.00x(?)
ObjectiveCBridgeToNSString 1070 1070 +0.0% 1.00x
DictionarySwapOfObjects 6740 6749 +0.1% 1.00x(?)
StackPromo 21535 21535 +0.0% 1.00x
ObjectiveCBridgeFromNSDictionaryAnyObject 203733 203371 -0.2% 1.00x(?)
RecursiveOwnedParameter 1935 1935 +0.0% 1.00x
Integrate 238 238 +0.0% 1.00x
ObjectiveCBridgeFromNSArrayAnyObjectToString 117939 117728 -0.2% 1.00x(?)
ClassArrayGetter 12 12 +0.0% 1.00x
Array2D 2030 2028 -0.1% 1.00x(?)
Histogram 656 656 +0.0% 1.00x
SortStrings 1718 1718 +0.0% 1.00x
ObjectiveCBridgeFromNSDictionaryAnyObjectForced 5292 5294 +0.0% 1.00x(?)
ObjectiveCBridgeStubFromNSDateRef 3725 3729 +0.1% 1.00x(?)
MonteCarloPi 45139 45144 +0.0% 1.00x(?)
StringWithCString 155251 155135 -0.1% 1.00x(?)
ObjectiveCBridgeFromNSArrayAnyObjectForced 6093 6113 +0.3% 1.00x(?)
ObjectiveCBridgeFromNSStringForced 2675 2678 +0.1% 1.00x(?)
Prims 734 734 +0.0% 1.00x
SortLettersInPlace 973 976 +0.3% 1.00x(?)
DictionarySwap 629 628 -0.2% 1.00x(?)
ArrayOfGenericPOD 220 220 +0.0% 1.00x
Dictionary3OfObjects 855 855 +0.0% 1.00x
RangeAssignment 287 287 +0.0% 1.00x
ByteSwap 0 0 +0.0% 1.00x
SuperChars 210564 210480 -0.0% 1.00x(?)
ArrayAppendLazyMap 843 841 -0.2% 1.00x(?)
XorLoop 380 380 +0.0% 1.00x
ArrayAppendReserved 536 536 +0.0% 1.00x
StringInterpolation 10859 10858 -0.0% 1.00x(?)
ObjectiveCBridgeStubToNSString 1283 1283 +0.0% 1.00x
ArrayAppendStrings 12146 12142 -0.0% 1.00x(?)
ObjectiveCBridgeStubFromNSStringRef 128 128 +0.0% 1.00x
ObjectiveCBridgeStubFromNSString 767 769 +0.3% 1.00x(?)
ProtocolDispatch 3040 3040 +0.0% 1.00x
ObjectAllocation 153 153 +0.0% 1.00x
TypeFlood 0 0 +0.0% 1.00x
ObjectiveCBridgeFromNSSetAnyObject 95906 96047 +0.1% 1.00x(?)
AngryPhonebook 2808 2816 +0.3% 1.00x(?)
ProtocolDispatch2 158 158 +0.0% 1.00x
Walsh 323 323 +0.0% 1.00x
Dictionary3 508 509 +0.2% 1.00x(?)
Dictionary2 2051 2051 +0.0% 1.00x
StrComplexWalk 2905 2905 +0.0% 1.00x
SetIntersect_OfObjects 2283 2284 +0.0% 1.00x(?)
Join 467 468 +0.2% 1.00x(?)
ArrayOfRef 3563 3559 -0.1% 1.00x(?)
ArrayAppendOptionals 1239 1233 -0.5% 1.00x(?)
ObjectiveCBridgeToNSArray 30132 30280 +0.5% 1.00x(?)
NSError 325 326 +0.3% 1.00x(?)
DictionaryOfObjects 2283 2284 +0.0% 1.00x(?)
ObjectiveCBridgeStubToNSDateRef 3279 3276 -0.1% 1.00x(?)
PopFrontUnsafePointer 9186 9179 -0.1% 1.00x(?)
StringEqualPointerComparison 7299 7299 +0.0% 1.00x
CaptureProp 4226 4207 -0.5% 1.00x(?)
PolymorphicCalls 22 22 +0.0% 1.00x
RC4 165 165 +0.0% 1.00x
ObjectiveCBridgeStubToNSStringRef 116 116 +0.0% 1.00x
Calculator 31 31 +0.0% 1.00x
ObjectiveCBridgeStubDateMutation 273 273 +0.0% 1.00x
IterateData 2600 2601 +0.0% 1.00x(?)
DictionaryLiteral 2762 2763 +0.0% 1.00x(?)
Hanoi 3193 3194 +0.0% 1.00x(?)
OpenClose 54 54 +0.0% 1.00x
DictionaryRemoveOfObjects 19913 19875 -0.2% 1.00x(?)
UTF8Decode 288 288 +0.0% 1.00x
ObjectiveCBridgeStubURLAppendPath 229100 229622 +0.2% 1.00x(?)
SortStringsUnicode 8106 8106 +0.0% 1.00x
ObjectiveCBridgeFromNSDictionaryAnyObjectToStringForced 136578 136040 -0.4% 1.00x(?)
SetIsSubsetOf 508 508 +0.0% 1.00x
Dictionary 740 741 +0.1% 1.00x(?)
NopDeinit 36651 36675 +0.1% 1.00x(?)
ObjectiveCBridgeStubToArrayOfNSString 29221 29198 -0.1% 1.00x(?)
SetIntersect 1072 1072 +0.0% 1.00x
ObjectiveCBridgeFromNSSetAnyObjectToString 142999 143556 +0.4% 1.00x(?)
ObjectiveCBridgeStubNSDateRefAccess 310 310 +0.0% 1.00x
ArrayInClass 63 63 +0.0% 1.00x
ArrayOfGenericRef 3622 3613 -0.2% 1.00x(?)
StringHasSuffix 801 800 -0.1% 1.00x(?)
Phonebook 7069 7063 -0.1% 1.00x(?)
ObjectiveCBridgeStubDateAccess 182 182 +0.0% 1.00x
Sim2DArray 277 277 +0.0% 1.00x
SetExclusiveOr_OfObjects 7909 7918 +0.1% 1.00x(?)
ArrayAppendRepeatCol 643 642 -0.2% 1.00x(?)
MonteCarloE 10565 10577 +0.1% 1.00x(?)
SetUnion_OfObjects 6590 6591 +0.0% 1.00x(?)
StringHasSuffixUnicode 63814 63856 +0.1% 1.00x(?)
HashTest 1745 1744 -0.1% 1.00x(?)
SetIsSubsetOf_OfObjects 524 523 -0.2% 1.00x(?)
ArrayAppend 775 775 +0.0% 1.00x
DeadArray 185 185 +0.0% 1.00x
StringHasPrefixUnicode 13431 13435 +0.0% 1.00x(?)
LinkedList 7208 7204 -0.1% 1.00x(?)
ObjectiveCBridgeFromNSSetAnyObjectToStringForced 106326 106331 +0.0% 1.00x(?)
RGBHistogramOfObjects 21999 22037 +0.2% 1.00x(?)
NSStringConversion 821 823 +0.2% 1.00x(?)
RGBHistogram 2807 2812 +0.2% 1.00x(?)
ObjectiveCBridgeFromNSSetAnyObjectForced 4625 4631 +0.1% 1.00x(?)
ArrayAppendSequence 1060 1061 +0.1% 1.00x(?)
ArrayAppendArrayOfInt 599 599 +0.0% 1.00x
ArrayOfPOD 182 182 +0.0% 1.00x
SetUnion 3010 3005 -0.2% 1.00x(?)
Chars 623 623 +0.0% 1.00x
StrToInt 4929 4931 +0.0% 1.00x(?)
ArrayValueProp2 6 6 +0.0% 1.00x
BitCount 1 1 +0.0% 1.00x
AnyHashableWithAClass 64015 64029 +0.0% 1.00x(?)
SevenBoom 1369 1365 -0.3% 1.00x(?)
ObjectiveCBridgeFromNSArrayAnyObjectToStringForced 89830 89872 +0.1% 1.00x(?)
StringWalk 5879 5892 +0.2% 1.00x(?)
ArrayValueProp 6 6 +0.0% 1.00x
ObjectiveCBridgeStubFromArrayOfNSString 58459 58470 +0.0% 1.00x(?)
ObjectiveCBridgeFromNSString 1818 1819 +0.1% 1.00x(?)
GlobalClass 0 0 +0.0% 1.00x
Memset 235 235 +0.0% 1.00x
ArrayValueProp4 6 6 +0.0% 1.00x
TwoSum 1601 1597 -0.2% 1.00x(?)
ObjectiveCBridgeStubNSDataAppend 2407 2410 +0.1% 1.00x(?)
ArrayValueProp3 6 6 +0.0% 1.00x
ObjectiveCBridgeStubFromNSDate 3452 3458 +0.2% 1.00x(?)
ObjectiveCBridgeFromNSDictionaryAnyObjectToString 212015 213520 +0.7% 0.99x(?)
DictionaryBridge 3885 3938 +1.4% 0.99x(?)
ArrayAppendGenericStructs 1232 1239 +0.6% 0.99x(?)
ErrorHandling 2914 2958 +1.5% 0.99x(?)
SetExclusiveOr 2618 2633 +0.6% 0.99x(?)
NSDictionaryCastToSwift 6963 7042 +1.1% 0.99x(?)
StringBuilder 1332 1339 +0.5% 0.99x(?)
142 3012877 3031049 +0.6% 0.99x
PopFrontArray 1097 1120 +2.1% 0.98x(?)
ObjectiveCBridgeToNSSet 16176 16695 +3.2% 0.97x(?)
ObjectiveCBridgeStubToNSDate 12501 13175 +5.4% 0.95x(?)
**Unoptimized (Onone)**

Regression (1)

TEST OLD_MIN NEW_MIN DELTA (%) SPEEDUP
TypeFlood 171 195 +14.0% 0.88x(?)

Improvement (0)

No Changes (142)

TEST OLD_MIN NEW_MIN DELTA (%) SPEEDUP
ObjectiveCBridgeFromNSDictionaryAnyObjectToStringForced 146521 142789 -2.5% 1.03x(?)
ObjectiveCBridgeStubNSDateMutationRef 14406 14029 -2.6% 1.03x(?)
ObjectiveCBridgeFromNSArrayAnyObjectToString 123778 122094 -1.4% 1.01x(?)
Histogram 11762 11701 -0.5% 1.01x(?)
DictionaryBridge 4026 3993 -0.8% 1.01x(?)
ObjectiveCBridgeFromNSDictionaryAnyObject 212345 209566 -1.3% 1.01x(?)
ArrayAppendGenericStructs 1318 1300 -1.4% 1.01x(?)
ArrayAppendOptionals 1307 1299 -0.6% 1.01x(?)
OpenClose 434 428 -1.4% 1.01x(?)
ObjectiveCBridgeToNSArray 30797 30537 -0.8% 1.01x(?)
ObjectiveCBridgeStubURLAppendPath 232629 230317 -1.0% 1.01x(?)
142 5989005 5947186 -0.7% 1.01x
Phonebook 64517 63925 -0.9% 1.01x(?)
NSStringConversion 3027 3005 -0.7% 1.01x(?)
ArraySubscript 5641 5621 -0.3% 1.00x(?)
ObjectiveCBridgeToNSString 1100 1101 +0.1% 1.00x(?)
DictionarySwapOfObjects 20992 21017 +0.1% 1.00x(?)
StackPromo 127460 127051 -0.3% 1.00x(?)
PopFrontArray 24404 24389 -0.1% 1.00x(?)
RecursiveOwnedParameter 10843 10846 +0.0% 1.00x(?)
Integrate 366 366 +0.0% 1.00x
ObjectiveCBridgeFromNSDictionaryAnyObjectToString 219278 219671 +0.2% 1.00x(?)
ClassArrayGetter 1267 1266 -0.1% 1.00x(?)
Array2D 811575 812218 +0.1% 1.00x(?)
SortStrings 2767 2764 -0.1% 1.00x(?)
ObjectiveCBridgeFromNSDictionaryAnyObjectForced 7676 7666 -0.1% 1.00x(?)
ObjectiveCBridgeStubFromNSDateRef 4110 4113 +0.1% 1.00x(?)
MonteCarloPi 53720 53750 +0.1% 1.00x(?)
StringWithCString 154800 154877 +0.1% 1.00x(?)
ObjectiveCBridgeFromNSStringForced 3071 3067 -0.1% 1.00x(?)
Prims 13538 13565 +0.2% 1.00x(?)
SortLettersInPlace 2575 2574 -0.0% 1.00x(?)
DictionarySwap 7514 7520 +0.1% 1.00x(?)
Dictionary3OfObjects 2267 2263 -0.2% 1.00x(?)
RangeAssignment 13292 13303 +0.1% 1.00x(?)
StringHasPrefix 1682 1681 -0.1% 1.00x(?)
ByteSwap 9 9 +0.0% 1.00x
SuperChars 262199 261753 -0.2% 1.00x(?)
ArrayAppendLazyMap 245268 245866 +0.2% 1.00x(?)
XorLoop 20003 20003 +0.0% 1.00x
ArrayAppendReserved 3194 3195 +0.0% 1.00x(?)
StringInterpolation 15795 15848 +0.3% 1.00x(?)
ObjectiveCBridgeStubToNSString 1335 1334 -0.1% 1.00x(?)
ArrayAppendStrings 11845 11843 -0.0% 1.00x(?)
ObjectiveCBridgeStubFromNSString 815 812 -0.4% 1.00x(?)
ProtocolDispatch 5471 5473 +0.0% 1.00x(?)
ObjectiveCBridgeFromNSSetAnyObject 101230 101047 -0.2% 1.00x(?)
ArrayLiteral 1238 1235 -0.2% 1.00x(?)
ProtocolDispatch2 444 444 +0.0% 1.00x
Walsh 13121 13111 -0.1% 1.00x(?)
Dictionary3 1615 1623 +0.5% 1.00x(?)
StrComplexWalk 7866 7853 -0.2% 1.00x(?)
SetIntersect_OfObjects 13922 13917 -0.0% 1.00x(?)
Join 1456 1457 +0.1% 1.00x(?)
ArrayOfRef 9393 9392 -0.0% 1.00x(?)
ObjectiveCBridgeStubURLAppendPathRef 233872 234235 +0.2% 1.00x(?)
ObjectiveCBridgeToNSSet 16808 16787 -0.1% 1.00x(?)
ObjectiveCBridgeStubDateMutation 434 434 +0.0% 1.00x
NSError 684 682 -0.3% 1.00x(?)
DictionaryOfObjects 4876 4870 -0.1% 1.00x(?)
ObjectiveCBridgeStubToNSDateRef 3332 3345 +0.4% 1.00x(?)
PopFrontArrayGeneric 9723 9725 +0.0% 1.00x(?)
PopFrontUnsafePointer 242992 242980 -0.0% 1.00x(?)
StringEqualPointerComparison 9880 9851 -0.3% 1.00x(?)
CaptureProp 116363 116315 -0.0% 1.00x(?)
PolymorphicCalls 1142 1143 +0.1% 1.00x(?)
RC4 9366 9372 +0.1% 1.00x(?)
ObjectiveCBridgeStubToNSStringRef 155 155 +0.0% 1.00x
Calculator 967 967 +0.0% 1.00x
MapReduce 45076 45072 -0.0% 1.00x(?)
AngryPhonebook 3005 2997 -0.3% 1.00x(?)
IterateData 10542 10546 +0.0% 1.00x(?)
DictionaryLiteral 16553 16609 +0.3% 1.00x(?)
Hanoi 20325 20315 -0.1% 1.00x(?)
ArrayOfGenericPOD 3430 3429 -0.0% 1.00x(?)
DictionaryRemoveOfObjects 47117 47069 -0.1% 1.00x(?)
UTF8Decode 43522 43484 -0.1% 1.00x(?)
SortStringsUnicode 9276 9277 +0.0% 1.00x(?)
SetIsSubsetOf 2442 2444 +0.1% 1.00x(?)
Dictionary 2144 2143 -0.1% 1.00x(?)
NopDeinit 58110 58169 +0.1% 1.00x
ObjectiveCBridgeStubToArrayOfNSString 29714 29756 +0.1% 1.00x(?)
ObjectiveCBridgeFromNSArrayAnyObject 78686 78634 -0.1% 1.00x(?)
SetIntersect 15186 15161 -0.2% 1.00x(?)
ObjectiveCBridgeStubDataAppend 3340 3333 -0.2% 1.00x(?)
SetExclusiveOr 30665 30699 +0.1% 1.00x(?)
ObjectiveCBridgeFromNSSetAnyObjectToString 157419 157391 -0.0% 1.00x(?)
ObjectiveCBridgeStubNSDateRefAccess 1256 1255 -0.1% 1.00x(?)
StrToInt 5739 5738 -0.0% 1.00x(?)
ArrayInClass 3958 3955 -0.1% 1.00x(?)
ArrayOfGenericRef 10061 10073 +0.1% 1.00x(?)
StringHasSuffix 1751 1757 +0.3% 1.00x(?)
ObjectiveCBridgeStubDateAccess 1094 1095 +0.1% 1.00x(?)
Sim2DArray 14579 14584 +0.0% 1.00x(?)
SetExclusiveOr_OfObjects 47093 47074 -0.0% 1.00x(?)
ArrayAppendRepeatCol 216553 216362 -0.1% 1.00x(?)
MonteCarloE 108950 108965 +0.0% 1.00x(?)
SetUnion_OfObjects 34345 34365 +0.1% 1.00x(?)
StringHasSuffixUnicode 65342 65395 +0.1% 1.00x(?)
HashTest 5387 5390 +0.1% 1.00x(?)
SetIsSubsetOf_OfObjects 2210 2211 +0.1% 1.00x(?)
ArrayAppend 3440 3442 +0.1% 1.00x(?)
DictionaryRemove 17411 17398 -0.1% 1.00x(?)
StringHasPrefixUnicode 14945 14927 -0.1% 1.00x(?)
LinkedList 27517 27537 +0.1% 1.00x(?)
RGBHistogramOfObjects 93217 93333 +0.1% 1.00x(?)
RGBHistogram 44108 44149 +0.1% 1.00x(?)
ObjectiveCBridgeFromNSSetAnyObjectForced 7452 7458 +0.1% 1.00x(?)
ArrayAppendSequence 105038 105170 +0.1% 1.00x(?)
ArrayAppendArrayOfInt 641 640 -0.2% 1.00x(?)
ArrayOfPOD 2329 2328 -0.0% 1.00x(?)
SetUnion 18463 18460 -0.0% 1.00x(?)
Chars 5032 5037 +0.1% 1.00x(?)
ArrayValueProp2 3171 3163 -0.2% 1.00x(?)
BitCount 96 96 +0.0% 1.00x
AnyHashableWithAClass 78190 78179 -0.0% 1.00x(?)
SevenBoom 1508 1505 -0.2% 1.00x(?)
ObjectiveCBridgeFromNSArrayAnyObjectToStringForced 91233 91596 +0.4% 1.00x(?)
StringWalk 22100 22030 -0.3% 1.00x(?)
ArrayValueProp 2652 2653 +0.0% 1.00x(?)
ObjectiveCBridgeStubFromArrayOfNSString 59116 58893 -0.4% 1.00x(?)
ObjectiveCBridgeFromNSString 5152 5155 +0.1% 1.00x(?)
GlobalClass 0 0 +0.0% 1.00x
Memset 20647 20660 +0.1% 1.00x(?)
Dictionary2OfObjects 6264 6233 -0.5% 1.00x(?)
ArrayValueProp4 2997 3002 +0.2% 1.00x(?)
TwoSum 6619 6622 +0.1% 1.00x(?)
ObjectiveCBridgeStubNSDataAppend 2776 2772 -0.1% 1.00x(?)
ArrayValueProp3 3060 3060 +0.0% 1.00x
ObjectiveCBridgeStubFromNSDate 3802 3793 -0.2% 1.00x(?)
ObjectiveCBridgeStubToNSDate 14241 14326 +0.6% 0.99x(?)
ErrorHandling 3836 3873 +1.0% 0.99x(?)
ObjectiveCBridgeStubFromNSStringRef 164 165 +0.6% 0.99x
ObjectAllocation 564 567 +0.5% 0.99x(?)
ObjectiveCBridgeFromNSSetAnyObjectToStringForced 116619 117489 +0.8% 0.99x(?)
DeadArray 120172 121906 +1.4% 0.99x(?)
Dictionary2 4355 4430 +1.7% 0.98x(?)
NSDictionaryCastToSwift 8146 8299 +1.9% 0.98x(?)
StringBuilder 2713 2768 +2.0% 0.98x(?)
ObjectiveCBridgeFromNSArrayAnyObjectForced 10151 10487 +3.3% 0.97x(?)
StaticArray 34592 35638 +3.0% 0.97x(?)
ObjectiveCBridgeToNSDictionary 16698 17279 +3.5% 0.97x(?)
**Hardware Overview** Model Name: Mac mini Model Identifier: Macmini7,1 Processor Name: Intel Core i5 Processor Speed: 2.8 GHz Number of Processors: 1 Total Number of Cores: 2 L2 Cache (per Core): 256 KB L3 Cache: 3 MB Memory: 16 GB

@DougGregor
Copy link
Member Author

@swift-ci please smoke test and merge

@DougGregor
Copy link
Member Author

@swift-ci please smoke test Linux

@DougGregor DougGregor merged commit b5965f2 into swiftlang:master Nov 1, 2016
@DougGregor DougGregor deleted the devirtualize-default-generic-witness branch November 1, 2016 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants