Commit Graph

1309 Commits

Author SHA1 Message Date
Dave Abrahams
5c33278e63 [stdlib] Add ManagedBufferPointer
A revamped version of HeapBuffer that doesn't allow null buffer
references.  Something like this is needed for killing the null array
state.

Swift SVN r22683
2014-10-11 01:10:38 +00:00
Erik Eckstein
a69fc9833e Fix wrong argument labels in ARM specific code in stdlib.
This was missing in the previous commit r22657.



Swift SVN r22661
2014-10-10 12:32:54 +00:00
Erik Eckstein
d0697f2ac1 Make internal stdlib functions public, which are called from the stdlib tests.
And make sure that all those public identifiers are preceeded with underscores.

I marked these public-modifiers with "// @testable" to document why they are public.
If some day we have a @testable attribute it should be used instead of those public-modifiers.

Again, this is needed for enabling dead internal function elimination in the stdlib.



Swift SVN r22657
2014-10-10 09:45:10 +00:00
Erik Eckstein
3d8008117f Make compiler intrinsic _getBool public.
Again, this is needed for enabling dead internal function elimination in the stdlib.



Swift SVN r22656
2014-10-10 09:35:32 +00:00
Dave Abrahams
2d850421bc [stdlib] Internalize HeapBuffer[Storage], OnHeap
They were never really useful to users, because their APIs were
insufficiently public.  They have been replaced with a single class,
ManagedBuffer<Value,Element>, which is really designed for user
consumption.

Swift SVN r22636
2014-10-09 21:45:44 +00:00
Dmitri Hrybenko
7ca765f720 stdlib/Character: fix code style
Swift SVN r22632
2014-10-09 20:17:58 +00:00
Dave Abrahams
57367877c4 [stdlib] Make 'Character' a struct
It used to be a public enum, which unnecessarily exposed structure that
was intended to be private implementation detail.  This change also has
the benefit that converting a String to a Character will avoid
allocating memory in many more cases.

Swift SVN r22629
2014-10-09 18:25:25 +00:00
Dave Abrahams
1f38b125f4 [stdlib] Fix typos in sanity check strings
Swift SVN r22627
2014-10-09 18:25:24 +00:00
Dave Abrahams
587c818c5b [stdlib] Use addressors in HeapBuffer
Swift SVN r22620
2014-10-09 13:30:02 +00:00
Dmitri Hrybenko
b350841f72 stdlib: remove old migration aid for ConstUnsafePointer
Swift SVN r22599
2014-10-08 08:34:14 +00:00
Dave Abrahams
74e27aaab1 [stdlib] uniqueness checking for users
Make unique reference checking available to users, making ManagedBuffer
a complete facility for building COW value types.  Also rationalize the
way we name and organize the runtime primitives we ultimately call.

Swift SVN r22594
2014-10-08 04:48:52 +00:00
Doug Gregor
ef3ff24439 CMake: don't use target_link_libraries on a "target" library.
Fixes regression in the SDK variant build that was introduced by r22527.

Swift SVN r22583
2014-10-07 23:04:34 +00:00
Dave Abrahams
e4d8ea49e4 [stdlib] Add a FIXME
Swift SVN r22579
2014-10-07 22:15:09 +00:00
Dave Abrahams
cc9bc0c274 [stdlib] Kill _swift_isUniquelyReferenced @asmname
Swift SVN r22576
2014-10-07 21:40:48 +00:00
Dave Abrahams
83eec23968 [stdlib] Revert "Gyb ManagedBuffer..."
This reverts r22541.  It turns out that because of the type-punning we
need in order to handle the canonical empty array buffer in Array<Int>
and Array<SomeClass>, calls through methods that could be
dynamically-dispatched (i.e. methods of classes) can't be used to access
an array buffer.  So, for arrays, we need to keep the HeapBuffer
strategy wherein a struct manager object does all the address
calculations.

ManagedBuffer is still a useful tool for users though, and it fills the
role that HeapBuffer was intended to serve for them better than
HeapBuffer itself does, because it is simpler and more type-safe.

