Commit Graph

10571 Commits

Author SHA1 Message Date
Chris Lattner
290a58494e Implement debug info for willset/didset, and teach dispatch to be non-virtual
to didset/will set since we don't drop these in the class vtable.


Swift SVN r13056
2014-01-28 06:33:31 +00:00
Chris Lattner
7bcf701ee1 Teach sema to synthesize the getter/setter for willSet/didSet properties,
we have basic functionality now.


Swift SVN r13054
2014-01-28 06:02:07 +00:00
Joe Groff
357a242034 SILGen: Use interface types in RValueEmitter's implementation.
Cut over to using interface types and injecting context from the SILFunction as needed in all of the expression lowering code.

Swift SVN r13053
2014-01-28 05:25:57 +00:00
Joe Groff
7f5091ad86 SILGen: Build forwarding substitutions from context generic params.
Severs another easy dependency on SILFunctionType context.

Swift SVN r13052
2014-01-28 05:25:56 +00:00
Chris Lattner
d407bc8fc4 Teach the parser to add the didSet/willSet functions to the enclosing
type, so we emit them.  Add mangler (and demangler) support for these.
Enhance our testcase to check to make sure that stores within these
specifiers are direct, they don't cause recursive infinite loops.

John, I picked w/W for the mangling letters, let me know if this is ok.


Swift SVN r13050
2014-01-28 05:15:56 +00:00
Chris Lattner
ca439b1a48 it doesn't make any sense for stores within didSet/willSet to trigger the
accessor functions.  Just say that they are disabled instead (already 
implemented).


Swift SVN r13048
2014-01-28 05:02:10 +00:00
Chris Lattner
64f45b40d8 abstractstoragedecls with objc accessor thunks always have associated accessor
functions now, so simplify code.


Swift SVN r13046
2014-01-28 04:22:56 +00:00
Chris Lattner
d13ac2cae3 unhork the makefile build.
Swift SVN r13045
2014-01-28 04:11:24 +00:00
Jordan Rose
cb358825d1 [driver] Set the Immediate flag in -i or -repl modes.
This activates a special mode where code is also generated for input files.
We don't really care about this for -i mode, but it makes -repl mode a bit
nicer.

Swift SVN r13044
2014-01-28 03:16:48 +00:00
Jordan Rose
4d69bebc08 [driver] -emit-module is not compatible with -i, -parse, or -repl.
Also, preserve the errors for "at least one input file" and "exactly one
input file".

Swift SVN r13042
2014-01-28 03:16:47 +00:00
Jordan Rose
8dc6098104 [driver] LLVM bitcode is a binary format; don't write it to stdout.
Swift SVN r13040
2014-01-28 03:16:46 +00:00
Joe Groff
b6108c0bc2 SILGen: Consume CallEmission parameters based on the interface type.
NFC, the logic here does not depend on generic context.

Swift SVN r13039
2014-01-28 02:46:33 +00:00
Michael Gottesman
39b6015b0b Reapply "[sil-arc-opts] Enable single basic block code motion of retain instructions."
This reverts commit r13035 and contains the necessary changes to make it no
longer fail.

Swift SVN r13038
2014-01-28 02:32:53 +00:00
Joe Groff
5d58f10e48 SIL: Make ContextGenericParams a constructor parameter of SILFunction.
Edge SILFunction one step closer to independence from SILFunctionType context by taking the generic param list as a separate constructor parameter, and serializing those params alongside the function record. For now we still pass in the context params from the SILFunctionType in most cases, because the logic for finding the generic params tends to be entangled in type lowering, but this pushes the problem up a step.

Thanks Jordan for helping work out the serialization changes needed.

