Commit Graph

72 Commits

Author SHA1 Message Date
Dave Zarzycki
4d8739f083 Accept limitations of LLVM build system
1) Move the low-level runtime code into swift/runtime
2) Move the high-level "standard library" code into swift/stdlib

The key difference is that the 'runtime' contains language support logic
(like retain/release logic) that the compiler assumes to always exist
and may assume intimate details about the implementation. This library
will have intimate knowledge of the swift ABI.

In contrast, the 'stdlib' can be completely rewritten and the
language/compiler make little if any assumptions about it. It is
expected to reexport fundamental types and operators, and implement
fundamental policies (precedence, implicit conversions, etc).

Swift SVN r3045
2012-10-23 21:33:52 +00:00
Eli Friedman
dd299a35af Fix for LLVM TargetData -> DataLayout rename.
Swift SVN r2959
2012-10-09 23:18:24 +00:00
Doug Gregor
0f27e2885e In the REPL, it's fine now to run when we're type-checking with the
constraint solver.


Swift SVN r2950
2012-10-08 20:37:58 +00:00
Eli Friedman
8a2ede5b82 Zap extra semicolon which clang warns about.
Swift SVN r2896
2012-09-22 01:53:41 +00:00
Doug Gregor
c13ef4777e Replace the REPL command :dump_constraints with a way to toggle the
LangOptions bits for using the constraint solver and emitting its
diagnostics.


Swift SVN r2839
2012-09-12 20:56:03 +00:00
Doug Gregor
f059cfd22d Add a few more hacks to layer the application of a solved constraint system to an expression tree on the existing type checker.
Swift SVN r2838
2012-09-12 20:43:05 +00:00
Doug Gregor
39b9f431ee Separate out the setting of the "debug constraints" from "use the constraint solver" option; we want these to be independent. No functionality change, yet.
Swift SVN r2837
2012-09-12 20:22:48 +00:00
Doug Gregor
42b1ab6fbd Introduce a LangOptions class to capture various type-checker-tweaking flags. For now, introduce bits to enable the constraint solver and to enable debugging of the constraint solver, and use those to eliminate the "useConstraintSolver" bit that was threaded through too much of the type checker.
Swift SVN r2836
2012-09-12 20:19:33 +00:00
Doug Gregor
81d8f27bde When dumping constraints via TypeChecker::typeCheckExpression(), don't
rely at all on the existing type checker. Instead, just fold sequence
expressions (which are effectively a delayed parsing phase) and then
hand off the expression to the constraint solver.

Allows us to type-check expressions with operators, e.g., f + 1.


Swift SVN r2793
2012-08-27 18:33:20 +00:00
Doug Gregor
5999348a5a When we're dumping constraints for an expression in the REPL, don't
execute that expression.


Swift SVN r2717
2012-08-23 00:27:42 +00:00
Doug Gregor
0d7afbe5e0 Introduce an almost completely untested implementation of constraint
generation from an expression that has not been type-checked. One can
see the constraints introduced by an expression by using

  :dump_constraints <expression>

within the REPL. We're still missing several major pieces of
constraint generation:
  - We don't yet "open up" references to polymorphic types
  - We don't print out the child constraint systems in the dump, so
  it's not at all obvious what happens within overloading (and I'm not
  convinced I like my representation anyway)
  - There are no tests whatsoever
  - Member constraints are still very, very weird



Swift SVN r2624
2012-08-13 22:59:41 +00:00
Ted Kremenek
928924728a Delay initialization of 'LastValidLineEnd', as it was unconditionally
overwritten later.

