Commit Graph

1397 Commits

Author SHA1 Message Date
Jordan Rose
16b5a57838 Enable the new Swift driver!
This substitutes swift_driver in as the new "swift". Tests that currently
test "%swift" will invoke "swift -frontend", much like "clang -cc1".
Most command-line interaction will look the same, except that Swift can
now emit linked libraries (using -emit-library) and executables (using
-emit-executable, or by not passing a mode option at all).

If you are working with @transparent functions, note that they will not be
properly inlined across file boundaries unless you use
-force-single-frontend-invocation, which emulates the old swift binary.
There are Radars for this already: <rdar://problem/15366167&15693042>

The name 'swift_driver' is now a symlink for 'swift'. This will be removed
next week.

The old 'swift' is still available as 'swift_old', though it is not being
tested at all. This will be removed in two weeks.

Clean CMake builds will get this immediately.

Incremental CMake builds will not get the new driver unless you explicitly
enable the SWIFT_NEW_DRIVER option (-DSWIFT_NEW_DRIVER=ON on the command line).
This option will go away in a week.

Makefile builds will get this immediately because I didn't want to work out
how to maintain both modes.

Much credit to Connor for bringing up the entire driver and for doing much
of the work in ensuring that all the tests continue to pass.

Swift SVN r13380
2014-02-03 22:48:39 +00:00
Michael Gottesman
cc6783cc85 Control whether or not benchmarks are run via CMake/Make argument SWIFT_ENABLE_BENCHMARKS.
This will help to prevent errors like committing a patch that re-enables the
benchmarks for everyone.

Swift SVN r13343
2014-02-03 06:42:34 +00:00
Dave Zarzycki
7fada455b1 stdlib: add ++/-- operators to floating point
<rdar://problem/15866685> cannot increment floating point values

Swift SVN r13309
2014-02-01 23:17:27 +00:00
Dave Zarzycki
a9b2c22857 stdlib: Make shift operator asserts cheaper in debug builds
Swift SVN r13307
2014-02-01 22:00:58 +00:00
Jordan Rose
579798393a Replace "-sdk=", "-triple=", etc. with separated options in the build systems.
Part of the migration to the new driver.

