Commit Graph

6754 Commits

Author SHA1 Message Date
Manu
02b5fa2c8e Fix some typos in the codebase 2023-08-31 18:50:10 -03:00
Sophia Poirier
86d368f364 Merge remote-tracking branch 'upstream/main' into fix-rebranch-automerger 2023-08-31 14:10:52 -07:00
Michael Gottesman
ba06693745 Merge pull request #68228 from gottesmm/pr-088dba5d9c0854c0e00da0603eb99b770d99709c
[move-only] Rename mark_must_check -> mark_unresolved_non_copyable_value
2023-08-31 09:50:55 -07:00
swift-ci
39b640ce1b Merge remote-tracking branch 'origin/main' into rebranch 2023-08-31 09:05:17 -07:00
Slava Pestov
d2f1dedd35 Merge pull request #68220 from slavapestov/remove-get-protocol-self-type
Remove DeclContext::getSelfProtocolType()
2023-08-31 11:39:17 -04:00
Michael Gottesman
37d60a08bb [move-only] Rename mark_must_check -> mark_unresolved_non_copyable_value.
I was originally hoping to reuse mark_must_check for multiple types of checkers.
In practice, this is not what happened... so giving it a name specifically to do
with non copyable types makes more sense and makes the code clearer.

Just a pure rename.
2023-08-30 22:29:30 -07:00
Slava Pestov
361d49a843 AST: Remove DeclContext::getSelfProtocolType() 2023-08-30 15:15:08 -04:00
swift-ci
5917128695 Merge remote-tracking branch 'origin/main' into rebranch 2023-08-29 21:13:49 -07:00
John McCall
804eac63f2 Merge pull request #68191 from rjmccall/wip2-variadic-arg-translation
More progress towards variadic-tuple argument reabstraction
2023-08-29 23:57:16 -04:00
John McCall
acece4c35f [NFC] Push cleanup management through a few reabstraction utilities 2023-08-29 18:11:08 -04:00
John McCall
bdaada6c55 Add a utility to generate a known-trivial load 2023-08-29 14:23:28 -04:00
swift-ci
27c3fe527c Merge remote-tracking branch 'origin/main' into rebranch 2023-08-29 09:33:49 -07:00
Pavel Yaskevich
e96f9e5b33 [SILGen] InitAccessors: Materialize default argument if it's required by init/setter
We do this in `GetterSetterComponent` but overlooked it for default initialization
expressions. If init/setter require `newValue` to be passed indirectly we have to
make sure to materialize it before handing to `assign_or_init` instruction.

Resolves: rdar://114350227
2023-08-28 17:04:53 -07:00
swift-ci
0b0bb0b8b7 Merge remote-tracking branch 'origin/main' into rebranch 2023-08-28 09:55:22 -07:00
Pavel Yaskevich
fce0d33714 Merge pull request #68155 from xedin/issue-67827
[SILGen] InitAccessors: Make sure that `assign_or_init` always directly references self
2023-08-28 09:36:53 -07:00
John McCall
60d2a93209 [NFC] result -> inner, for consistency 2023-08-28 12:27:36 -04:00
John McCall
c1f110c8e8 Generalize the handling of pack cleanups in reabstraction thunks
The result-reabstraction code doesn't need to handle cleanups properly
during the planning phase because of course we don't have any values
yet.  That is not true of argument reabstraction, so we need to make
sure that the recursive emitters can produce values with cleanups
so that we can collect and forward those cleanups correctly when
emitting the call.

As part of this, I've changed the code so that it should forward
outer addresses to inner address more consistently; it wouldn't
have done this before if we were breaking apart or assembling
a pack.  I'm not sure I can directly test this without figuring
out a way to get SILGen to reabstract both sides of a function,
though.

I'm not sure this is really doing borrowed vs owned arguments
correctly, if e.g. we need to rebstract one component of a tuple
that's otherwise borrowed.
2023-08-28 12:27:36 -04:00
John McCall
6dc298a80f [NFC] Split the inner/outer vanishing tuple handling
I'm going to change the type signature for inner tuples,
so this isn't going to work.
2023-08-28 12:25:17 -04:00
John McCall
8a5bfd5701 [NFC] Be more precise in some parameter types 2023-08-28 12:25:17 -04:00
John McCall
fb6a811fe9 [NFC] Allow the pack input value to be "written back" to the generator
This will be necessary in order to adopt this in TranslateArguments.
2023-08-28 12:25:17 -04:00
John McCall
5d588012f4 Add an explicit test for an invalid ManagedValue. 2023-08-28 12:25:15 -04:00
Pavel Yaskevich
10947decec [SILGen] InitAccessors: Make sure that assign_or_init always directly references self
`nonmutating set` gets a copy of "self" in `GetterSetterComponent`
which is expected for partial application of the setter but doesn't
work for "self" reference that `assign_or_init` instruction needs
to emit references to stored properties during lowering. We need to
make sure that "self" is always a reference to rootself of the
constructor before passing it to `assign_or_init`.

