Commit Graph

21665 Commits

Author SHA1 Message Date
Dave Zarzycki
8fd6b3a4ab runtime: disable the malloc cache entirely for the simulator
Swift SVN r14396
2014-02-26 17:18:31 +00:00
Joe Groff
98d6fecc99 '.metatype' -> '.Type'
Also, reserve 'type' as a keyword for ensuing syntax changes.

Swift SVN r14375
2014-02-26 04:23:21 +00:00
Greg Parker
17628ee626 Disable swift allocation cache pending rdar://16168244.
Swift SVN r14366
2014-02-26 01:37:36 +00:00
Jordan Rose
90f90c7fdd [CMake] Clear the Clang module cache before building the ObjectiveC overlay.
This will catch almost all module cache errors during compiler / stdlib
development, at the cost of slowing down rebuilds of the overlay modules
a bit.

Swift SVN r14364
2014-02-26 01:12:19 +00:00
Dave Abrahams
aa97136232 [stdlib] Replace all uses of ~> with boilerplate
Swift SVN r14314
2014-02-24 21:08:07 +00:00
Dave Abrahams
28e67eb007 [stdlib] Backport edit to FixedPoint.gyb
r13988 made the change to the generated files, but not the source.

Swift SVN r14310
2014-02-24 19:50:28 +00:00
Dmitri Hrybenko
3da05e347d Change property accessor syntax to include braces
See release notes update for details.

rdar://15966905


Swift SVN r14271
2014-02-22 21:00:56 +00:00
Dave Zarzycki
058ab5a6a1 Runtime: Add assert.h
Swift SVN r14259
2014-02-22 14:31:28 +00:00
Doug Gregor
2d08827a8a Fix trivial build issues
Swift SVN r14241
2014-02-21 23:21:11 +00:00
Chris Lattner
c4d774fa88 unbreak the makefile build.
Swift SVN r14231
2014-02-21 21:52:40 +00:00
Dave Zarzycki
aebc28f7fe Runtime: silence a harmless warning
Swift SVN r14229
2014-02-21 20:37:22 +00:00
Dave Zarzycki
a85b2a3d78 Runtime: Rename Alloc.* to HeapObject.* (NFC)
Swift SVN r14228
2014-02-21 20:12:07 +00:00
Dave Zarzycki
d0696c60fc Runtime: Move heap logic to Heap.cpp (NFC)
Swift SVN r14227
2014-02-21 20:12:01 +00:00
Dave Zarzycki
b32a02a75f Runtime: wire up wrapper zone around the default zone
Swift SVN r14226
2014-02-21 20:11:48 +00:00
Joe Groff
56d4f3ef40 runtime: Feed strings back into Swift through a DaveA-certified interface.
Swift SVN r14209
2014-02-21 16:19:26 +00:00
Joe Groff
3c15aff85b Expose unsafeReflect to the stdlib.
A useful unsafe optimization for potential implementations of Mirror that have existing heap storage to share from the value, like for Array or Dictionary.

Swift SVN r14186
2014-02-21 00:09:32 +00:00
Joe Groff
67205668ae runtime: Implement tuple destructuring in the default mirror.
Not quite ready for prime-time. This leaks memory for want of a proper way to copy a C string into a Swift String.

Swift SVN r14168
2014-02-20 21:19:11 +00:00
Dave Abrahams
1bdf9d915d [stdlib] Make unique reference checking work
Think the scenarios through more carefully, create more reliable tests.
Fixes <rdar://problem/16105759> Too many retains for COW optimization

Swift SVN r14140
2014-02-20 11:14:09 +00:00
Joe Groff
73e564428f stdlib/runtime: Stub out a mechanism for introspecting value structure.
Define a "Mirror" protocol with methods for querying the number of children a structured value has, getting the name and mirror for each of those children, and a string and "IDE representation" of the value, as needed by playgrounds and by our planned generic printing facility.

In the runtime, define a "reflect" function that can provide a Mirror for any object, either using a "Reflectable" protocol conformance if available, or falling back to a magic implementation in the runtime that grovels the type metadata. Stub out a bare minimum default implementation.

Swift SVN r14139
2014-02-20 08:26:27 +00:00
Dave Zarzycki
f9b6b02b9b stdlib: remove SNaN generation completely
We'll add this back when we're ready.

