Commit Graph

21492 Commits

Author SHA1 Message Date
Dmitri Hrybenko
60cf5d3d1b SwiftIntTypes.py: remove transitional '_new' suffix from a function name
Swift SVN r21579
2014-08-29 15:38:22 +00:00
Dmitri Hrybenko
cf1d5722a9 stdlib/FixedPoint: precondition for shifts: use a SIL-compile-time
constant instead of an expression that will be folded only by LLVM

Swift SVN r21576
2014-08-29 15:10:05 +00:00
Dmitri Hrybenko
4ecfc2b244 stdlib/FixedPoint: fix strange indentation
Swift SVN r21574
2014-08-29 15:09:59 +00:00
Dmitri Hrybenko
cb9e5c2c86 stdlib: use simpler interface to iterate over integer types
Swift SVN r21573
2014-08-29 14:32:46 +00:00
Dmitri Hrybenko
c5181c2d65 stdlib/FixedPoint: fix hash computation for [U]Int64 on 32-bit platforms
It used to trap if the value of [U]Int64 was outside the Int32 range.

rdar://18113807

Swift SVN r21572
2014-08-29 13:48:32 +00:00
Dmitri Hrybenko
14899abdf5 stdlib/FixedPoint: define the same set of 'truncatingBitPattern'
initializers on all platforms

rdar://18167806

Swift SVN r21570
2014-08-29 10:32:33 +00:00
Dmitri Hrybenko
985def47c9 stdlib: improve performance of string appending
CaptureProp ,  -21.8%
             HeapSort ,   12.7%
            ImageProc ,  -25.6%
               StrCat ,   92.6%
       StrComplexWalk ,   11.1%
             StrToInt ,   16.6%
  StringInterpolation ,   21.6%

Regression in CaptureProp is due to some interference of the harness.  When the
code is extracted into a separate file, there is no difference.

Regression in ImageProc is caused by unconditional construction of a string for
CheckResults()

rdar://18119872

Swift SVN r21535
2014-08-28 16:48:39 +00:00
Dmitri Hrybenko
4acc8a3e4b stdlib: remove redundant parens
Swift SVN r21529
2014-08-28 14:10:07 +00:00
Roman Levenstein
97014172b7 [sil-combine] String literal concatenation optimization. Constant-fold concatenation of string literals known at compile-time.
Addresses rdar://17033696.

Swift SVN r21526
2014-08-28 11:33:21 +00:00
Dmitri Hrybenko
8e4c76f4f6 stdlib/StringBuffer: update doc comment
Swift SVN r21523
2014-08-28 10:03:02 +00:00
Dave Abrahams
a45cb59747 [stdlib] Eliminate some gratuitous @objc labels
Swift SVN r21511
2014-08-28 02:03:31 +00:00
Dave Abrahams
18dac28aea [stdlib] Eliminate HeapBufferStorageBase
It's just needless complexity

Swift SVN r21508
2014-08-28 01:41:43 +00:00
John McCall
c1b03784df Instead of passing type metadata to swift_initClassMetadata,
pass the size and alignment of each field.  Take advantage
of this to pass a constant size and alignment when
possible.

This avoids the need to recursively find type metadata for
every field type, allowing generic recursively-structured
classes to be built.  There are a number of more complicated
cases that this approach isn't good enough for, but this
is good enough for now to fix rdar://18067671.

Also make an effort to properly support generic subclasses
of Objective-C classes.

Swift SVN r21506
2014-08-28 01:27:53 +00:00
Dave Abrahams
082c396cfe [stdlib] String.replaceRange: fix value semantics
Fixes <rdar://problem/18114265> Swift Compiler Optimizations for Strings causing incorrect behaviour

Swift SVN r21487
2014-08-27 19:24:55 +00:00
Dmitri Hrybenko
61ef07732f stdlib/FixedPoint: add IntXX(truncatingBitPattern:) initializers
rdar://18101336


Swift SVN r21481
2014-08-27 10:04:33 +00:00
Dave Abrahams
0085b94509 [stdlib] AnyObject wrapper for bridging purposes
As part of the evolution toward a one-word array layout, create a type
that can be used to efficiently store Cocoa or Native class instances
and discriminate between them.

Swift SVN r21469
2014-08-27 00:04:25 +00:00
Dave Abrahams
b402c6761c [stdlib] Comments and clarification
The code was too dense; this reorg makes it easier

