Commit Graph

1397 Commits

Author SHA1 Message Date
Dave Abrahams
079821c8cc [stdlib] Start generating actual (new) Array types
Swift SVN r15769
2014-04-02 02:47:38 +00:00
Dave Abrahams
004998e63e [stdlib] Move SliceBuffer into its own file
Swift SVN r15766
2014-04-02 02:47:34 +00:00
Dave Abrahams
800cba5125 [stdlib] Bring most of ArrayType into the stdlib
The ArrayType protocol is developed for NewArray is a good basis for
what we want, but the ability to create arrays without value semantics
is adding complexity but questionable value.  It isn't clear that we can
usefully expose a type called SharedArray<T>, even internally, if it
ceases to be truly shared when one copy grows, and therefore has its
buffer reallocated. Therefore, leave the NewArray test with a
ArrayType2, a refinement of ArrayType, that adds the ability to report
on its value semantics.

If we really want the optimizations that can be had in a large-scale
mutation by first unique'ing the array and making mutations in-place
thereafter, we can fall back to operating on NativeArrayBuffer<T>
directly.

Swift SVN r15673
2014-03-31 08:42:55 +00:00
Michael Gottesman
c98c4d54b1 Move Benchmark.swift out of the stdlib now that we can deserialize from the stdlib.
rdar://15797364.

Swift SVN r15636
2014-03-29 22:19:34 +00:00
Dave Abrahams
9ef1ba13c0 [stdlib] Rename file ArrayBridge => ArrayCore
Swift SVN r15618
2014-03-29 10:43:45 +00:00
Dave Abrahams
bfc6cfa5b6 [stdlib] Give Array bridging a home of its own
Also create a simple NSSwiftArray class that DaveZ can use to test our
bridging strategy.

Swift SVN r15081
2014-03-14 22:07:14 +00:00
Jordan Rose
27d1746467 [CMake] Move the install command for the Clang headers to the shims target too.
For consistency with r14968.

Swift SVN r14969
2014-03-12 22:17:02 +00:00
Jordan Rose
1c4d9b78a4 [CMake] Symlink Clang's headers into lib/swift as part of copy_shim_headers.
Turns out CMake's PRE_BUILD mode for custom commands doesn't work with the
Ninja or Makefile generators (not sure about Xcode). Just do it as part of
an earlier target instead.

Swift SVN r14968
2014-03-12 22:11:26 +00:00
Dave Abrahams
a398607c43 [build] Evil hack to make Make make
CMake's Makefile generator is not very smart about sibling dependencies,
apparently.  See the comment in the commit for more details.

Swift SVN r14909
2014-03-11 05:56:09 +00:00
Dave Abrahams
38f68fcba4 [build] stdlib core depends on SwiftShims
We need to make sure the core standard library is rebuilt when the shims
header changes.

Swift SVN r14906
2014-03-11 03:22:12 +00:00
Dave Abrahams
7a91b9f749 [stdlib] Remove *, /, and % from RandomAccessIndex
Before this commit, RandomAccessIndex was a refinement of
NumericOperations, which forced it to support inappropriate operations
such as multiplication.  Many obvious random-access index types can't
support multiplication (e.g. a StridedIndex adapter, which moves its
underlying index by N positions for each increment).

Along the way:

* the addition and subtraction operations on RandomAccessIndex were
  renamed to advancedBy and distanceTo, which prevents nasty ambiguities
  when a type conforms to both RandomAccessIndex and Integer, and allows
  Index DistanceTypes to actually be signed integers even when the Index
  is unsigned.

* Before this commit, using internal interfaces, it was possible to
  request static checking without also getting dynamic checks when
  static checking is impossible.  Now the relationship between static
  and dynamic checking is built into the core protocols.

* NumericOperations.swift was moved into IntegerArithmetic.swift.gyb,
  correcting missing operators by generating them programmatically and
  in preparation for renaming the protocol to something more appropriate

Fixes

  <rdar://problem/16246927> RandomAccessIndex is over-constrained

and possibly:

  <rdar://problem/15605729> Make all operators generic over
  protocols (in particular, get NumericOperations done)

Swift SVN r14854
2014-03-09 19:56:18 +00:00
Dave Abrahams
469f8629c6 [stdlib] OpaqueString is still an essential source
Swift SVN r14852
2014-03-09 19:56:16 +00:00
Dave Abrahams
6732cc1c4d [stdlib] Bugfix for essential sources check
I was using the wrong variable name in CMakeLists.txt