Swift SVN r14130
2014-02-20 07:12:46 +00:00
Dave Zarzycki
092d420b83 stdlib: disable ability to generate SNaN
<rdar://problem/16091995> Signaling NaN doesn't work in i386

Swift SVN r14128
2014-02-20 07:02:43 +00:00
Dave Zarzycki
f7e815dfb4 stdlib: remove CountingSink
<rdar://problem/15634455> dead CountingSink in the stdlib

Swift SVN r14127
2014-02-20 06:51:22 +00:00
Dave Zarzycki
618b052674 Followup to r14097
We were bypassing the cache in an edge case.

Swift SVN r14125
2014-02-20 01:48:45 +00:00
Jordan Rose
6696fcb449 [PrintAsObjC] Rename stdlib/swift2objc/ to stdlib/PrintAsObjC/.
This contains the Objective-C header that's needed by -emit-objc-header.
Somehow this missed the rename sweep.

Swift SVN r14106
2014-02-19 22:36:34 +00:00
Dave Zarzycki
435a481bdd Runtime performance: avoid llvm::RoundUpToAlignment(size, mask + 1)
If we have a power-of-two mask, we don't need to bother with arbitrary
size alignment and the integer division fallout.

Swift SVN r14097
2014-02-19 21:09:57 +00:00
Dave Zarzycki
3f567c8d55 Runtime+Performance: always use our fast malloc cache
Please never call malloc/calloc/free directly in the stdlib/runtime now.

<rdar://problem/16104269> Fix 16023119 the right way -- make all runtime entry points use the malloc cache

Swift SVN r14091
2014-02-19 18:51:40 +00:00
Joe Groff
614bd7f23d Runtime: We never use the small allocation cache yet, so always call down to 'free' in swift_slowDealloc and swift_slowRawDealloc.
We were leaking memory in cases where we happened to match one of the allocation cache ranges. Fixes <rdar://problem/16023119>.

Swift SVN r14064
2014-02-19 00:12:13 +00:00
Joe Groff
3e0c1cebcf Runtime: Update the 'inline storage' flag properly for single-payload enums.
It cannot be simply inherited from the payload value witness table; it needs to be recalculated for the new type's size.

Swift SVN r14060
2014-02-18 23:37:24 +00:00
John McCall
26c076832b Update for stdlib name change.
Swift SVN r14010
2014-02-17 22:20:25 +00:00
Jordan Rose
0b2541b58f Rename the standard library to "Swift" (instead of "swift")
This is more in line with all other modules currently on our system.
If/when we get our final name for the language, we're at least now set
up to rename the library without /too/ much trouble. (This is mostly just
a lot of searching for "import swift", "swift.", "'swift'", and '"swift"'.
The compiler itself is pretty much just using STDLIB_NAME consistently now,
per r13758.)

<rdar://problem/15972383>

Swift SVN r14001
2014-02-17 19:30:47 +00:00
Dave Abrahams
67734b1835 [stdlib] CollectionOfOne<T>
A simple collection of one element

Swift SVN r13976
2014-02-17 04:56:11 +00:00
Dave Abrahams
ea242f2238 [stdlib] Add Bit type
Will serve as an IndexType for CollectionOfOne<T>

Open Question: should this become a full-fledged Int1 type, generated by
FixedPoint.gyb?

Swift SVN r13974
2014-02-17 04:23:51 +00:00
Dave Abrahams
46240b41d2 [stdlib] add SingleGenerator
Should be useful for T? and SequenceOfOne<T>

Swift SVN r13968
2014-02-16 20:56:30 +00:00
Dave Abrahams
1322c08fd6 [stdlib] NumericOperations.toIntMax()
Numbers should be explicitly convertible to IntMax, so they can be
explicitly pared down to Int, in which we're supposed to traffic.

Swift SVN r13961
2014-02-16 15:34:35 +00:00
Dave Abrahams
353b5739fd [stdlib] FloatingPoint.gyb: 1-line regeneration command
Swift SVN r13954
2014-02-16 08:35:05 +00:00
Dave Abrahams
fe7e78227f [stdlib] FixedPoint.gyb: one-line regeneration command
Regeneration should be integrated into the build system, but until then,
let's make it foolproof to do manually.