Resolves: https://github.com/apple/swift/issues/67827
Resolves: rdar://114433261
2023-08-25 15:32:50 -07:00
Nate Chandler
6ccd08b4e0 Merge branch 'main' into rebranch.
Resolve conflicts introduced in
https://github.com/apple/swift/pull/67944 as follows:

```
diff --git a/include/swift/Runtime/RuntimeFunctions.def b/include/swift/Runtime/RuntimeFunctions.def
index 3c973b5884b..44cde707d17 100644
--- a/include/swift/Runtime/RuntimeFunctions.def
+++ b/include/swift/Runtime/RuntimeFunctions.def
@@ -2537,16 +2537,10 @@ FUNCTION(AutoDiffCreateLinearMapContextWithType,
          swift_autoDiffCreateLinearMapContextWithType, SwiftCC,
          DifferentiationAvailability,
          RETURNS(RefCountedPtrTy),
-<<<<<<< HEAD
-         ARGS(SizeTy),
+         ARGS(TypeMetadataPtrTy),
          ATTRS(NoUnwind),
          EFFECT(AutoDiff),
          MEMEFFECTS(ArgMemOnly))
-=======
-         ARGS(TypeMetadataPtrTy),
-         ATTRS(NoUnwind, ArgMemOnly),
-         EFFECT(AutoDiff))
->>>>>>> public-github/main

 // void *swift_autoDiffProjectTopLevelSubcontext(AutoDiffLinearMapContext *);
 FUNCTION(AutoDiffProjectTopLevelSubcontext,
@@ -2563,16 +2557,10 @@ FUNCTION(AutoDiffAllocateSubcontextWithType,
          swift_autoDiffAllocateSubcontextWithType, SwiftCC,
          DifferentiationAvailability,
          RETURNS(Int8PtrTy),
-<<<<<<< HEAD
-         ARGS(RefCountedPtrTy, SizeTy),
+         ARGS(RefCountedPtrTy, TypeMetadataPtrTy),
          ATTRS(NoUnwind),
          EFFECT(AutoDiff),
          MEMEFFECTS(ArgMemOnly))
-=======
-         ARGS(RefCountedPtrTy, TypeMetadataPtrTy),
-         ATTRS(NoUnwind, ArgMemOnly),
-         EFFECT(AutoDiff))
->>>>>>> public-github/main
```
2023-08-24 16:24:32 -07:00
Kshitij Jain
d5a3e2e630 [AutoDiff] Fixes memory leaks in autodiff linear map context allocation builtins (#67944)
When the differentiating a function containing loops, we allocate a linear map context object on the heap. This context object may store non-trivial objects, such as closures, that need to be released explicitly. Fix the autodiff linear map context allocation builtins to correctly release such objects and not just free the memory they occupy.
2023-08-24 13:57:10 -07:00
swift-ci
cd68190154 Merge remote-tracking branch 'origin/main' into rebranch 2023-08-23 23:54:50 -07:00
Nate Chandler
91159ae217 [Gardening] Removed stray comment. 2023-08-23 21:01:58 -07:00
swift-ci
5d54a7f351 Merge remote-tracking branch 'origin/main' into rebranch 2023-08-23 15:54:22 -07:00
nate-chandler
49865f2ec6 Merge pull request #68054 from nate-chandler/opaque-values/20230821/2/closures
[OpaqueValues] Fix closure handling.
2023-08-23 15:44:47 -07:00
swift-ci
c02995a96d Merge remote-tracking branch 'origin/main' into rebranch 2023-08-23 07:13:33 -07:00
Nate Chandler
49e76caca5 [OpaqueValues] Consume addr-only vars as loadable. 2023-08-22 17:41:15 -07:00
swift-ci
cfbc45c563 Merge remote-tracking branch 'origin/main' into rebranch 2023-08-22 16:54:30 -07:00
Nate Chandler
8c48ca2e8c [OpaqueValues] Addr-only consumes emit loadably. 2023-08-22 11:18:44 -07:00
Nate Chandler
ff302212a0 [OpaqueValues] Fix closure handling.
Rewrote and tested all currently emittable variations of closure
handling for opaque values.
2023-08-22 07:48:39 -07:00
swift-ci
a643f98929 Merge remote-tracking branch 'origin/main' into rebranch 2023-08-19 20:53:38 -07:00
Michael Gottesman
8cfb3d238f [silgen] Cleanup a few Cleanups dump output. 2023-08-19 14:11:44 -07:00
Michael Gottesman
7c5c548968 [silgen] Fix PartialDestroyPackCleanup dumping output to handle LimitWithinComponent to be nullptr. 2023-08-19 14:11:44 -07:00
Michael Gottesman
543063ef0e [silgen] Make ManagedValue::forUnmanaged private and change users to use other more specific APIs.
I have been doing this over the past couple of days in preparation for changing
ManagedValue to specify the type of scope its cleanup is connected to.
2023-08-19 14:11:44 -07:00
Michael Gottesman
104379adab [silgen] Rename SILGenFunction::emitManagedRetain -> emitManagedCopy.
This is an old API that should have been renamed a long time ago. It just kept
its early name due to inertia.
2023-08-19 14:11:44 -07:00
Zak Kent
2abca625d7 Merge branch 'main' into update-immediate 2023-08-18 16:07:14 -07:00
zachary0kent
802e63a778 Merge pull request #67973 from zachary0kent/lazy-immediate-globals
[Immediate] JIT'ing Globals
2023-08-18 08:53:18 -07:00
Zak Kent
6aafeec181 [Immediate] [SILGen] Implement on-demand compilation of globals 2023-08-17 11:03:11 -07:00
swift-ci
70ab4bbcba Merge remote-tracking branch 'origin/main' into rebranch 2023-08-17 10:38:13 -07:00
Allan Shortlidge
d062489344 SILGen: Don't reference external property descriptors for @backDeployed properties.
The property descriptors of `@backDeployed` properties aren't available on OSes
prior to the "back deployed before" OS version, so the descriptors cannot be
referenced by clients that may run against older versions of the library
that defines the property.

See https://github.com/apple/swift/pull/59214 for prior art.

Resolves rdar://106517386
2023-08-16 23:19:15 -07:00
swift-ci
c3c6d00353 Merge remote-tracking branch 'origin/main' into rebranch 2023-08-16 22:54:10 -07:00
Doug Gregor
b126a0f34b Merge pull request #67977 from DougGregor/extension-macro-conformances-and-witnesses
[Macros] Fix handling of extension macro conformances and witnesses
2023-08-16 22:46:06 -07:00
zachary0kent
25f078adb5 Merge branch 'main' into lazy-immediate 2023-08-16 19:45:27 -07:00
Doug Gregor
b7bfaf3522 [Macros] Fix handling of extension macro conformances and witnesses
Fix two inter-related issues with extension macros that provide
conformances to a protocol, the combined effect of which is that one
cannot meaningfully provide extension macros that implement
conformances to a protocol like Equatable or Hashable that also
supports auto-synthesis.

The first issue involves name lookup of operators provided by macro
expansions. The logic for performing qualified lookup in addition to
unqualified lookup (for operators) did not account for extension
macros in the same manner as it did for member macros, so we would not
find a macro-produced operator (such as operator==) in witness
matching.

The second issue is more fundamental, which is that the conformance
lookup table would create `NormalProtocolConformance` instances for
pre-macro-expansion conformance entries, even though these should
always have been superseded by explicit conformances within the macro
expansion buffers. The end result is that we could end up with two
`NormalProtocolConformance` records for the same conformance. Some
code was taught to ignore the pre-expansion placeholder conformances,
other code was not. Instead, we now refuse to create a
`NormalProtocolConformance` for the pre-expansion entries, and remove
all of the special-case checks for this, so we always using the
superseding explicit conformances produced by the macro expansions (or
error if the macros don't produce them).

Fixes rdar://113994346 / https://github.com/apple/swift/issues/66348
2023-08-16 19:18:36 -07:00
swift-ci
109c9aa858 Merge remote-tracking branch 'origin/main' into rebranch 2023-08-16 17:54:18 -07:00
Michael Gottesman
4581eb7f35 Merge pull request #67965 from gottesmm/pr-80bd06d8a243366f1ba0f2d7b358215aa28bf517
[silgen] Add a new private API on CleanupManager called isFormalAccessCleanup
2023-08-16 17:39:59 -07:00
swift-ci
73cf37d597 Merge remote-tracking branch 'origin/main' into rebranch 2023-08-16 17:33:42 -07:00