Swift SVN r13036
2014-01-28 02:17:46 +00:00
Dave Abrahams
d918550438 Revert "[sil-arc-opts] Enable single basic block code motion of retain instructions."
This reverts r13017, which was breaking the Swift-Fast bot (build #814).

Swift SVN r13035
2014-01-28 02:07:01 +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
Jordan Rose
774d75dbe1 Release notes: -emit-llvm and -triple have been deprecated.
Swift SVN r13031
2014-01-28 01:42:46 +00:00
Jordan Rose
934121914c Use -emit-ir instead of -emit-llvm, for better parity with -emit-bc.
-emit-llvm in Clang is a modifier on the -S and -c actions. In Swift,
it's a separate action equivalent to "-S -emit-llvm". Be less ambiguous.

Part of the migration to the new driver.

Swift SVN r13029
2014-01-28 01:42:44 +00:00
Jordan Rose
0c92cc0fe4 Use '-target' instead of '-triple', for consistency with Clang and GCC.
Part of the migration to the new driver.

Swift SVN r13028
2014-01-28 01:42:41 +00:00
Jordan Rose
2132bfff49 Replace "-sdk=<path>" with "-sdk <path>" in tests.
Part of the migration to the new driver.

Swift SVN r13027
2014-01-28 01:42:38 +00:00
Dave Abrahams
c636c6a5fd [utils] buildbot-script: suppress warnings
when not building for ios, we shouldn't need to have an SDK installed to
get a clean build.

Swift SVN r13026
2014-01-28 01:26:30 +00:00
Mark Lacey
eaa060bae4 Update enum test to be less fragile.
Swift SVN r13024
2014-01-28 01:21:24 +00:00
Chris Lattner
acefe4ff89 remove a special case for SelfApplyExpr that isn't needed anymore.
With that change, all calls to adjustSelfTypeForMember are in the
argument list of coerceObjectArgumentToType. Instead of doing this,
just call adjustSelfTypeForMember from coerceObjectArgumentToType
instead.


Swift SVN r13023
2014-01-28 01:20:42 +00:00
Chris Lattner
5d28be5662 start teaching sema about didset/willset. First up, accesses to the
variable are direct in init/destructor and in the didSet/willSet specifiers
themselves (to avoid infinite loops in reassignments).

Also, teach adjustSelfTypeForMember to handle direct accesses properly,
and move isImplicitDirectMemberReference early enough that it can find out
about inferred directness.


Swift SVN r13022
2014-01-28 01:09:06 +00:00
Chris Lattner
6a6e025c24 teach the ast dumper to dump didset/willset stuff.
Swift SVN r13021
2014-01-28 00:56:53 +00:00
Chris Lattner
eb66701757 simplify code now that AbstractStorageDecl unifies VarDecl and SubscriptDecl.
Swift SVN r13020
2014-01-28 00:39:20 +00:00
Chris Lattner
827e168b40 refactor all the get/set parsing logic to merge the cases together into
one function.  Add to it logic to parse didset/willset.

Sema doesn't exist yet, so these aren't too useful yet.


Swift SVN r13019
2014-01-28 00:09:12 +00:00
Chris Lattner
a571d5800e Change the storage of a property to WillSetDidSet before touching
its willset/didset pieces, to avoid tripping assertions.


Swift SVN r13018
2014-01-28 00:05:24 +00:00
Michael Gottesman
08e80016ea [sil-arc-opts] Enable single basic block code motion of retain instructions.
Swift SVN r13017
2014-01-27 23:58:34 +00:00
Mark Lacey
5e40837b62 Always pass an llvm::Module* to performIRGeneration().
Previously it would create a new module if one was not passed in. There
are no uses where we do not or cannot provide a module, so it seems
reasonable to make the interface consistently require a module.

Swift SVN r13016
2014-01-27 23:48:49 +00:00
Michael Gottesman
3acba25476 [sil-arc-opts] Strip off casts when determining the state associated with an instruction's operand.
Casting in between different types will not affect a pointers reference count.

This increases the number of increment/decrement pairs we remove from 1720 ->
2040 pairs.

Swift SVN r13013
2014-01-27 22:58:02 +00:00
Michael Gottesman
b651a9a348 Remove double semicolon that snuck in.
Swift SVN r13012
2014-01-27 22:58:02 +00:00
Chris Lattner
e668e86cc3 With many prerequisites out of the way, lets start actually working on didset/willset
properties.  This step provides AST support to model them.


Swift SVN r13011
2014-01-27 22:11:16 +00:00
Chris Lattner
8735a76b0b Simplify emitRValueForPropertyLoad and make it work when we can have
rvalues that are both computed and have storage.


Swift SVN r13010
2014-01-27 22:10:34 +00:00
Chris Lattner
d6f38b233c Now that the AST rep of properties in protocols are squared away, we can
simplify this code.



Swift SVN r13009
2014-01-27 22:09:26 +00:00
Dave Abrahams
6165b71316 [build] clobber freed objects by default in non-optimized builds
When SWIFT_OPTIMIZED is not set, add a little extra memory debugging,
which doesn't seem to slow anything down noticeably and can be disabled
as needed.

This change only affects the CMake build because that's the only place
where SWIFT_RUNTIME_CLOBBER_FREED_OBJECTS is supported already.  We may
want to extend this to the Makefile build.

Swift SVN r13008
2014-01-27 22:09:18 +00:00
Nadav Rotem
5310265dba Devirtualize archetype_method of polymorphic functions.
Patch by Joe.



Swift SVN r13007
2014-01-27 22:01:20 +00:00
Chris Lattner
7f4f94cdbb add missing breaks.
Swift SVN r13006
2014-01-27 21:55:39 +00:00
Connor Wakamo
38e1fd44af [frontend] Added support for -disable-llvm-arc-opts.
Adjusted how this option is handled: it is now set in IRGenOptions. If set,
this prevents the relevant passes from being added at all, instead of making
them no-ops.

Swift SVN r13005
2014-01-27 21:22:46 +00:00
Michael Gottesman
9946080888 [sil-mode] Add highlighting for sil_witness_table.
Swift SVN r13004
2014-01-27 21:01:10 +00:00
Jordan Rose
5faec6e183 Don't crash when forward-referencing a local variable.
Since we type-check local variables in statement order in a function, but
resolve names on a whole-scope basis, we can end up with a name that refers
to a local variable before its declaration has been reached. If this happens,
the variable won't have a type.

Checking this correctly may require comparing the order of statements in a
syntactic scope, but for now, just emit an error message if a reference
ever resolves to a variable without a type. (Note that UnqualifiedLookup
will have already tried to validate the decl, so if it's a global we just
haven't seen yet there's not a problem.)

Unfortunately, we won't get this right for top-level variables in script
source files, since those are still stored at global context and can be
validated on demand. They're never uninitialized, but zero-initialization
may not be valid for all global kinds.

<rdar://problem/15912025>

Swift SVN r13003
2014-01-27 20:37:04 +00:00
Argyrios Kyrtzidis
e94473255a [IDE] Make sure code-completion still works inside a function even if there is an error, like unresolved type-name,
in the function signature.

Swift SVN r13002
2014-01-27 20:08:27 +00:00
Manman Ren
eaad8df51a SILSerializer: handle SILWitnessTable.
We add two records in sil_block to specify a witness table record and a method
entry record. Out of the four entry types, only "Method" is handled in this
commit.

Two records are also added to sil_index_block to search for a specific witness
table given a unique identifier. The interface lookupWitnessTable is not
implemented yet.

Right now, we serialize a witness table only when sil-serialize-all is on and
deserialize all witness tables in the module when sil-link-all is on.

rdar://15722175


Swift SVN r13000
2014-01-27 19:30:43 +00:00
Joe Groff
1bfa0202d2 Revert "runtime: Use hashtables for metadata caches."
This reverts commit r12998. It breaks the "fast" buildbot.

Swift SVN r12999
2014-01-27 19:26:00 +00:00
Joe Groff
c93e44a5f3 runtime: Use hashtables for metadata caches.
Using a linked list for metadata caches is pretty lame. Pull in llvm::DenseMap and hash_combine_range and use them to index instantiated metadata.

Swift SVN r12998
2014-01-27 19:08:33 +00:00
John McCall
630cec9612 Got the release-note schema wrong, sorry.
Swift SVN r12997
2014-01-27 18:54:27 +00:00
John McCall
217f111be6 Add a release note for computed type properties of classes and
generic types.

Swift SVN r12996
2014-01-27 18:52:08 +00:00
Chris Lattner
5b0ecdace1 This went with r12994
Swift SVN r12995
2014-01-27 17:57:54 +00:00
Chris Lattner
929ad99f08 Clean up and generalize the code pertaining to how a FuncDecl accessor
knows about the AbstractStorageDecl it works on.  NFC.



Swift SVN r12994
2014-01-27 17:57:38 +00:00
Michael Gottesman
49b0668831 Remove alloc_ref with simple destructors and only store users.
This pass attempts to remove alloc_ref and everything that uses the alloc_ref
if:

1. The alloc_ref has a destructor which we can very does not have escaping side
effects.
2. The alloc_ref does not have any non-trivial uses that are not stores.

It reduces ObjInst on my cpu from 10206922128 ns to 46 ns (i.e. nothing).

Swift SVN r12990
2014-01-27 08:59:20 +00:00