Swift SVN r22573
2014-10-07 21:40:43 +00:00
Graham Batty
a7a032d4a6 Temporarily undo no-whole-archive change.
This change breaks things and will probably continue breaking them
until the standard library and code generation is more functional
on linux.

Leaving in a TODO to turn it back on later.

Swift SVN r22572
2014-10-07 21:26:25 +00:00
Dave Abrahams
add753905b [stdlib] Use a lifetime-managed "with" construct
...instead of an internal API that releases an UnsafeBufferPointer into the wild.

Swift SVN r22561
2014-10-07 01:08:35 +00:00
Dave Abrahams
41fe3896d8 [stdlib] Synchronization-free empty array buffer
Now that <rdar://problem/18540783> is fixed, we can stop allocating the
empty array buffer dynamically and go back to using the one that is
statically laid out in GlobalObjects.cpp, thereby avoiding the
atomic instructions required to make it threadsafe.

Swift SVN r22545
2014-10-06 18:40:06 +00:00
Dave Abrahams
ab045d95af [stdlib] Tiny formatting fix
Swift SVN r22544
2014-10-06 18:40:06 +00:00
Dave Abrahams
d669b8fd56 [stdlib] Always inline _isClassOrObjCExistential
Swift SVN r22543
2014-10-06 18:40:05 +00:00
Dave Abrahams
08ed3e556c [stdlib] Use addressor for ManagedBuffer
Swift SVN r22542
2014-10-06 18:40:05 +00:00
Dave Abrahams
01f6f811b5 [stdlib] Gyb ManagedBuffer for Array storage
Swift SVN r22541
2014-10-06 18:40:04 +00:00
Dmitri Hrybenko
08f74103d8 stdlib: fix coding style
Swift SVN r22535
2014-10-06 08:17:34 +00:00
Graham Batty
22c7a7569f Don't do foundations or objc linking on linux.
Swift SVN r22527
2014-10-05 20:10:57 +00:00
Dave Abrahams
eac8ca27f9 [stdlib] Use a universal empty array buffer
NFC, and no significant performance change expected.  This is part one
of a move to eliminate nil checks from the array implementation.

Swift SVN r22526
2014-10-05 17:55:11 +00:00
Joe Groff
cac5807ae2 SILGen: Emit "main" as a SIL function.
Eliminate the intermediate top_level_code function. Now that SIL is expressive enough to express a "main" function, there's no reason for it, and this eliminates a bunch of mystery code in IRGen to thunk from main to top_level_code by reaching for hardcoded symbol names. Demystify the special code for setting up C_ARGC and C_ARGV by having SILGen look for a transparent "_didEnterMain" hook in the stdlib and emit a call to it.

Swift SVN r22525
2014-10-05 04:13:24 +00:00
Dave Abrahams
c0f4b11b95 [stdlib] Don't expose uninitialized memory
...at least, not without the word "unsafe."  ManagedBuffer's create()
function takes a closure that creates an initial value for its "value"
property (which is technically computed but effectively stored).  Before
this change, the closure had access to that property before it was
initialized.  Now you can still get there, but you have to go through
"withUnsafeMutablePointer*" methods.

Swift SVN r22501
2014-10-03 21:30:00 +00:00
Dave Abrahams
65ec2cdb00 [stdlib] Minor ManagedBuffer cleanups
In preparation for gyb'ing; we'll need to inject different base classes
so we can use this for Array et. al.

Swift SVN r22500
2014-10-03 21:29:59 +00:00
Dave Abrahams
b740ad0df9 Revert "[stdlib] Use a universal empty array buffer"
This reverts commit r22495, because it wroke havoc with SIL and the perf
test suite somehow.

Swift SVN r22499
2014-10-03 18:52:11 +00:00
Dave Abrahams
f2f068c3dc [stdlib] Use a universal empty array buffer
NFC, and no significant performance change expected.  This is part one
of a move to eliminate nil checks from the array implementation.

Swift SVN r22495
2014-10-03 16:01:50 +00:00
Dmitri Hrybenko
b8186229d0 stdlib: remove an invalid cast in Character implementation
rdar://18151953

Swift SVN r22492
2014-10-03 15:14:42 +00:00
Erik Eckstein
60dcb9a435 Make compiler intrinsics public (part 2).
With the changed SILLinkage and dead function removal of internal functions this is necessary.