Swift SVN r13264
2014-02-01 01:19:57 +00:00
Dave Zarzycki
d20a525ebd 15866696 Files in the stdlib should use the llvm header
Swift SVN r13258
2014-02-01 00:40:20 +00:00
Dave Zarzycki
5ca3df0940 15876164 shifting by negative/"too big" amounts should trap
Swift SVN r13251
2014-01-31 23:22:44 +00:00
Dave Zarzycki
0e833a326e 15936764 swift.sin is ambiguous with Darwin.sin
Swift SVN r13180
2014-01-30 23:17:12 +00:00
Greg Parker
e4c7b48d1c [build] Fix FixedPoint[32|64].swift in Makefile build, again.
Swift SVN r13121
2014-01-29 22:12:10 +00:00
Greg Parker
1a87098af0 Replace Word[32|64].swift with FixedPoint[32|64].swift in makefile build.
Swift SVN r13118
2014-01-29 21:13:53 +00:00
Greg Parker
b2846b546b Make Int a word-size type.
- Int and UInt are now struct types backed by Builtin.Word. Previously they
were typealiases for Int64; Int and Int64 are now distinct types.
- Mangled names 'i' and 'u' are now Int and UInt. Int64 is mangled longhand.
- Word is a typealias for Int. It is expected to go away in the future.
- Builtin.Word is unchanged.
- CLong and CUnsignedLong are typealiases for Int and UInt.
- FixedPoint.swift is now FixedPoint32.swift and FixedPoint64.swift. 
Reunifying these requires better builtins, especially for checked 
conversions (rdar://15472770).
- Updated many tests, mostly because Int is no longer spelled Int64 in sil.
- One check was removed from test decl/operator/operators.swift 
because it changed behavior when Int became a non-typealias 
type (rdar://15934688).



Swift SVN r13109
2014-01-29 12:21:19 +00:00
Doug Gregor
eaf3e5c68d Move nil/_Nil into the core library and add UnsafePointer<T> support.
Fixes <rdar://problem/15933510>.


Swift SVN r13094
2014-01-29 06:30:28 +00:00
Dave Abrahams
376cdefeed [stdlib] Segregate the String bridging API
Core and Foundation now communicate through StringBridge.swift

Swift SVN r13033
2014-01-28 02:05:42 +00:00
Dave Abrahams
bd85cf7d94 [stdlib] Implement a sane assert/fatal error check system
The facility we had before was not very usable in core elements of the
standard library because it relied too much on those elements itself.
The result could be some spectacular infinite recursions and general
erosion of certainty, and was making development of Swift's String very
difficult.

In this commit we use extremely low-level primitives to avoid the recursion
problem.  Also, because the purpose of all the older assertion functions
was unclear and there was a great deal of overlap in terms of
functionality, we clarify naming and consolidate functions.

As much as possible, the semantics of all existing tests in the face of
Asserts-enabled/-disabled build configuration changes has been
preserved, but the new naming makes it obvious in some cases that the
semantics may not have been well-chosen, which speaks well for the new
names. (**)

The two forms of "assert()" are completely enabled or
disabled--including evaluation of the condition--based on build
configuration.  This follows the usual semantics from C, with the
differences being:

  * No multiple evaluation badness from preprocessor macros, of course
  * When a condition is supplied, assert accepts an optional message
  * When no condition is supplied, fires unconditionally and requires a
    message

The other functions are always enabled and only differ between build
configurations in how much information they attempt to deliver through
non-core-dump channels.  When assertions are disabled and these
functions fire, they invoke a debugger trap, and do nothing else.

(**) It also opens some questions about policy.  For example, should we
consider overflow and underflow to be securityChecks, as we do now, even
though they do not directly cause a memory safety issue?  We could wait
for e.g. bounds checking on arrays to catch those problems before they
become memory safety issues, and gain a little speed in the regular
arithmetic path.

Swift SVN r12854
2014-01-23 06:47:18 +00:00
Dave Abrahams
f51fc320ca [stdlib] Add StringCore
The core datastructure of the revised and optimized String Design Redux,
Part Trois.  Completely untested and not wired into anything, so NFC.

Swift SVN r12701
2014-01-22 05:09:20 +00:00
Michael Gottesman
47bba086fa Remove empty performance hack file.
Swift SVN r12664
2014-01-21 22:06:08 +00:00
Chris Lattner
59e35ee8a0 add a file to hold performance hacks. First up, make preincrement of integers
actually be trivial.  This works around:
<rdar://problem/15866569> [string perf] ++ is not getting deabstracted and inlined fully



Swift SVN r12634
2014-01-21 05:02:44 +00:00
Dave Abrahams
21186b5dc1 [stdlib] Break String source into manageable pieces
Swift SVN r12453
2014-01-17 01:47:29 +00:00
Nadav Rotem
c3a1f09ca1 Move the string benchmark into Benchmark.swift
We can now run it from the repl:

Welcome to swift.  Type ':help' for assistance.
(swift) benchStrings()
8808796493 nanoseconds on x86
(swift) 




Swift SVN r12242
2014-01-13 20:10:29 +00:00
Dave Zarzycki
a1d3bcdd42 Add temporary String benchmark
C++:     ~231326 ns
 ObjC:     ~750604 ns
Swift: ~5827396474 ns == 25191x slower than C++!

The problems are all over the place. For example: while there are lots
of failures to inline generics, there is work in the runtime as well to
fix some cases where we call calloc() instead of use the swift cache.

Swift SVN r12225
2014-01-13 09:40:03 +00:00
Nadav Rotem
da3ed8d324 Add the RC4 benchmark to stdlib.
We will remove this benchmark as soon as we fix rdar://14747929, that will allow us to optimize basic stdlib routines.



Swift SVN r12134
2014-01-10 21:01:44 +00:00
John McCall
e933d421b0 Add UncheckedOptional<T> to the standard library.
Swift SVN r12127
2014-01-10 19:13:49 +00:00
Dave Abrahams
fb70778e35 [stdlib] Remove Obsolete CodePoints type
CodePoints was built upon StringByteData, a UTF-8 String
representation.  Its replacement is UTF16Scalars.

Swift SVN r12111
2014-01-10 01:24:25 +00:00
Dave Abrahams
bf3ca81ee7 [stdlib] File renames associated with protocol name changes
Swift SVN r12063
2014-01-08 20:06:29 +00:00
Doug Gregor
0d37bd3015 Switch the standard library from "static" to "type".
Swift SVN r12026
2014-01-08 01:09:56 +00:00
Dave Abrahams
212f39e307 [stdlib] Rename Indexable.swift => Container.swift
Now that the protocol name changed, get the filename straightened out
too.

Swift SVN r11959
2014-01-06 22:30:27 +00:00
Doug Gregor
1ee513e7e8 Use Builtin.Word for array lengths, string literal lengths, etc.
This eliminates a number of 64-bit integer/64-bit pointer assumptions
in the type checker and SILGen.


Swift SVN r11863
2014-01-03 18:53:01 +00:00
Dave Zarzycki
632264cbd1 stdlib: checkpoint 15612767: Int should become a separate, platform-sized type
1) Abstract away assumptions about all LLVM types being prefixed by 'Int'.
2) Thread through the ability to create a "word" sized type. This is
   blocked by a couple bugs.
3) Fix a bug where Int8/UInt8 did not conform to ArrayBounds.
   (This bug dates back to when FixedPoint.swift was hand maintained.)

