Commit Graph

2401 Commits

Author SHA1 Message Date
Slava Pestov
3933d8a4f0 SIL: getAbstractionPattern(var) never returns opaque pattern, NFC 2015-12-22 15:30:16 -08:00
Max Moiseev
a7339e67ac Merge remote-tracking branch 'origin' into swift-3-api-guidelines 2015-12-22 11:36:07 -08:00
ken0nek
fcd8fcee91 Convert [Cc]an not -> [Cc]annot 2015-12-23 00:55:48 +09:00
practicalswift
36d7072013 Remove immediately adjacent repeated words ("the the", "for for", "an an", etc.). 2015-12-21 22:16:04 +01:00
Max Moiseev
2f7b64e475 Merge remote-tracking branch 'origin' into swift-3-api-guidelines 2015-12-21 12:02:13 -08:00
Dmitri Gribenko
1e6e124326 Merge pull request #692 from practicalswift/fix-incorrect-filenames
Fix incorrect filenames in headers
2015-12-21 00:00:43 -08:00
practicalswift
cd7d8dfaff Fix alignment as requested by @gribozavr in #692 2015-12-21 08:54:24 +01:00
Xin Tong
a6639667b6 Fix a bug in expandTypeIntoNodeProjectionPaths. This is exposed by the bug fixed in
a630f5942e.

Existing tests ensure correctness.
2015-12-20 23:39:41 -08:00
Slava Pestov
8e0e2b4ea2 SIL: Nuke TypeConverter::getEffectiveGenericParamsForContext(), NFC 2015-12-20 16:57:23 -08:00
Mark Lacey
4b0cb97590 Remove SILExternalSource.
This was once used in lldb but no longer is. I'm cannot find any other
users, so I'm removing it as a small part of cleaning up and simplifying
the SIL linking process.
2015-12-20 16:37:02 -08:00
practicalswift
176f487d76 Fix incorrect filenames in headers. 2015-12-20 23:59:05 +01:00
Michael Gottesman
2bd30ed666 [sil-printer] Refactor out the printing logic for printing of a SILLocation into its own method. NFC. 2015-12-19 23:14:32 -06:00
Michael Gottesman
727b6c0dde [sil-printer] Refactor out printing of silvalue use lists into its own function and do some small cleanups. NFC. 2015-12-19 23:14:32 -06:00
Emanuel Zephir
40d61cb8c8 [SIL] support undef cases in switch_value instructions
This change adds support for undefined cases in the switch_value
instruction. Fixes SR-210.
2015-12-18 15:05:17 -08:00
Doug Gregor
a97ab6dd14 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2015-12-18 10:15:47 -08:00
Dmitri Gribenko
6a66b3cff8 Merge pull request #561 from practicalswift/typos-again
[Typo] Replace PR#514-525 with one large PR
2015-12-18 03:37:02 -08:00
Max Moiseev
3fe0c60d7f Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2015-12-17 11:00:02 -08:00
Michael Gottesman
8ec7dec575 Add a comment to the verifier that explains that if cond_br is ever changed to take something different than an i1, then the ARC optimizer will need to be changed. 2015-12-16 21:33:21 -06:00
Xin Tong
1af8b0cde3 Fix a logic error in creating forwardable values out of multiple LSValues with identical base but
empty projection paths.

Bug exposed by disabling SROA.

rdar://23825001
2015-12-16 15:25:06 -08:00
practicalswift
8ab8847684 Fix typos. 2015-12-16 22:09:32 +01:00
Slava Pestov
d6ea5d8717 Sema: Chain all generic parameter lists
Previously, methods on DeclContext for getting generic parameters
and signatures did not walk up from type contexts to function
contexts, or function contexts to function contexts.

Presumably this is because SIL doesn't completely support nested
generics yet, instead only handling these two special cases:

- non-generic local function inside generic function
- generic method inside generic type