Swift SVN r21463
2014-08-26 19:59:04 +00:00
Dave Abrahams
349e730c07 [stdlib] Add a missing mode string in a .gyb file
Swift SVN r21462
2014-08-26 19:59:04 +00:00
Dmitri Hrybenko
001c00fb44 stdlib/Dictionary: add a doc comment for _DictionaryBuilder
Swift SVN r21456
2014-08-26 11:33:06 +00:00
Enrico Granata
b3f6219ebe Add a very rough mutual exclusion mechanism to prevent a UIView from trying to provide its QuickLook object recursively. The same logic used for NSView is also used here basically verbatim. This is because in playgrounds, you can get a view to log itself as part of its drawRect method due to the way we defined our instrumentation. This very simple mechanism only works because drawing can only happen on the main thread - otherwise, we'd need something smarter than an NSSet of UIView pointers. Fixes rdar://17895769
Swift SVN r21444
2014-08-25 21:11:18 +00:00
Dave Abrahams
ea73121217 [stdlib] Make a method final
Swift SVN r21441
2014-08-25 16:50:29 +00:00
Dmitri Hrybenko
1a5e9b486c Restore building SpriteKit overlay that I accidentally disabled
Swift SVN r21438
2014-08-25 16:12:33 +00:00
Dmitri Hrybenko
203cbaa5df stdlib: remove unused GYB code
Swift SVN r21437
2014-08-25 14:46:14 +00:00
Dmitri Hrybenko
7c943d5377 stdlib: remove migration aids for IntXX.asSigned(), IntXX.asUnsigned()
Swift SVN r21436
2014-08-25 14:02:36 +00:00
Dmitri Hrybenko
44bf1a81a6 stdlib/Printing: print floating point numbers with appropriate precesion for
the type

Printing Float32 with %0.15g not only wastes screen space, but also causes
confusion for users, and pretends that a Float32 has more precision than it
actually does.

rdar://18043123


Swift SVN r21435
2014-08-25 13:56:38 +00:00
Dmitri Hrybenko
ea48185358 stdlib: don't silently truncate Float80 literals
We used to first truncate them to Float64, and then construct a Float80.

Swift SVN r21433
2014-08-25 13:21:54 +00:00
Dmitri Hrybenko
3e5154b23a stdlib: fix typo in private API name
Swift SVN r21431
2014-08-23 18:21:36 +00:00
Andrew Trick
125846a213 Consider capacity >= mincapacity the _fastPath in requestUniqueMutableBackingBuffer.
This should allow us to better optimize repeated push/pop benchmarks.

I didn't notice a performance change at the time I did this. I'm just
putting it in as a hopefully obvious drive-by fix.

Swift SVN r21429
2014-08-23 01:31:07 +00:00
Dave Abrahams
6c07fb4ad1 [stdlib] Revert UnsafePointer casting change
The syntax being reverted added busywork and noise to the common case
where you want to say "I have the right address, but the wrong type,"
without adding any real safety.

Also it eliminated the ability to write UnsafePointer<T>(otherPointer),
without adding ".self" to T.  Overall, it was not a win.

This reverts commits r21324 and r21342

Swift SVN r21424
2014-08-22 21:53:12 +00:00
Arnold Schwaighofer
9a7b869faf Revert "Add @effects(readnone) to _swift_isClassOrObjCExistential"
We have not defined whether readnone would potentially allow it to be
speculatively executed which is not desired semantics for
_swift_isClassOrObjCExistential because the metadata might not have been loaded
at the speculative point. Since we don't need the readnone property on this
function after the Builtin.canBeClass change for performance remove it for now.

This reverts commit r21330.

Swift SVN r21422
2014-08-22 21:34:33 +00:00
Dave Abrahams
f3ac09497d Store ASCII string literals as UTF8
Fixes <rdar://problem/16740011> ASCII string literals produce UTF16
Strings

Swift SVN r21419
2014-08-22 19:05:15 +00:00
Dmitri Hrybenko
2124857300 Use withUnsafeMutableBufferPointer when mutating the buffer instead of
getting an immutable buffer and casting it

Swift SVN r21415
2014-08-22 17:57:58 +00:00
Nadav Rotem
9a495b56e5 Inline _arrayReplace into replaceRange.
The buffer argument of _arrayReplace was a protocol and it forced
all of the calls to that member to be virtually dispatched and generic.

This boosts DeltaBlue by 2X.

Swift SVN r21405
2014-08-22 06:56:22 +00:00
Greg Parker
121e65cdfc [test] No seriously, don't stop StdlibUnittest when the debugger interrupts select().
Swift SVN r21404
2014-08-22 04:56:18 +00:00
Doug Gregor
e00aaadf48 Allow dynamic casting of foreign metatypes.
Another part of CF casting support, <rdar://problem/18088474>.