Swift SVN r2493
2012-07-30 18:30:27 +00:00
Eli Friedman
b3a9da6fef MCJIT broke again... just turn it off until we can actually take it seriously.
Swift SVN r1879
2012-05-17 01:22:15 +00:00
Eli Friedman
8f290b63a8 Extend the ugly standard library hack so it works for static compilation. We should be inlining from the standard library now everywhere except the REPL.
Swift SVN r1792
2012-05-10 01:14:56 +00:00
Eli Friedman
760b49f4c6 Remove unused bit from IRGen options.
Swift SVN r1750
2012-05-05 03:19:11 +00:00
Eli Friedman
bf281fd1e1 Exclude REPL escapes from the output of :dump_source. <rdar://problem/11387569>.
Swift SVN r1744
2012-05-04 20:55:53 +00:00
Eli Friedman
ee254c5f58 Get rid of a bit of dead code from the REPL.
Swift SVN r1732
2012-05-03 23:51:31 +00:00
Eli Friedman
01385963ee Avoid JIT'ing swift.swift in both script mode and the REPL.
Swift SVN r1731
2012-05-03 23:48:00 +00:00
Eli Friedman
283ef8e455 Build swift.swift as part of the swift runtime. The CMake changes here aren't complete, but Doug said he would fix that.
This should be enough to allow statically compiling swift applications.  As followups, I'm going to additionally start installing swift.swift to a common location, and start  making REPL/script mode aware that these functions are available, so they don't bother to IRGen them.

I'm leaving around some files in runtime/ which aren't necessary with this commit; I'll delete them in a separate commit.



Swift SVN r1725
2012-05-03 22:31:23 +00:00
Eli Friedman
0b1405390d Add :dump_source to the REPL. <rdar://problem/11326637>.
Swift SVN r1724
2012-05-03 20:50:34 +00:00
Eli Friedman
49bf057b20 Disable non-leaf frame pointer elimination for both REPL and script modes.
Swift SVN r1720
2012-05-02 21:48:57 +00:00
Eli Friedman
2aee4db46f A couple tweaks for REPL editline usage; install default signal handlers so we get better handling for Ctrl+Z etc., and print a newline after the end of input if we showed a prompt. Fixes <rdar://problem/11364065>.
Swift SVN r1717
2012-05-02 20:38:27 +00:00
Eli Friedman
e31cc600d3 Make immediate/script mode use the LLVM optimizers and MCJIT, as part of my experiments with optimizations. No functional change for the REPL; I still need to work out how to call the optimizer there without either breaking the underlying assumptions of the JIT or re-JITing everything for every line. (Multi-module support in the JIT would be nice...)
Swift SVN r1711
2012-05-02 03:00:31 +00:00
Eli Friedman
dcebd1d95e Fix uninitialized member.
Swift SVN r1705
2012-05-01 23:00:43 +00:00
Eli Friedman
ba1caeb57a Fix a stupid mistake in the precompilation code for the REPL.
Swift SVN r1662
2012-04-26 21:32:59 +00:00
Howard Hinnant
88e1ec0c16 Use Eli's swift new c_putchar to move print(String) back into swift.swift :-)
Swift SVN r1632
2012-04-25 15:39:16 +00:00
Eli Friedman
2f3ff69d41 Some tweaks to module import to get the demo flow working.
Swift SVN r1625
2012-04-25 07:29:31 +00:00
Eli Friedman
d228618b8d Slightly expand the :help text.
Swift SVN r1624
2012-04-25 07:11:42 +00:00
Eli Friedman
b4ec884307 Add missing square bracket token to REPL brace matching.
Swift SVN r1623
2012-04-25 06:53:24 +00:00
Eli Friedman
e6865b3b23 Move the implementation of Char printing into swift.swift, and get rid of the old printChar. Fix a bug in IRGen I ran into while working on that.
Swift SVN r1620
2012-04-25 03:39:48 +00:00
Howard Hinnant
8856293d94 Two major changes here: Char has been renamed to Char8. This is a temporary hack with the intent that Char8 will soon dissappear. But I'm refactoring and didn't want to break things. A new type Char has been introduced. It behaves somewhat like a cross between a UInt32 and a pointer type. It compares like a UInt32. It has arithmetic like a pointer, with the difference_type being Int. The second major change is the introduction of StringCharRange (name donated by Doug). It is attempting to be a range over String respecting that String is stored as UTF-8. It is intended that an invariant of String is that it can only hold valid null-terminated UTF-8 (to reduce validation costs). I also modified the cpp implementation of printChar to accept UTF-32 and print it out via printf using UTF-8. Still to be done is address the FIXME's in String to transition to UTF-8. I'm hoping this can be done with the new StringCharRange and foreach. But I do not know for sure. I've run out of steam for the night (still on EDT). For those of you who have more steam for the night and are working hard towards our demo, please feel free to pick any of this up and modify it in whatever way helps the demo best, even if that means reverting it.
Swift SVN r1619
2012-04-25 02:36:27 +00:00
Eli Friedman
ee4d656007 Switch misc functions in swift.swift to use the new asmname attribute.
Swift SVN r1618
2012-04-25 02:13:09 +00:00
Doug Gregor
c70aa1ba27 Make String(0) actually print '0' rather than nothing ;)
Swift SVN r1612
2012-04-24 22:48:36 +00:00
Howard Hinnant
da897cb5c5 I'm not happy about this either. But print(String) is an exact match for printf(%s). printf takes UTF-8 strings and prints them out. It doesn't make sense to convert from UTF-8 to UTF-32 and then back to UTF-8 just to print. Test added to confirm that we can print a non-ASCII UTF-8 String.
Swift SVN r1609
2012-04-24 22:19:57 +00:00
Eli Friedman
bf1392c016 Add :dump_ast to dump the AST from the REPL.
Swift SVN r1605
2012-04-24 21:37:38 +00:00
Eli Friedman
c33ee06b35 Disable repl prompt coloring for now; see <rdar://problem/11312059>.
Swift SVN r1604
2012-04-24 21:34:40 +00:00
Eli Friedman
5177545bd0 Implement balancing in the REPL for parens and brackets in addition to braces. <rdar://problem/11306336>.
Swift SVN r1600
2012-04-24 20:50:56 +00:00
Eli Friedman
924ef61b7c Fix repl prompt with '\' continuation. <rdar://problem/11296808>.
Swift SVN r1598
2012-04-24 20:39:32 +00:00
Ted Kremenek
b40804dd35 Make the swift REPL prompt a bit more swift. This is a bit hackish, and could be improved.
Swift SVN r1584
2012-04-24 05:23:33 +00:00
Chris Lattner
03f874e4f7 bring my ridiculous hack to the String(double) ctor, not just print(double). In the
demo, we now get:
Complex = (r=4.0, i=2.0)
instead of:
Complex = (r=4.000000e+00, i=2.000000e+00)