For local functions nested inside generic functions, SIL expects
the closure to not have an interface type or generic signature,
even if the contextual type signature contains archetypes.
This should probably be revisited some day.

Recall that these cases are explicitly rejected by Sema diagnostics
because they lack SIL support:

- generic function inside generic function
- generic type inside generic function

After the previous patches in this series, it becomes possible to
construct types that are the same as before for the supported uses of
nested generics, while introducing a more self-consistent conceptual
model for the unsupported cases.

Some new tests show we generate diagnotics in various cases that
used to crash.

The conceptual model might still not be completely right, and of
course SIL, IRGen and runtime support is still missing.
2015-12-16 11:32:56 -08:00
Max Moiseev
2021dd5a4d Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2015-12-15 12:49:22 -08:00
Michael Gottesman
f3c8c5a774 Create SILBasicBlock::getSuccessorBlocks().
This just runs a transform range on getSuccessor()'s ArrayRef<SILSuccessor> so
one does not need to always call Successor.getBB() when iterating over successor
blocks. Instead the transform range does that call for you.

I also updated some loops to use this new SILBasicBlock method to make sure that
the code is tested out by tests that are already in tree. All these places
should be functionally the same albeit a bit cleaner.
2015-12-15 00:36:56 -06:00
Adrian Prantl
b801eb9606 Actually initialize the "Constant" bitfield in TailAllocatedDebugVariable.
Impressively, this only cause the testsuite to fail in <1% of all runs.
2015-12-14 15:39:56 -08:00
Max Moiseev
806be29941 Merge remote-tracking branch 'origin' into swift-3-api-guidelines 2015-12-14 12:05:35 -08:00
Arnold Schwaighofer
6bac8ab9e6 Add canDuplicate() to LoopInfo
To determine whether it is safe to duplicate the instruction by duplicating the
loop body. Will be used in loop versioning for array and loop unrolling.
2015-12-14 12:03:41 -08:00
Adrian Prantl
64cbec3805 Add SIL syntax for declaring debug variables.
Debug variable info may be attached to debug_value, debug_value_addr,
alloc_box, and alloc_stack instructions.

In order to write textual SIL -> SIL testcases that exercise the handling
of debug information by SIL passes, we need to make a couple of additions
to the textual SIL language. In memory, the debug information attached to
SIL instructions references information from the AST. If we want to create
debug info from parsing a textual .sil file, these bits need to be made
explicit.

Performance Notes: This is memory neutral for compilations from Swift
source code, because the variable name is still stored in the AST. For
compilations from textual source the variable name is stored in tail-
allocated memory following the SIL instruction that introduces the
variable.

