This function is on the slow path (unfortunately I could not use the _fastPath intrinsic, which would be a better alternative to @inline(never)).
The effect is that it keeps the calling functions (Array.append) small and lets the inliner inline the calling functions.
This change fixes the performance degradation of Ary/Ary2:
Ary: +53 @ -O, +40% @ -Ounchecked
Ary2: +32% @ -O, +20% @ -Ounchecked
Other improvements/degradations:
QuickSort: +21% @ -Ounchecked
Chars: +9% @ -O
CaptureProp: -13% @ -O
InsertionSort: -12% @ -Ounchecked
SwiftStructuresBubbleSort: -11% @ -Ounchecked
Swift SVN r24554
Adding this complexity does not offer any significant improvements.
This reverts commit r24467.
Git commit: c17e2294e4e100bfc44efe792523c314a38cec47.
Swift SVN r24481
This fast path is only taken when the code is specialized.
Fixes <rdar://problem/19331717> Optimizer breaks Set<T> and Dictionary<K, V>
Swift SVN r24479
automaticallyNotifiesObserversForKey is now false for Array, Dictionary
and Set (since they can not be mutated).
Fixes rdar://problem/19404025
Swift SVN r24467
We found converting ints to floats at bounds caused it to overflow
without trapping. This was due to the construction of floats using
rounding (on x86 using an instruction dependent on the status register).
To fix this we check the bounds of the float with constants that are
known to be the last valid floating point numbers valid for conversion.
Fixes rdar://problem/18406402
Swift SVN r24459
We don't need the "print to stdout" family of functions to be fast
and prefer to reduce the binary size by not linking the printing code
(and all of its dependencies).
This reduces the SIL of the code of a file that contains 'println()' from
~4000** lines of SIL down to ~200.
**(depending on the assert configuration)
Swift SVN r24404
Change all the existing addressors to the unsafe variant.
Update the addressor mangling to include the variant.
The addressor and mutable-addressor may be any of the
variants, independent of the choice for the other.
SILGen and code synthesis for the new variants is still
untested.
Swift SVN r24387
This allows reflection clients a more detailed perspective on what precision values they are inspecting, and is largely meant to support improvements to the way Xcode represents floating point numbers in the playgrounds UI (rdar://19124310)
Swift SVN r24372
Set.description now prints its array literal form, and
Set.debugDescription prints its initializer form. Both print
the debugDescription of the members.
Set([1,2,3]).description = "[2, 3, 1]"
Set([1,2,3]).debugDescription = "Set([2, 3, 1])"
rdar://problem/19312961
Swift SVN r24306
The mandatory inlining of generic functions simplifies code and the
compiler omits these symbols now, so they could not be used in tests.
Swift SVN r24296
This patch marks almost all print-related functions as @inline(never), so that they are not inlined into user functions. This significantly reduces the size of produced SIL and has positive impact on the size of executables. More over, it speeds up compilation as less SIL code needs to be processed and optimized.
Only inlining of those functions is disabled. Specialization is still performed, so that e.g. println(myIntValue) is using the optimized specialised version.
The patch is reviewed by Dmitri.
Swift SVN r24285
This allows us to inline @transparent functions in cases like this:
@transparent
func partial<T, U>(x: T, f: (T) -> U) -> U {
return f(x)
}
func applyPartial<U>(x: Int32, f: (Int32) -> U) -> U {
return partial(x, f)
}
I had planned on enabling this same behavior in the performance inliner
first in order to be able to test the underlying functionality more
thoroughly, but I hit a blocking issue pretty quickly in type
lowering (rdar://problem/19387372).
Given that @transparent is not currently user-facing, it seems
reasonable to go ahead and enable this now and fix any new issues it
exposes since it should be easy to work around those issues by not using
@transparent.
There were lots of performance differences as a result of this change,
mostly positive. Below I list the 10 largest improvements for each of
-Onone, -O, and -Ounchecked, along with all regressions greater than
10%. I will be opening radars for these.
-Onone
---------------------------------------
ArrayOfPOD 104.200%
ArrayOfGenericPOD 40.700%
TwoSum 37.800%
EditDistance 35.600%
GenericStack 33.500%
SwiftStructuresStack 29.700%
SwiftStructuresInsertionSort 29.300%
Havlak 27.200%
NestedLoop 26.800%
Life 26.400%
SwiftStructuresTrie -15.500%
-O
---------------------------------------
TwoSum 46.200%
GenericStack 37.900%
SwiftStructuresStack 37.100%
Dictionary 30.200%
Forest 27.800%
NSDictionaryImplicitConversion 24.400%
Prims 23.500%
Dictionary2 19.600%
DollarFilter 17.00%
SwiftStructuresQueue 16.600%
NSStringConversion -22.600%
SwiftStructuresTrie -25.900%
PopFrontArray -44.100%
-Ounchecked
---------------------------------------
SwiftStructuresStack 38.900%
GenericStack 37.400%
NSDictionaryImplicitConversion 21.200%
TwoSum 20.500%
Histogram 16.600%
DollarFilter 15.900%
DollarFunction 13.600%
ArrayLiteral 12.900%
Forest 12.300%
Prims 10.300%
ImageProc -10.900%
InsertionSort -11.200%
StrToInt -11.800%
NBody -14.900%
SwiftStructuresTrie -29.900%
Swift SVN r24263
rdar://problem/17198298
- Allow 'static' in protocol property and func requirements, but not 'class'.
- Allow 'static' methods in classes - they are 'class final'.
- Only allow 'class' methods in classes (or extensions of classes)
- Remove now unneeded diagnostics related to finding 'static' in previously banned places.
- Update relevant diagnostics to make the new rules clear.
Swift SVN r24260
Previously the "as" keyword could either represent coercion or or forced
downcasting. This change separates the two notions. "as" now only means
type conversion, while the new "as!" operator is used to perform forced
downcasting. If a program uses "as" where "as!" is called for, we emit a
diagnostic and fixit.
Internally, this change removes the UnresolvedCheckedCastExpr class, in
favor of directly instantiating CoerceExpr when parsing the "as"
operator, and ForcedCheckedCastExpr when parsing the "as!" operator.
Swift SVN r24253
Dictionary could be double freed after bridging to ObjC due to a call to
takeRetainedValue(), causing a segfault. This was fixed by removing the
free call, as it was unnecessary.
Fixes rdar://problem/18544533
Swift SVN r24208
This reverts commit r24141, it broke tests:
Failing Tests (2):
Swift :: parser/parse_stdlib.sil
Swift :: stdlib/AssertDiagnostics.swift
Swift SVN r24147
Also, hide an initializer on String.Index that was unintentionally
public/visible by giving it an underscored keyword argument.
Testing comes next.
Swift SVN r24069
Also clean unused detritus and anacrhonisms from testing code.
Tests for the currently-implemented conversions were incomplete, but are
now done.
Swift SVN r24068