Swift SVN r21402
2014-08-22 04:47:11 +00:00
Greg Parker
afb85f012a [test] Don't stop StdlibUnittest when the debugger interrupts select().
Swift SVN r21401
2014-08-22 04:36:53 +00:00
Nadav Rotem
07f84793f3 Zap the string compare API.
We used this API for benchmarking and we don't need it anymore.

Swift SVN r21398
2014-08-22 00:53:27 +00:00
Dmitri Hrybenko
7db1d04f2c stdlib: add a comment for using modular arithmetic
Swift SVN r21397
2014-08-22 00:48:02 +00:00
Nadav Rotem
5319d8d220 Remove the overflow check because the variables are indices that must point to valid elements of the array of chars.
Swift SVN r21395
2014-08-22 00:19:58 +00:00
Doug Gregor
61ee5f7529 Allow dynamic casts between foreign classes and other classes.
These casts always succeed, because we don't have any way to check
them (yet). Part of <rdar://problem/18088474>.

Swift SVN r21386
2014-08-21 22:54:10 +00:00
Enrico Granata
4a45129d45 Remove the workaround for the malformed fieldNames field in JITed code. Now that the JIT is doing the right thing again, we can restore full reflection support. Fixes rdar://18007839
Swift SVN r21374
2014-08-21 21:32:48 +00:00
Dave Abrahams
4b2ccff3a4 [stdlib] Replace assert(false) with compile error
Unsupported architectures will cause a failure to compile rather than
some kind of runtime trap.  In particular, assert() should never be used
in the standard library; we have _sanityCheck for that purpose.

Swift SVN r21373
2014-08-21 21:06:20 +00:00
Dmitri Hrybenko
18bbf0dfef stdlib/Dictionary: implement fast enumartion for NSEnumerator of
bridged Swift.Dictionary; this allows us to autorelease less.

rdar://17944094


Swift SVN r21372
2014-08-21 20:28:28 +00:00
Doug Gregor
dde9485f08 Fix embarrassing bug in -_cfTypeID. Thanks, Joe
Swift SVN r21369
2014-08-21 18:13:48 +00:00
Dmitri Hrybenko
9404f1c055 Dictionary: in fast enumeration, don't autorelease objects that Dictionary has
a strong reference to.

rdar://17944094


Swift SVN r21368
2014-08-21 18:05:06 +00:00
Doug Gregor
0f3d1062aa Implement -_cfTypeID on SwiftObject.
This allows us to use CFGetTypeID() on a Swift-native class. This is
the simplest part of <rdar://problem/18088474>.

Swift SVN r21367
2014-08-21 17:59:31 +00:00
Dmitri Hrybenko
f1c3d879ef StdlibUnittest: add setUp and tearDown functions, which are executed before and
after every test


Swift SVN r21362
2014-08-21 16:56:49 +00:00
Doug Gregor
d603db43f2 Make factory methods unavailable when there is already a corresponding initializer.
Depending on visitation order, we would occasionally leave the factory
method available if we had completely imported the initializer
first. Fixes <rdar://problem/17261609>.

Swift SVN r21361
2014-08-21 16:45:17 +00:00
Doug Gregor
d1c76de9e0 Unbreak iOS build after r21324.
Swift SVN r21342
2014-08-21 05:07:07 +00:00
Arnold Schwaighofer
16e41ada77 Make Builtin.canBeClass return a tri-state
Replace the true/maybe state that Builtin.canBeClass was returning by a
tri-state (yes, no, maybe) allowing the optimizer to use the definite no
answer.  This removes the need of the sizeof check that we had in
isClassOrObjCExistential. It also removes the need to CSE this function since
in most cases we will be able to instantiate canBeClass to yes or no (vs maybe)
at compile time.

benchmark``````````````,``baserun0``,``optrun2``,``delta,``speedup
ClassArrayGetter```````,``988.00````,``337.00```,``644.00``,````````191.7%
DeltaBlue``````````````,``2429.00```,``1927.00``,``460.00``,````````23.9%
Dictionary`````````````,``1374.00```,``1231.00``,``129.00``,````````10.9%
Havlak`````````````````,``1079.00```,``911.00```,``124.00``,````````13.7%
Rectangles`````````````,``924.00````,``541.00```,``379.00``,````````70.1%

radar://16823238

Swift SVN r21331
2014-08-21 00:55:40 +00:00