Commit Graph

1105 Commits

Author SHA1 Message Date
Michael Gottesman
8f3fe63fed [no-implicit-copy] Rename SILMoveOnlyType -> SILMoveOnlyWrappedType.
Since I am beginning to prepare for adding real move only types to the language,
I am renaming everything that has to do with copyable types "move only wrapped"
values instead of move only. The hope is this reduces/prevents any confusion in
between the two.
2022-07-01 17:26:13 -07:00
swift-ci
6efe43cbce Merge remote-tracking branch 'origin/main' into rebranch 2022-06-27 10:13:55 -07:00
Zoe Carver
4044b273d1 Merge pull request #59679 from zoecarver/fix-frt-for-debug
[lldb][cxx-interop] Tell LLDB about the extra layer of indireciton for foriegn reference types.
2022-06-27 10:09:10 -07:00
zoecarver
0563889a09 [lldb][cxx-interop] Tell LLDB about the extra layer of indireciton for foriegn reference types. 2022-06-23 14:37:56 -07:00
swift-ci
c2162eda0e Merge remote-tracking branch 'origin/main' into rebranch 2022-06-23 11:34:52 -07:00
Adrian Prantl
7c1c7b6249 Emit debug locations for hop_to_executor instructions.
The function prologue of async funclets inherits its source location
from the hop_to_executor instruction. This makes it easier to produce
logical backtraces, since the PC in logical frames will always point
to the start if the function.

rdar://89776340
2022-06-23 09:40:25 -07:00
swift-ci
7e7803a999 Merge remote-tracking branch 'origin/main' into rebranch 2022-06-15 21:34:18 -07:00
Adrian Prantl
92d7e63306 Unique the debug info function declarations for Swift runtime failure messages.
This reduces the size of the debug info of (random benchmark)
_StringProcessing.o by 1600 bytes. Modules with more arithmetic should
benefit more.

rdar://94060085
2022-06-15 08:35:16 -07:00
swift-ci
22dd6786a8 Merge remote-tracking branch 'origin/main' into rebranch 2022-06-03 15:58:11 -07:00
Michael Gottesman
c66061a783 [moveOnly] Add a new SIL specific AST type called SILMoveOnly.
It can only be used in SIL contexts to express that a wrapped type is
MoveOnly.
2022-06-03 11:27:16 -07:00
Ben Barham
65ed78d3e7 Merge branch 'main' into manually-merge-main 2022-06-02 10:14:57 -07:00
Alexis Laferrière
962c3aaea3 [IRGen] Import ASTDemangler.h in both debug and non-debug
This was breaking non-debug builds.

rdar://94234645
2022-06-01 11:16:32 -07:00
swift-ci
7033e33aa3 Merge remote-tracking branch 'origin/main' into rebranch 2022-05-31 14:35:31 -07:00
Slava Pestov
b45e0d1cda IRGen: Add -enable/disable-round-trip-debug-types flag, on by default in asserts builds 2022-05-31 14:45:59 -04:00
Ben Barham
f2e14e4867 [next] Define DEBUG_TYPE after includes
Not sure which LLVM commit added an `#undef` for `DEBUG_TYPE` in a header
transitively included by these files, but it doesn't seem uncommon
for headers to define and undefine their own `DEBUG_TYPE`.