Swift SVN r11858
2014-01-03 07:50:08 +00:00
Dave Abrahams
b86ebcc042 [stdlib] Rename Char.swift => UnicodeScalar.swift
Swift SVN r11846
2014-01-03 01:37:33 +00:00
Dave Abrahams
0ca0b46065 [stdlib] Rename NewString.swift -> String.swift
Swift SVN r11845
2014-01-03 01:32:20 +00:00
Dave Abrahams
dc26363d29 [stdlib] Remove String.swift
It was only serving up a single typealias

Swift SVN r11832
2014-01-02 22:09:08 +00:00
Dave Zarzycki
d24e2454de stdlib: add overflow checking to div and rem
Swift SVN r11783
2014-01-01 03:32:01 +00:00
Dave Zarzycki
0228f019c1 stdlib: make unary + generic over SignedNumbers
Swift SVN r11774
2013-12-31 20:16:13 +00:00
Dave Zarzycki
3feaac40c6 stdlib: drop IEEE from type/protocol names
Swift SVN r11768
2013-12-31 05:28:57 +00:00
Dave Zarzycki
a38ce8d8ef stdlib: move related NumericOperations out of Policy.swift
Swift SVN r11762
2013-12-31 03:41:30 +00:00
Dave Zarzycki
44269cc01d stdlib: Move IEEE754 support into its own file
Swift SVN r11761
2013-12-31 02:42:16 +00:00
Dave Zarzycki
f4e60d11b3 stdlib: Move the LogicValue implementation into its own file
Swift SVN r11759
2013-12-31 02:31:01 +00:00
Dave Zarzycki
c550e75954 stdlib: consolidate compiler protocols into a dedicated file
Annotating each protocol with "NOTE: ..." doesn't scale.

Swift SVN r11758
2013-12-31 02:08:59 +00:00
Dave Zarzycki
669ca06213 stdlib: mark SignedNumber methods as @transparent
Swift SVN r11757
2013-12-31 01:54:11 +00:00
Dave Zarzycki
9bfa643933 stdlib: abs() should use Builtin.*fabs* on floats
Swift SVN r11745
2013-12-30 21:42:22 +00:00
Doug Gregor
8383a25989 Remove the __less__ hack; use < instead.
Note that we have to work around <rdar://problem/14432081> a bit.

Swift SVN r11726
2013-12-29 21:05:16 +00:00
Doug Gregor
d1054b9e86 Eliminate the __equal__ protocol requirement; use == directly.
This is DaveA's patch, slightly tweaked, which works properly now that
<rdar://problem/15715996> is fixed.

Swift SVN r11725
2013-12-29 20:45:25 +00:00
Dave Abrahams
afbbbd1287 [stdlib] Add a facility for calling "C" functions that take va_list arguments
This code has only been tested on x86_64, but is designed to work on
the other platforms supported by Apple.

Swift SVN r11561
2013-12-22 02:37:33 +00:00
Dave Abrahams
68c47c7121 [stdlib] Remove ObjectPointer.swift; it was not ready for prime-time
Swift SVN r11131
2013-12-11 17:20:06 +00:00
Dave Abrahams
4c98b501a6 [stdlib] Expose NSString.stringWithContentsOfFile on String
Along the way created bridging utilities for ObjectiveC functions that
take "out" arguments and added an fmap for operating on Optionals

Swift SVN r11123
2013-12-11 07:24:05 +00:00
Doug Gregor
a5167f6bac Remove the type-checker performance workaround in <rdar://problem/14925518>
Swift SVN r11118
2013-12-11 03:40:22 +00:00
Dmitri Hrybenko
b55f943d0d stdlib/FixedPoint: fix indentation
Swift SVN r11089
2013-12-10 20:44:03 +00:00
Joe Groff
ab95d6cd11 stdlib: Add a BitwiseOperations protocol.
Collect the bitwise logical operators under a protocol. Add an 'allZeros' static method to produce the 'zero' identity value for the type when used with bitwise operations.

Swift SVN r11068
2013-12-10 04:03:20 +00:00
Jordan Rose
b4fe56eb1c Actually fix the Makefile build for multi-file Swift libraries.
The hack to get the LLVM build system to do what we want is to define a
custom build rule for "XYZ.o" and then add "XYZ" as a dummy source file
to the SOURCES variable, which the LLVM Makefile system uses. To make it
clear that something unusual is going on here, I've changed all existing
instances of this to use "XYZ.o" in SOURCES, rather than having that name
be derived from "XYZ.swift" or whatever.

The actual Swift source files go in SWIFT_SOURCES for the time being
(and possibly forever, since Swift sources will always be built together).

Swift SVN r11058
2013-12-10 00:23:43 +00:00
Anna Zaks
b75cb37cf8 Reapply r10534 in a more convenient form.
Swift SVN r10944
2013-12-06 22:10:52 +00:00