<rdar://problem/22707128>
2015-12-14 10:29:50 -08:00
Dmitri Gribenko
212cb4a65c Merge pull request #533 from practicalswift/remaining-typos-replaces-batch-12-and-17
Fix typos (12 of 30, 16 of 30)
2015-12-14 08:43:27 -08:00
Emil
69d8dde02a Typo fixes 2015-12-14 16:15:20 +02:00
practicalswift
c6e8459187 Fix typos. 2015-12-14 11:13:30 +01:00
Dmitri Gribenko
c8b67f6f6c Merge pull request #511 from practicalswift/fix-typos-15
Fix typos (15 of 30)
2015-12-14 01:08:44 -08:00
Dmitri Gribenko
cbb098179c Merge pull request #505 from practicalswift/fix-typos-9
Fix typos (9 of 30)
2015-12-13 20:16:51 -08:00
Dmitri Gribenko
ac57add3a2 Merge pull request #504 from practicalswift/fix-typos-8
Fix typos (8 of 30)
2015-12-13 20:11:40 -08:00
practicalswift
baf583a5d0 Fix typo: immmediate → immediate 2015-12-14 00:11:52 +01:00
practicalswift
e4219b39fc Fix typo: decleration → declaration 2015-12-14 00:11:34 +01:00
practicalswift
473cf737bd Fix typo: decement → decrement 2015-12-14 00:11:33 +01:00
practicalswift
2216224943 Fix typo: currenty → currently 2015-12-14 00:11:32 +01:00
practicalswift
ff03d6faff Fix typo: arugment → argument 2015-12-14 00:11:14 +01:00
Xin Tong
3b62b2f15c Rename reduceWithValues to LSValue::reduce 2015-12-13 11:37:34 -08:00
Xin Tong
27b5a40359 Rename MemLocation to LSLocation and LoadStoreValue to LSValue 2015-12-13 10:02:45 -08:00
Xin Tong
642a555a6c Rename MemLocation.h to SILValueProjection.h 2015-12-13 09:31:56 -08:00
Xin Tong
6a5c8701c6 Create a common createExtract function used across DSE and RLE 2015-12-13 09:19:54 -08:00
Xin Tong
7559f2013d Implement a LoadStoreValue vault so that every basic block keeps an
unsigned index instead of the real LoadStoreValue in RLE
2015-12-13 09:10:32 -08:00
Max Moiseev
786e1ea2b1 Merge remote-tracking branch 'origin' into swift-3-api-guidelines 2015-12-11 15:19:02 -08:00
Slava Pestov
832a637c04 SIL: Start cleaning up getMethodDispatch() / requiresObjCDispatch()
Move these to SILDeclRef, maybe not the best place but a good home for now.
Factor out a new requiresForeignToNativeThunk() function, which cleans up
some code duplication introduced by the following patch:

478e1c7513

This is a small step towards consolidating duplicated logic for figuring out
method dispatch semantics and emitting curry thunks.
2015-12-11 08:58:52 -08:00
Slava Pestov
0a072484ec SILGen: Emit enum case constructors lazily
Now that we open-code enum construction, enum constructor entry points are
only needed when they are partially-applied, which is a rare case. So we
treat them like curry thunks and only emit them as needed.

The main consequence of this is that enum case constructors are no longer
part of our ABI.

To avoid a regression in the code path for diagnosing infinite value types,
force type lowering to walk a type when emitting its declaration, even if
there are no other references to the type in the program (which is now the
case for public enums which are otherwise not used).

Also XFAIL a DebugInfo test since it is not clear to me what the test does
or how to fix it. The obvious change of adding references to the enum
case constructor function to force it to be emitted did not work.
2015-12-10 16:39:48 -08:00
Slava Pestov
478e1c7513 Partial application of @objc protocol methods 2015-12-10 16:39:48 -08:00
David Farler
e6d1d9748b SILGen: Use the base SILDeclRef for super_method override constant info
getOverriddenVTableEntry only goes one level up in the class hierarchy,
but getConstantOverrideInfo requires that the next level up not itself be an
override.

A little bit of refactoring:

SILDeclRef::getOverriddenVTableEntry()
  -> SILDeclRef::getNextOverriddenVTableEntry()

static findOverriddenFunction()
  -> SILDeclRef::getBaseOverriddenVTableEntry()

rdar://problem/22749732
2015-12-10 15:47:50 -08:00
Mark Lacey
b37bc91506 Remove unused callback from SIL linker.
This was once used to maintain the call graph when lazy linking was
happening, but all that is gone now.
2015-12-10 15:12:41 -08:00
David Farler
09c6210afa SILGen: Use vtable thunk abstraction for super_method instructions
The constant provided to the callee for super methods reference the
backing implementation, but the vtable entry may point to a thunk with
different abstraction when using mixed concrete and generic classes in
the hierarchy. The SIL devirtualizer expects super method references to
match what's in the vtable.

Also update the verifier for SuperMethodInst types - before it required
that the types be the same, but they may not be for the same reasons noted
above. Instead, do a similar check as for ClassMethodInst.

https://bugs.swift.org/browse/SR-134
2015-12-10 13:53:09 -08:00