Commit Graph

2682 Commits

Author SHA1 Message Date
Vedant Kumar
e326728ee4 Merge pull request #9108 from vedantk/master
[Coverage] Emit a profiler increment in ObjC destructors
2017-04-28 18:08:45 -07:00
Vedant Kumar
ecae403c24 [Coverage] Emit a profiler increment in ObjC destructors
The compiler emits profiler increments in destructors for pure-Swift
classes, but not in destructors for classes that inherit from ObjC
classes. Add in increments for the second kind of destructor.

rdar://problem/29139109
2017-04-28 13:38:17 -07:00
Slava Pestov
3130c3cbd7 AST: Remove an overload of GenericSignature::getSubstitutions() 2017-04-28 13:26:02 -07:00
John McCall
338825e73d Fix the emission of r-value pointer conversions to delay the
conversions and extend lifetimes over the call.

Apply this logic to string-to-pointer conversions as well as
array-to-pointer conversions.

Fix the AST verifier to not blow up on optional pointer conversions,
and make sure we SILGen them correctly.  There's still an AST bug
here, but I'll fix that in a follow-up patch.
2017-04-26 14:15:44 -04:00
Andrew Trick
a0653e8bf7 [Exclusivity] Use "unsafe" access for debugger (lldb) variables. 2017-04-25 15:57:15 -07:00
John McCall
e9fed042b8 Merge pull request #8994 from rjmccall/delay-inout-to-pointer-access
Delay the formal accesses associated with pointer conversions until the call
2017-04-25 12:58:37 -04:00
swift-ci
5a706e87ec Merge pull request #8993 from CodaFi/row-row-row-your-boat 2017-04-25 07:29:11 -07:00
John McCall
f7e73ccc48 Delay the formal accesses associated with inout-to-pointer and
array-to-pointer argument conversions until just before the call.

rdar://31781386
2017-04-25 03:54:49 -04:00
John McCall
e6d52d8808 LValueToPointerExpr is dead code. RIP LValueToPointerExpr. 2017-04-25 03:01:16 -04:00
Robert Widmann
ede48cd58f [NFC] Minor cleanup in patterns
Some things noticed by inspection:

- Old spelling of Optional.some
- pattern dump was using the wrong iterator variable and would crash
- addColumns is never used because the row matrix doesn’t expand tuples
2017-04-25 00:34:10 -04:00
Michael Gottesman
a89752f77a [gardening] Eliminate unused variable warnings from non-asserts build. 2017-04-24 16:08:06 -07:00
Slava Pestov
0290c2d5d8 AST: Make GenericSignature and GenericEnvironment SubstitutionMaps interchangable
SubstitutionMap::lookupConformance() would map archetypes out
of context to compute a conformance path. Do the same thing
in SubstitutionMap::lookupSubstitution().

The DenseMap of replacement types in a SubstitutionMap now
always has GenericTypeParamTypes as keys.

This simplifies some code and brings us one step closer to
a more efficient representation of SubstitutionMaps.
2017-04-24 14:12:36 -07:00
Andrew Trick
48ecd6d563 [Exclusivity] Enable SILGen access marker emission by default.
This has no measurable effect on benchmarks and does not affect
standard library compile time.
2017-04-24 08:32:15 -07:00
Andrew Trick
8366c613d3 [SILGen] Disable the lvalue-to-lvalue peephole optimization by default. 2017-04-24 08:32:15 -07:00
John McCall
0d4e0a961d Fix the writeback-conflict diagnostic to look through access markers.
We're now double-diagnosing some things that are caught by both
SILGen and static enforcement; we can fix that later, but I want to
unblock this problem first.
2017-04-24 02:02:47 -04:00
Slava Pestov
683a7f49e4 SILOptimizer: Fix spurious 'unreachable code' warning when a failable initializer calls a never-returning function
This came up recently with the protocol-oriented integer
work in the standard library.

Fixes <https://bugs.swift.org/browse/SR-4673>.
2017-04-23 02:15:57 -07:00
John McCall
978f0e05fe Add unpaired access marker instructions and use them to implement
dynamic access tracking in materializeForSet.
2017-04-22 22:52:13 -04:00
Joe Groff
3d178be169 Merge pull request #8875 from jckarter/keypaths
Keypaths
2017-04-21 17:51:17 -07:00
Joe Groff
d5cdf658da KeyPaths: Generate _kvcKeyPathString for ObjC-compatible keypaths. 2017-04-21 16:56:17 -07:00
practicalswift
797c2d8118 [gardening] Fix end of namespace comments 2017-04-20 22:01:01 +02:00
practicalswift
a596961187 [gardening] Make parameter name comments match actual parameter names 2017-04-20 13:47:10 +02:00
practicalswift
431e5a1440 [gardening] Use consistent end of namespace comments 2017-04-20 13:47:10 +02:00
Slava Pestov
f4b91cd118 AST: Remove unused 'resolver' argument from TypeBase::getSuperclass() 2017-04-20 00:37:38 -07:00
Joe Groff
517c45aa3d Followups from merging master 2017-04-19 20:58:52 -07:00
Joe Groff
595e0e4ede Merge branch 'master' into keypaths 2017-04-19 18:38:24 -07:00
Doug Gregor
51e00597d3 Minor cleanup in extracting interface type for a conformance. 2017-04-18 23:37:41 -07:00
Doug Gregor
8584e97408 [AST] Sink ProtocolConformance::getWitness() down into NormalProtocolConformance.
NormalProtocolConformance has the only correct implementation of this
functionality. Instead, providing a safer getWitnessDecl() that
doesn't promise substitutions that are incorrect (and not actually
used by any clients).
2017-04-18 23:35:24 -07:00
Doug Gregor
ebdd56a1f0 [AST] Eliminate the "interface type" from protocol conformances.
We don't need this notion.
2017-04-18 17:15:15 -07:00
Joe Groff
4522cd09aa SILGen: Tweak key path computed property lowering to produce a consistent runtime-callable ABI. 2017-04-18 11:44:39 -07:00
practicalswift
7eb7d5b109 [gardening] Fix 100 typos. 2017-04-18 17:01:42 +02:00
Michael Gottesman
aa76c2a5e6 [silgen] (mark_uninitialized (project_box (alloc_box))) -> (project_box (mark_uninitialized (alloc_box)))
I put in a simple fixup pass (MarkUninitializedFixup) for staging purposes. I
don't expect it to be in tree long. I just did not feel comfortable fixing up in
1 commit all of the passes up to DI.