Swift SVN r1583
2012-04-24 04:45:25 +00:00
Eli Friedman
dd94cf5837 Add :dump_ir to the REPL. <rdar://problem/11305412>.
Swift SVN r1582
2012-04-24 03:36:47 +00:00
Eli Friedman
6c3a0e9a86 Fix a minor regression in the REPL prompt.
Swift SVN r1580
2012-04-24 02:29:29 +00:00
Eli Friedman
1d4ced4a9b I finally figured out the magic invocation to get libedit to do history. <rdar://problem/11287187>.
Swift SVN r1579
2012-04-24 02:23:35 +00:00
Eli Friedman
399ec31cb7 Allow backslash to escape an end-of-line in the REPL.
Swift SVN r1578
2012-04-24 01:33:59 +00:00
Eli Friedman
36472404b2 Parse swift.swift upfront in the REPL. This has two benefits: one, we error immediately if swift.swift can't be found, or something is wrong with it. Two, it lets us JIT swift.swift upfront, which makes the REPL prompt feel more responsive. <rdar://problem/11305258>.
Swift SVN r1575
2012-04-24 00:55:19 +00:00
Eli Friedman
837fdf04fb Always type-check immediately after a line is finished in the REPL. This isn't quite the same as how script mode works at the moment, but apparently it's way too confusing to delay type-checking errors. <rdar://problem/11296808>
Swift SVN r1572
2012-04-23 23:53:28 +00:00
Eli Friedman
67b4140862 Add simple interpreter escapes. Use ':' since it's reserved by the swift grammar. <rdar://problem/11296710>.
Swift SVN r1566
2012-04-23 22:31:04 +00:00
Chris Lattner
470b787197 everyone loves atan2.
Swift SVN r1560
2012-04-23 06:39:33 +00:00
Chris Lattner
b2457f4bd0 add sin/cos.
Swift SVN r1559
2012-04-23 06:19:00 +00:00
Chris Lattner
34b6a8065a change the floating point printing format to be more concise. It wouldn't surprise me if this
wasn't perfect, but it is close enough for now.  We now print 4.0 instead of 4.000000.



Swift SVN r1558
2012-04-23 02:57:10 +00:00