Swift SVN r14851
2014-03-09 19:56:15 +00:00
Dave Abrahams
0ec3ead12b [stdlib] Link an essential core library subset
To support layering improvements, add an (optionally built) "essential
core" library containing the minimum set of files required just to link
successfully.  Right now all those object files are linked again into
swift_stdlib_core; it would probably be better to link the essential
core into the core, but my CMake/Swift Driver fu is not strong enough
and this will at least help during development.

Along the way, removed the obsolete SwiftStdlibSources.txt file, as we
only have to support one build system now.

Swift SVN r14792
2014-03-07 21:01:49 +00:00
Joe Groff
3d93acb81b stdlib: Remove the 'Object' class.
It's dead, Jim. Also remove 'ClassNameable' since we don't use it for anything.

Reapply r14647 now that John fixed the serialization issue that scuttled it last time.

Swift SVN r14722
2014-03-06 04:53:25 +00:00
Joe Groff
565f889fe8 Revert "stdlib: Remove the 'Object' class."
This reverts commit r14647. It exposes an optimizer bug.

Swift SVN r14648
2014-03-04 17:39:06 +00:00
Joe Groff
59426904e2 stdlib: Remove the 'Object' class.
It's dead, Jim. Also remove 'ClassNameable' since we don't use it for anything.

Swift SVN r14647
2014-03-04 17:14:27 +00:00
Dave Abrahams
c33a59c6a7 [build] Complete gyb support
Remove all gyb-generated files and generate them automatically from .gyb
files.  Rename the proof-of-concept UnsafeArray.swift.gyb back to
UnsafeArray.swift.  Never forget to update the .gyb file or regenerate
again!

Swift SVN r14445
2014-02-27 03:01:16 +00:00
Dave Abrahams
69c1a857f9 [build] Basic support for gyb
Now a "foo.bar.gyb" file in a list of sources gets automatically
processed through gyb to produce "foo.bar"

Renamed a simple .swift file in the stdlib (which needs a rename anyway)
to have a .gyb extension as a proof-of-concept.

To make this useful for our existing gyb files, we need to figure out
how to pass them the right arguments; that's coming next.

Swift SVN r14444
2014-02-27 02:23:11 +00:00
Chris Lattner
3f5255fa2c update gyb files for val -> let.
Swift SVN r14442
2014-02-27 02:15:03 +00:00
Joe Groff
f02f4314eb Update original .gyb file for FixedPoint*.swift.
Swift SVN r14437
2014-02-27 01:07:56 +00:00
Ted Kremenek
028f9d0561 Remove rest of Makefile build except for 'docs' and 'www'.
For 'docs' and 'www' it is possible these are still being used,
as they work independent of the Makefile build.  Keeping them for now.

Swift SVN r14418
2014-02-26 22:21:25 +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
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
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
Dmitri Hrybenko
571c9b3c5e Split 'type' keyword into 'static' and 'class'
rdar://15911697


Swift SVN r13908
2014-02-14 14:50: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
Chris Lattner
0b70cddef1 rename various 'val' parameters to 'value' in the stdlib.
Swift SVN r13817
2014-02-12 06:08:18 +00:00
Chris Lattner
b149c746b3 convert the stdlib to use the new inout syntax.
Swift SVN r13561
2014-02-06 04:54:35 +00:00
Greg Parker
be878f2503 [build] Remove redundant dependency.
Swift SVN r13522
2014-02-05 23:23:08 +00:00
Dave Zarzycki
29af221df9 stdlib: we have sizeof() now. Drop *Int*.bitSize()
Swift SVN r13482
2014-02-05 07:11:46 +00:00
Jordan Rose
335ceb2f57 Re-enable the new Swift driver.
This re-applies r13380, reverted in r13406. I don't think this actually
caused any harm (r13400 was the primary culprit), but if it did I'd
like to actually see the buildbots or someone else's machine fail on it.

Swift SVN r13456
2014-02-05 00:09:00 +00:00
Dave Abrahams
01e9139944 Revert "Enable the new Swift driver!"
This reverts r13380, which broke the build

Swift SVN r13406
2014-02-04 06:13:58 +00:00