Swift SVN r13953
2014-02-16 08:35:04 +00:00
Dave Abrahams
415bd58787 [stdlib] Add IntMax and UIntMax
Sometimes you just need to normalize to the widest integer
type (especially in generic code), and who knows; someday we may get
Int128 back.

Swift SVN r13950
2014-02-16 08:35:01 +00:00
Dave Abrahams
8000560122 [stdlib] FixedPoint.gyb: tiny simplification
Swift SVN r13949
2014-02-16 08:35:00 +00:00
Dave Abrahams
0a7c28b9ef [stdlib] Factor out Index.swift
Indices are substantial enough that they deserve their own file

Swift SVN r13948
2014-02-16 08:33:09 +00:00
Joe Groff
99ad50b762 SIL: Lower @objc_blocks with the correct calling and ownership conventions.
Force @objc_blocks to use the @cc(cdecl) calling convention, so that calling them undergoes bridging conversions in SILGen, and give them the correct ownership conventions so that the callee, arguments, and result are passed +0. This unfortunately ruins our ability to verify bridge_to_block instructions at all, but bridge_to_block is a hack anyway, and this is a necessary prerequisite to actually being able to call blocks in IRGen.

Swift SVN r13923
2014-02-14 22:08:09 +00:00
Dmitri Hrybenko
571c9b3c5e Split 'type' keyword into 'static' and 'class'
rdar://15911697


Swift SVN r13908
2014-02-14 14:50:32 +00:00
Joe Groff
09d7d5e66d runtime: Handle tuples in printAny.
Because we can.

Swift SVN r13903
2014-02-14 06:54:11 +00:00
Joe Groff
3fded63cac stdlib: Proof-of-concept 'print' implementation for an arbitrary Array.
Mock up a naive Printable protocol, and do some dirty tricks in the runtime to implement a 'printAny' function that uses swift_conformsToProtocol to look up a conformance to Printable if the type has one, or falls back to a dumb opaque printing if it doesn't. Use this to make Array<T> Printable in some way or another for all T.

Swift SVN r13902
2014-02-14 05:15:33 +00:00
Joe Groff
802df0bdf3 Runtime: Do awful things to implement "swift_conformsToProtocol" for Swift protocols.
Given our constraints for 1.0, we can actually sort-of look up protocol conformances just by dlsym'ing the symbol for their protocol witness table, since we won't be implementing runtime witness table instantiation or private conformances anytime soon. To make this work for generic types, distastefully regress our mangling for protocol conformances by assuming all generic conformances are completely general to the unbound generic type and leave the generic parameters out of the mangling.

Swift SVN r13901
2014-02-14 05:15:32 +00:00
Dave Abrahams
244677e842 [stdlib] Give Array's buffer its own file
Swift SVN r13894
2014-02-14 01:50:55 +00:00
Jordan Rose
0f54c34053 Use -resource-dir for iOS builds and tests instead of -I.
As part of this, have the standard library target be responsible for
symlinking Clang's headers into the resource directory, instead of the
compiler target. This makes sure the headers show up in all copies of
the build directory.

This brings our iOS testing closer to what Xcode will do, which will
hopefully avoid issues like <rdar://problem/16052579>.

Swift SVN r13890
2014-02-14 01:27:16 +00:00
John McCall
0fbad9cb2b Fix Makefile build of standard library.
Swift SVN r13881
2014-02-14 00:09:54 +00:00
Dave Zarzycki
9ba8eba87c stdlib+runtime: skeleton of "NSSwiftString" heap storage
This is gross, and about to get very gross -- but very fast.

Swift SVN r13861
2014-02-13 07:09:51 +00:00
Chris Lattner
0b70cddef1 rename various 'val' parameters to 'value' in the stdlib.
Swift SVN r13817
2014-02-12 06:08:18 +00:00
Dave Zarzycki
648080994b Runtime: drop calloc for malloc
This was supposed to be done a long time ago after DI landed, but a
weird bug in our getopt wrapper blocked this. That code is gone now, so
let's make the switch.

Swift SVN r13786
2014-02-11 18:26:05 +00:00