Swift SVN r22490
2014-10-03 13:58:50 +00:00
Arnold Schwaighofer
c1eefb1dad Reapply "stdlib: Remove dead semantic Array._setElement function
Also remove helper functions."

With fixes.

Swift SVN r22479
2014-10-02 20:26:32 +00:00
Arnold Schwaighofer
2bd116c20b Revert "stdlib: Remove dead semantic Array._setElement function"
This reverts r22468. Because it breaks the build.

Swift SVN r22469
2014-10-02 18:46:24 +00:00
Arnold Schwaighofer
cfd4a0902d stdlib: Remove dead semantic Array._setElement function
Also remove helper functions.

Swift SVN r22468
2014-10-02 18:44:31 +00:00
Erik Eckstein
48e4c951e0 Remove dead arrays which are constrcuted with _allocateUninitialized
This fixes the performance regressions in Richards and some other benchmarks.



Swift SVN r22465
2014-10-02 14:08:49 +00:00
Erik Eckstein
10133eb6d7 Fix wrong effects attribute for Dictionary.init()
This bug caused a crash in the Dictionary benchmark when compiled with -Ounchecked.
The problem was the CSE moved the Dictionary.init() over a store to the argument's
array buffer.



Swift SVN r22464
2014-10-02 11:45:47 +00:00
Dave Abrahams
1ba2cbcfe6 [stdlib] explanatory comment
Swift SVN r22441
2014-10-01 21:12:45 +00:00
Dave Abrahams
43deddf8ac [stdlib] Move ManagedBuffer prototype into stdlib
...in preparation to use it in _[Contiguous]ArrayBuffer

Swift SVN r22440
2014-10-01 21:12:43 +00:00
Arnold Schwaighofer
b6f28bede1 ArraySemantics: Teach array semantics about getting the address of an array element
rdar://18517410

Swift SVN r22439
2014-10-01 21:08:22 +00:00
Erik Eckstein
cd4b943897 Don't call reserveCapacity if constructing an empty uninitalized array.
This speeds up empty array literals and fixes the performance regression in the Havlak benchmark.
See <rdar://problem/18480488> PerfReg: Havlak - Megaclang - r353047-r353195 - 3x



Swift SVN r22427
2014-10-01 14:52:25 +00:00
John McCall
8541ffd006 Convert UnsafePointer's memory property and
subscript operator to be addressed.

Swift SVN r22424
2014-10-01 07:09:18 +00:00
Dmitri Hrybenko
50c99099ec Remove redundant semicolon
Swift SVN r22422
2014-10-01 06:31:25 +00:00
John McCall
1fa4f422ba Use mutable addressors for Array, now that doing so
doesn't prevent us from using a getter for immutable
accesses.

rdar://17270560

Swift SVN r22421
2014-10-01 05:20:43 +00:00
Dave Abrahams
c93f32a4b3 [stdlib] Eliminate needless intermediate class
Swift SVN r22415
2014-09-30 23:43:25 +00:00
Dave Abrahams
156020de19 [stdlib] Rename 'countElements' => 'count'
The name was not only long and unwieldy, but inconsistent with our
conscious decision to avoid the use of "elements" in APIs as mostly
redundant.

Swift SVN r22408
2014-09-30 22:00:26 +00:00
Dave Abrahams
b05f1ad720 [stdlib] Comments for _getBridgedUnsafeBuffer
Also dropped an unused typealias.

Swift SVN r22407
2014-09-30 21:33:48 +00:00
Dave Abrahams
c8ecf6649d [stdlib] cross-reference radar in FIXME comment
Swift SVN r22405
2014-09-30 21:30:28 +00:00
Dave Abrahams
7f0439b90a [stdlib] Disable one more mixed-sign case
Also update release notes

Swift SVN r22403
2014-09-30 21:25:03 +00:00
Dave Abrahams
41359fb128 [stdlib] Disallow mixed-sign arithmetic
It was unintentionally possible to add an Int to any
UnsignedIntegerType.  Use an intentional ambiguity to prevent that at
compile-time.

Swift SVN r22402
2014-09-30 20:21:01 +00:00