Move `#define DEBUG_TYPE` after the includes to prevent it being
undefined.
2022-05-05 16:25:10 -07:00
Josh Soref
9fa14ca215 Spelling irgen (#42470)
* spelling: abstractable

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: across

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: clazz

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: command

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: components

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: current

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: declared

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: discrimination

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: entities

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: except

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: existential

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: generic

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: initialization

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: initialize

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: inserted

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: instantiate

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: instantiation

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: interfere

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: interferes

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: intrinsic

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: metadata

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: might

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: multiple

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: necessary

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: objective

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: occurrences

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: outlined

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: parameters

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: payload

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: rearchitecting

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: replaceable

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: reverse

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: rewritable

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: shareably

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: specializations

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: speedup

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: template

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: that

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: the

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: transferred

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: uninitialized

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: witness

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
2022-04-21 14:02:03 -07:00
Michael Gottesman
e1c4e1045f [move-function] Update the behavior for debug intrinsics on values in the coroutine frame.
This uses the previous simple dominance dbg info propagation implementation in
the previous commit.

I fix in the next commit the debug info for the last move/reinit in the var
test.
2022-03-21 14:20:53 -07:00
Arnold Schwaighofer
189b0ac5e5 IRGen: Emit the proper linkageName debug info of the containing function for async suspend dispatch thunks
Improvement upon #41645 to emit the async suspend dispatch thunk's debug
info with the `linkageName` of the containing function of the async
await.

rdar://88579737
2022-03-03 15:16:41 -08:00
Michael Gottesman
d03a03efea Merge pull request #41448 from gottesmm/debug-info-move-vars
[move-function] Teach debug info how to handle reinits properly of vars.
2022-02-19 12:51:55 -08:00
Michael Gottesman
65e20e7b2d [move-function] Teach debug info how to handle reinits properly of vars.
This fixes the issues I was in my earlier PR about seeing with vars not getting
appropriate debug info when moved. Now we get the right debug info and in the
dwarf can see the two live ranges of our moved value as we hoped for.

NOTE: I disabled alloc stack hoisting on move_function_debuginfo.swift since it
can result in us eliminating debug info at -Onone when we merge alloc_stack. I
am preparing a separate patch that fixes that issue but hit a lldb problem. This
unblocks this PR from that change since they are not /actually/ related.
2022-02-18 12:59:56 -08:00
Holly Borla
c2594d1338 [FrontendOptions] Remove the -enable-explicit-existential-types flag. 2022-02-17 17:54:59 -08:00
Michael Gottesman
58e2cafa57 [irgen] Add support to IRGenDebugInfo for emitting an llvm.dbg.addr instead of llvm.dbg.declare.
By default, we still use llvm.dbg.declare, so this is an NFC commit. But this
sets us up for using this in the future.
2022-02-15 12:00:31 -08:00
Slava Pestov
aa67c8bf8a Parametrized => parameterized 2022-02-03 13:27:24 -05:00
Slava Pestov
e7e536705e AST: Introduce ParametrizedProtocolType 2022-01-26 00:11:38 -05:00
Doug Gregor
452eccab83 Remove NestedArchetypeType.
Nested archetypes are represented by their base archetype kinds (primary,
opened, or opaque type) with an interface type that is a nested type,
as represented by a DependentMemberType. This provides a more uniform
representation of archetypes throughout the frontend.
2022-01-14 21:28:21 -08:00
Doug Gregor
8df65e706e Remove unnecessary uses of NestedArchetypeType.
`ArchetypeType` has all of the API we need for these cases, so use
that instead to isolate us from `NestedArchetypeType`, which we would
like to eliminate soon-ish.
2022-01-14 21:25:32 -08:00
Holly Borla
992a871a73 [Type Reconstruction] Re-construct existential types with ExistentialType
by propagating whether the decoded type is for a requirement through
TypeDecoder.
2022-01-13 19:31:37 -08:00
Holly Borla
f7a82ac174 [Type Reconstruction] For now, reconstruct existential types without
explicit ExistentialType.

The ASTDemangler needs to produce ExistentialType based on context, not
unconditionally when producing a protocol composition. This is tricky
because existential types are mangled the same way as other protocol
references, e.g. in conformance requirements. For now, drop the explicit
existentials when reconstructing types.
2022-01-13 19:30:44 -08:00
adrian-prantl
324cccd18e Merge pull request #40670 from adrian-prantl/77344315
Fix the module hash stored in -gmodules skeleton units
2021-12-22 11:43:48 -08:00
Adrian Prantl
1adb0b301a Fix the module hash stored in -gmodules skeleton units
by using the proper API. The old code produced the address of the hash.  This
fixes a warning printed by LLDB and dsymutil about module hash mismatches and
makes the build build products more deterministic.

rdar://77344315
2021-12-21 15:53:57 -08:00
Robert Widmann
e5bfda7c6e Merge pull request #40587 from CodaFi/substitute-teacher
Initial Semantics for Variadic Generics
2021-12-20 11:25:25 -08:00
Alex Hoppen
669e3f34a6 Merge pull request #40155 from ahoppen/pr/improve-module-search-path-lookup
[Serialization] Improve module loading performance
2021-12-20 18:09:17 +01:00
Robert Widmann
06bc38f5a2 Model PackExpansion Types
A PackExpansionType is the interface type of the explicit expansion of a
corresponding set of variadic generic parameters.
Pack expansions are spelled as single-element tuples with a single variadic
component in most contexts except functions where they are allowed to appear without parentheses to match normal variadic declaration syntax.

```
func expand<T...>(_ xs: T...) -> (T...)
                        ~~~~     ~~~~~~
```

A pack expansion type comes equipped with a pattern type spelled before
the ellipses - `T` in the examples above. This pattern type is the subject
of the expansion of the pack that is tripped when its variadic generic
parameter is substituted for a `PackType`.
2021-12-16 00:34:09 -08:00
Robert Widmann
746aa1fb58 Model Pack Types
A pack type looks a lot like a tuple in the surface language, except there
is no way for the user to spell a pack. Pack types are created by the solver
when it encounters an apply of a variadic generic function, as in

```
func print<T...>(_ xs: T...) {}
// Creates a pack type <String, Int, String>
print("Macs say Hello in", 42, " different languages")
```

Pack types substituted into the variadic generic arguments of a
PackExpansionType "trip" the pack expansion and cause it to produce a
new pack type with the pack expansion pattern applied.

```
typealias Foo<T...> = (T?...)
Foo<Int, String, Int> // Forces expansion to (Int?, String?, Int?)
```
2021-12-16 00:25:34 -08:00
Alex Hoppen
fe7878ecce [Serialization] Improve module loading performance
When looking for a Swift module on disk, we were scanning all module search paths if they contain the module we are searching for. In a setup where each module is contained in its own framework search path, this scaled quadratically with the number of modules being imported. E.g. a setup with 100 modules being imported form 100 module search paths could cause on the order of 10,000 checks of `FileSystem::exists`. While these checks are fairly fast (~10µs), they add up to ~100ms.

To improve this, perform a first scan of all module search paths and list the files they contain. From this, create a lookup map that maps filenames to the search paths they can be found in. E.g. for
```
searchPath1/
  Module1.framework

searchPath2/
  Module1.framework
  Module2.swiftmodule
```
we create the following lookup table
```
Module1.framework -> [searchPath1, searchPath2]
Module2.swiftmodule -> [searchPath2]
```
2021-12-14 12:44:13 +01:00
Holly Borla
445a856652 [Type System] Introduce a dedicated type to represent existential types.
The new type, called ExistentialType, is not yet used in type resolution.
Later, existential types written with `any` will resolve to this type, and
bare protocol names will resolve to this type depending on context.
2021-12-09 23:14:50 -08:00
Robert Widmann
e7e11df927 Model Sequence Archetypes 2021-11-16 11:38:57 -08:00
Adrian Prantl
bc8bb830a8 Add support for relative paths in debug prefix maps.
Users may want to use -fdebug-prefix-map to remap a directory to "./".
This wasn't supported previously and resulted in duplicate path
prefixes in the debug info.

With this patch swiftc behaves similar to clang when remapping a path
to a relative path.

rdar://83753143
2021-11-04 11:17:52 -07:00
zoecarver
bd71c84bd8 [cxx-interop] Disable round trip checking for C++ debug types.
This doesn't work for some C++ types, so, as a stop gap solution, I'm disabling it when C++ interop is enabled.

https://bugs.swift.org/browse/SR-15377 to re-enable it in the future.
2021-10-22 14:41:45 -07:00
Ellie Shin
5277a769e2 Merge pull request #39634 from apple/es-m5
Module aliasing: use module real name to create DIModule
2021-10-13 12:10:33 -07:00
elsh
317a766a80 Module aliasing: use module real name to create DIModule 2021-10-07 15:16:13 -07:00
Adrian Prantl
0e83389e35 Wrap assertion code in infndef NDEBUG to fix non-asserts build. 2021-09-24 14:48:22 -07:00
Adrian Prantl
dc50c93301 Handle missing DIExprOperator kinds in IRGenDebugInfo 2021-09-17 17:37:56 -07:00
Adrian Prantl
eb2b7ba4b8 Fix local variable uniquing to take into account tail-allocated variable names 2021-09-17 17:36:25 -07:00
Adrian Prantl
fd19e4bc07 Distinguish between storage size of a fragment and storage size for the entire
type in DebugTypeInfo.
2021-09-17 15:57:27 -07:00
Adrian Prantl
ea6dca3e94 Fix SIL Verifier 2021-09-10 17:07:02 -07:00
Min-Yih Hsu
69ffafe146 (Stash) Salvage debug info from deleted index_addr instruction
And calling `swift::salvageDebugInfo` in more places.

NOTE: The latter change seems to break stdlib build.
2021-09-10 14:17:38 -07:00
Min-Yih Hsu
a9cb668170 (Stash) basic IRGen support 2021-09-10 14:17:38 -07:00
Adrian Prantl
399a8b4864 Fix build for older compilers 2021-09-03 17:46:16 -07:00
Adrian Prantl
06c409d324 IRGenDebugInfo: Unique DILocalVariables. 2021-09-03 17:38:32 -07:00