Commit Graph

12848 Commits

Author SHA1 Message Date
Eli Friedman
361481835c Introduce a notion of module scope declarations; use it where appropriate instead of checking for a local declcontext.
Swift SVN r1380
2012-04-11 02:52:40 +00:00
Ted Kremenek
389dd1c174 Mark ~Cleanup() virtual to silence "has virtual functions but non-virtual destructor" warnings.
Swift SVN r1378
2012-04-11 00:06:20 +00:00
Ted Kremenek
6e473e89a0 Mark ~PathComponent() virtual to silence a bunch of "has virtual functions but non-virtual destructor" warnings in subclasses.
Swift SVN r1377
2012-04-11 00:06:13 +00:00
Ted Kremenek
352453a53b Revert "Fix a bunch of "has virtual functions but non-virtual destructor" warnings"
Swift SVN r1376
2012-04-11 00:02:16 +00:00
Ted Kremenek
8a61ea1fd0 Fix a bunch of "has virtual functions but non-virtual destructor" warnings
Swift SVN r1373
2012-04-10 23:53:46 +00:00
Eli Friedman
5fd74f73a8 Fix comment.
Swift SVN r1368
2012-04-10 23:18:05 +00:00
Chris Lattner
ce7403dd1e implement IRGen of escapes. High unicode escapes aren't handled yet, but all the
basics are.


Swift SVN r1363
2012-04-10 20:59:45 +00:00
John McCall
0cd849b19c Complete the pattern-matching IR emission logic,
at least for exhaustive patterns.

Swift SVN r1359
2012-04-10 08:28:31 +00:00
John McCall
7faaf167f2 Editorial
Swift SVN r1358
2012-04-10 06:37:17 +00:00
John McCall
344a0fb5df Change IR-gen to convert canonical types.
Swift SVN r1357
2012-04-10 06:36:01 +00:00
John McCall
f3e27d90ff Change IR-generation so that it emits metadata objects for the
heap allocations it makes, and switch swift_alloc over to pass
that pointer in as well as the alignment.  Also, compute
whether a type is POD during its generation and cache that in
the object, and introduce a method on TypeInfo to destroy an
object in memory.

Swift SVN r1356
2012-04-10 06:28:22 +00:00
Chris Lattner
508dcb3091 implement IRGen for simple strings.
Swift SVN r1352
2012-04-10 01:44:11 +00:00
Chris Lattner
5650d08ddf implement parsing, AST, and sema support for simple strings,
no irgen yet.


Swift SVN r1351
2012-04-10 01:25:51 +00:00
Chris Lattner
2223774f5a use cached type, thanks John
Swift SVN r1350
2012-04-10 01:22:34 +00:00
Chris Lattner
65b400e30d introduce a new "Builtin.RawPointer" type, which corresponds to LLVM's "i8*" type,
and is just an unmanaged pointer.  Also, introduce a basic swift.string type.

This is progress towards rdar://10923403 and strings.  Review welcome.



Swift SVN r1349
2012-04-10 00:52:52 +00:00
Chris Lattner
fbfb76a515 rename 'plus' methods to 'static' methods, resolving:
<rdar://problem/10718220> Need a better name than 'plus' for "static" functions



Swift SVN r1340
2012-04-06 17:50:43 +00:00
John McCall
ca9f85d694 Add code for associating cleanups with intermediate
evaluation results and then claiming or forwarding the
ownership of such results.

Swift SVN r1337
2012-04-06 07:07:28 +00:00
John McCall
edad637ddb In preparation for Explosion storing some sort of cleanup pointer,
add some APIs for working with non-cleaned-up entities.

Swift SVN r1336
2012-04-06 07:07:22 +00:00
John McCall
44677bc117 Fixes and embellishments, and actually make IR-gen properly
emit release cleanups.  And they work!

Swift SVN r1334
2012-04-05 20:36:20 +00:00
John McCall
82da3ca63b Permit StableIP to be initialized as invalid.
Swift SVN r1333
2012-04-05 20:36:20 +00:00
John McCall
82ca0e7720 Basic infrastructure for cleanup emission and branches. Totally untested!
Swift SVN r1332
2012-04-05 20:36:19 +00:00
John McCall
8196f40c4c Add APIs to IRBuilder to capture a stable insertion point (which
stays in the same place in a function even when the current IP is
at the end of a block) and to temporarily shift the insertion point.