rdar://31521023
2017-04-17 17:45:54 -07:00
Michael Gottesman
6846b89e90 [silgen] Instead of creating our own mark_uninitialized, use the new emitLocalVariableWithCleanup API. 2017-04-14 18:55:26 -07:00
Michael Gottesman
081f2396e5 [silgen] Refactor emitLocalVariableWithCleanup to take an optional MarkUninitializedKind instead of a bool.
This enables me to refactor some code in SILGenConstructor. Specifically this
code passes in a false for uninitialized and then creates the mark uninitialized
for itself.
2017-04-14 18:55:20 -07:00
Doug Gregor
faa0401598 [GSB] Allow requirement inference for synthesized requirements. 2017-04-14 17:19:02 -07:00
Joe Groff
ee66ff35c5 SILGen: Lower computed property key path components. 2017-04-14 17:13:38 -07:00
Michael Gottesman
192b2ac269 Merge pull request #8778 from jckarter/where-clause-var-swap
SILGen: Push 'usingImplicitVariablesForPattern' hack into 'where' clause expr evaluation.
2017-04-14 14:06:35 -07:00
Huon Wilson
754d74ab8f Merge pull request #8753 from huonw/open-public-class-methods
Only `open`, not `public`, classes need public symbols
2017-04-14 13:35:00 -07:00
Joe Groff
dfdece2ab6 SILGen: Push 'usingImplicitVariablesForPattern' hack into 'where' clause expr evaluation.
We swapped the pattern variables at the wrong level, leaving them bound incorrectly on the cleanup path through a failed 'where' clause check. Fixes rdar://problem/31539726.
2017-04-14 11:58:38 -07:00
Slava Pestov
e4905b942a Merge pull request #8770 from slavapestov/anyobject-removal-preparations
AnyObject removal preparations
2017-04-13 23:46:37 -07:00
Slava Pestov
d58f049608 AST: Introduce ASTContext::getAnyObjectType()
This replaces a number of usages of KnownProtocolKind::AnyObject,
which is soon going away.
2017-04-13 21:17:05 -07:00
John McCall
5c725e6c2f Access markers for class properties (other than materializeForSet). 2017-04-14 00:09:55 -04:00
swift-ci
e7358a9ca1 Merge pull request #8750 from devincoughlin/exclusive-access-peephole 2017-04-13 15:28:32 -07:00
Huon Wilson
b59f95418c [SIL] Extract ClassVisibility from SILFunction to SubclassScope in SILLinkage. 2017-04-13 14:17:29 -07:00
Devin Coughlin
df2239e8a5 [SILGen] Disable emitAssignLValueToLValue peephole when enforcing exclusivity
The peephole causes the the formal access to the source and destination to
overlap. This results in unwanted exclusive access conflicts when assigning
from one struct stored property to another.

At John's suggestion I've added an isObviouslyNonConflicting() helper
method on LValue that tells when when it is safe to use the peephole
even when exclusivity enforcement enabled. For now, the helper is toothless. It
can be extended to claw back some of the peephole opportunities.
2017-04-13 13:51:24 -07:00
Slava Pestov
ec8c809e76 SILGen: Don't pick apart Substitutions
While it is currently true that the first entry in a SubstitutionList
of a protocol requirement is the Self type, this was not always true
in the past, and it might change again in the future. Don't rely on
this behavior.
2017-04-13 13:45:55 -07:00
Slava Pestov
4da14393fa SILGen: Catch an unnecessary mapTypeIntoContext() call 2017-04-13 13:45:54 -07:00
Slava Pestov
4cd5eb708a Fix a memory error introduced by recent changes
ExistentialLayout::getProtocols() can return an interior
pointer if the layout describes a single protocol type.

In this case we must not hold on to the result after
the layout goes out of scope.

Fix a few places where this was happening, which should
address a test failure we've been seeing.

Fixes <rdar://problem/31586433>.
2017-04-13 07:22:54 -07:00
Joe Groff
d6ced9d9e4 SIL: Rework KeyPathInst to accommodate computed components.
- Separate out a uniquable KeyPathPattern that describes the context-free shape of the key path, with generic parameters and (eventually) subscript index slots factored out.
- Add component kinds for gettable and settable properties.
2017-04-12 20:09:17 -07:00
Slava Pestov
374db66e8b Merge pull request #8685 from slavapestov/subclass-existentials-silgen
Preliminary SILGen support for subclass existentials (SE-0156)
2017-04-12 11:44:23 -07:00
Arnold Schwaighofer
69e6f07167 Merge pull request #8701 from aschwaighofer/wip_ast_silgen_const_string_literal
AST/SILGen support for constant string literals
2017-04-12 09:52:18 -07:00