Swift SVN r1331
2012-04-05 20:36:18 +00:00
John McCall
665e82156c Publicize the stable_iterator members on DiverseStackImpl
(since they're inherited from a private base class).
Also add some extra consistency checking.

Swift SVN r1330
2012-04-05 20:36:17 +00:00
Eli Friedman
f477cf588e Introduce the notion of the "main" module, i.e. the module which defines main(). Disallow top-level statements in modules other than the main module. Fix IRGen to generate a main() function in the main module, and implement top-level statements. Get rid of the main() mangling hack. Part of <rdar://problem/11185451>.
I haven't really carefully considered whether existing type-checking etc. is correct for the main module (I think the name-binding rules need to be a bit different?), but it seems to work well enough for the obvious cases.

This is enough to get the one-liner "println(10)" to print "10" in "swift -i" mode, although the path to swift.swift still needs to be explicitly provided with -I.



Swift SVN r1325
2012-04-05 00:35:28 +00:00
Eli Friedman
d295d02c42 Initial interpreter implementation. The included pieces are enough to get the included simple.swift running in swift -i mode. <rdar://problem/10962290>, part 1.
Swift SVN r1319
2012-04-04 01:34:42 +00:00
Doug Gregor
5cf0a09e1a Allow type coercion from one function type to another function type,
so long as the input and result types are equivalent modulo renaming
of labels. This conversion is a no-op.


Swift SVN r1318
2012-04-03 17:51:41 +00:00
Eli Friedman
94244131f7 Remove ElementRefDecl and DeclVarName. Add the replacement, PatternBindingDecl. Use proper pattern parsing for variable declarations. Uniformly use PatternBindingDecl for variable initialization. Adapt type-checking and IRGen for this new style of variable declaration. <rdar://problem/11124980>.
Swift SVN r1312
2012-04-02 23:49:28 +00:00
Doug Gregor
4cc616f2be Rename the DependentType class to UnstructuredDependentType, because
this type is only going to cover dependent types for which there is
absolutely no structure. Still no functionality change.


Swift SVN r1292
2012-03-29 14:14:48 +00:00
Eli Friedman
debd0361ee Fix a couple crashers for tuples with default values.
Swift SVN r1289
2012-03-29 02:54:02 +00:00
Eli Friedman
bc73d196a3 Add an unsupported error for curried local functions for the moment.
Swift SVN r1287
2012-03-29 01:47:45 +00:00
Eli Friedman
4384ef192e Add IRGen for local FuncExprs. (This doesn't support local FuncDecls yet.)
Swift SVN r1286
2012-03-29 01:28:44 +00:00
Eli Friedman
fb10b02951 Basic capturing appears to be working correctly; turn it on.
Swift SVN r1285
2012-03-29 00:37:06 +00:00
Eli Friedman
29f3fca950 First iteration of CaptureAnalysis.
Swift SVN r1284
2012-03-29 00:24:03 +00:00
Doug Gregor
8f8ae8a77c Unbreak CMake build.
Swift SVN r1280
2012-03-28 16:49:40 +00:00
Eli Friedman
99b75ce728 Further progress on captures in closures.
Swift SVN r1279
2012-03-28 01:32:46 +00:00
Eli Friedman
d1d3d67851 Work in progress for IRGen of captures... any suggestions for a better way to write the code involving the capture block would be welcome.
Swift SVN r1278
2012-03-28 00:24:07 +00:00
John McCall
5e38419345 In a currying forwarder, force the release of the data allocation
between the point at which values were loaded out and the point
at which the call is performed.  This is bad for some things,
like not spilling all the arguments, and good for others, like
not keeping the allocation around unnecessarily and being able
to do a tail call.

This has the side-effect of causing the release to actually occur,
since we're not doing cleanups yet.

Swift SVN r1276
2012-03-27 23:54:11 +00:00
John McCall
aafaae22bc Properly include the heap header when laying out structures
for the heap.

Swift SVN r1275
2012-03-27 23:54:10 +00:00
John McCall
b0aca874c7 Switch the compiler's internal definition of struct SwiftHeapObject
to match the header (by adding the refcount field).

Swift SVN r1274
2012-03-27 23:16:19 +00:00
John McCall
d789a32827 Module and metatype types are first-class right now, so don't
fail to handle them.

Swift SVN r1271
2012-03-27 22:13:34 +00:00
Eli Friedman
d2bbf81245 Zap AnonClosureArgExpr.
Swift SVN r1269
2012-03-27 01:03:15 +00:00
John McCall
7f925de228 Trim stale forward-declarations.
Swift SVN r1268
2012-03-26 06:08:22 +00:00
John McCall
173d750a02 Switch IR-generation to use ASTVisitor, or more precisely, to
use irgen::ASTVisitor, which is a subclass of the AST version
that always looks through some expressions and asserts that
others (the unchecked/error ones) can't happen.  The main
obstacle to that is access control, because it's quite nice to
have the visitor be a non-local class for nesting purposes,
but that makes it impossible to use private methods anymore.
It's nice to give all the type-specific emitters private
interfaces anyway, though;  that ends up being most of the
patch.

I futzed with GenClosure.cpp while I was in there, but
separating it would have been obnoxious.

Swift SVN r1267
2012-03-26 06:08:19 +00:00
John McCall
df7ebcd9e8 Introduce the concept of an 'owned address', i.e. an address with
an owner attached.  Use this to implement [byref(heap)].  Force
locals to the heap if they've been referenced in a way that requires
this.

Swift SVN r1265
2012-03-26 03:26:21 +00:00
Eli Friedman
a940cdd22b Compute capture lists for FuncExprs and ImplicitClosureExprs.
Swift SVN r1254
2012-03-23 22:06:21 +00:00
Eli Friedman
80b55617ba Start of computing captures for CapturingExprs in the AST; only works for ExplicitClosureExprs so far. Per previous discussion, anything which can be captured goes through the relevant codepath in Parser::actOnIdentifierExpr.
Swift SVN r1251
2012-03-22 02:37:57 +00:00
Eli Friedman
ea17adc3ec Completely switch over IRGen for closures to use the standard prologue/epilogue emission.
Swift SVN r1250
2012-03-22 01:04:05 +00:00
John McCall
d949198f6c Reorganize some code to permit primitive type infos to be
created from other translation units.

Swift SVN r1247
2012-03-20 19:42:07 +00:00
John McCall
5a4dfb6624 Beginnings of support for heap-allocated locals.
Swift SVN r1246
2012-03-20 19:42:03 +00:00
John McCall
99a6c4ccf1 Cache %refcounted* null. This will be particularly important
for heap l-values.

Swift SVN r1245
2012-03-20 19:42:00 +00:00