Commit Graph

2466 Commits

Author SHA1 Message Date
Pavel Yaskevich
65b07e91b7 [SILGen] Emit expected executor preconditions for synchronous isolated @preconcurrency witness thunks
For `@preconcurrency` conformance witness thunks replace hop to
executor with a precondition to make sure that the thunk is always
called in the expected context.
2024-01-16 11:51:49 -08:00
Allan Shortlidge
e5c6bb649c Remove support for Swift 3 @objc inference.
Obsolete the `-enable-swift3-objc-inference` option and related options by
removing support for inferring `@objc` attributes using Swift 3 rules.
Automated migration from Swift 3 has not been supported by the compiler for
many years.
2024-01-11 15:40:04 -08:00
Meghana Gupta
5d2454f3e3 Merge pull request #68180 from meg-gupta/lowerb4inline
Lower OwnershipModelEliminator to just before inlining
2024-01-10 13:53:34 -08:00
Slava Pestov
25789fd767 Merge pull request #70768 from slavapestov/fix-119822466
SIL: Fix DynamicSelfType references from inside init accessor
2024-01-10 13:40:46 -05:00
Slava Pestov
1a06313ac9 SIL: Fix DynamicSelfType references from inside init accessor
We need the self metatype parameter to correctly lower
DynamicSelfType in IRGen, so plumb this through to all
calls of init accessors, and inside the prolog of an
init accessor definition.

This does not break the public ABI, because init
accessors are never public. Also for value types, the
metatype is thin, so it should not change generated
code.

For classes we need the metatype in the general case
because of `Self`, but hopefully in most cases the
init accessor can be inlined away and the value_metatype
instruction subject to dead code elimination.

Fixes rdar://problem/119822466.
2024-01-09 10:52:54 -05:00
Meghana Gupta
ce242691a6 Bail out of ossa rauw for move only values 2024-01-05 23:10:45 -08:00
Slava Pestov
93ad779f84 Merge pull request #70694 from slavapestov/two-ci-fixes
A couple of small fixes for CI
2024-01-04 10:39:22 -05:00
Eric Miotto
a566c10d3d Use %target-swiftc_driver in objc_class_properties_runtime.swift (#70689)
This way we will compile the test program with `-Xlinker
-headerpad_max_install_names`, which will allow
`swift-darwin-postprocess.py` to amend the install names without errors.

Take the chance to remove the `-target` parameter -- that is already
provided by %target-swiftc_driver, and we have no need to enforce it to
be at least `macosx10.11` (since by virtue of build-script defaults and
Xcode in CI we don't support anything lower than `macosx10.13`)

Addresses rdar://119907089
2024-01-04 07:16:59 -08:00
Slava Pestov
ab15ddad4e test/Interpreter/rdar119541554.swift requires macOS 14
Fixes rdar://119948707.
2024-01-03 16:28:22 -05:00
Allan Shortlidge
edcec43098 Revert "Frontend: Temporarily disable stubbing unavailable decls."
This reverts commit ad604f2803.
2024-01-03 11:01:00 -08:00
Dario Rexin
b238c16f51 [IRGen] Disable simple single payload enum in layout strings (#70528)
rdar://119792426

There are a few issues with wrong assumptions around extra inhabitants that cause tags to not be identified properly in some cases. Until a proper fix is identified, we emit tag functions instead.
2023-12-20 14:55:52 -08:00
Rintaro Ishizaki
c2fa7c5bae [Test] Disable objc_class_properties_runtime.swift
rdar://119907089
2023-12-20 14:17:15 -08:00
Slava Pestov
79e9b96835 AST: Fix ExistentialLayout::isObjC() handling of marker protocols
Fixes rdar://problem/119541554.
2023-12-15 15:33:44 -05:00
Becca Royal-Gordon
e9672194b4 Merge pull request #69468 from beccadax/c-implementation
Make @objcImpl work with @_cdecl
2023-12-14 00:36:12 -08:00
Joe Groff
6812e6164b Merge pull request #70422 from jckarter/codesign-moveonly-interpreter-tests
Add missing %target-codesign to moveonly execution tests.
2023-12-13 14:59:44 -08:00
Becca Royal-Gordon
8651af4325 Make @objcImpl work with @_cdecl
No real diagnostics yet, but we’re emitting mostly correct code.
2023-12-13 11:09:49 -08:00
Joe Groff
0022816a10 Add missing %target-codesign to moveonly execution tests. 2023-12-13 08:17:19 -08:00
Allan Shortlidge
ad604f2803 Frontend: Temporarily disable stubbing unavailable decls.
This feature should be disabled until rdar://119046537 is solved.
2023-12-12 15:46:57 -08:00
Joe Groff
957443e16c Merge pull request #70404 from jckarter/modify-coroutines-yielding-noncopyable-values
Move-only-check the result of modify coroutines.
2023-12-12 14:38:48 -08:00
Joe Groff
18e31157fd Move-only-check the result of modify coroutines.
Following https://github.com/apple/swift/pull/70333, do the same thing for
modify coroutines, marking the result so that we check uses of the result to
ensure it isn't consumed (without being reinitialized).
2023-12-12 09:02:24 -08:00
Dario Rexin
7b8fc50dcd [Test] Fix integer overflow in layout_string_witnesses_dynamic.swift on 32 bit targets (#70290)
rdar://119268608
2023-12-07 11:59:31 -08:00
Pavel Yaskevich
da052e5b27 [TypeChecker] Allow @dynamicMemberLookup subscript index to compose key path with protocols
Allow to compose key path type with a protocol as a way to express
additional requirements on the parameter. For example:

```
struct Test<R> {
  subscript<V>(dynamicMember member: KeyPath<R, V> & Sendable) -> V {
    ...
  }
}
```
2023-11-30 11:34:58 -08:00
Pavel Yaskevich
3d6ddd58c8 [TypeChecker] NFC: Add test-cases verify that sendability of key path exprs is inferred correctly 2023-11-28 13:48:00 -08:00
Dario Rexin
011fce8212 [Runtime] Fix leak of bridge objects in swift_generic_initWithTake (#69977)
rdar://118606044

The initWithTakeTable accidentally referenced bridgeRetain instead of copyingInitWithTake, which caused a leak when an object containing a bridge reference was also not bitwise takable.
2023-11-27 08:04:10 -08:00
Dario Rexin
506fbb3c91 [Runtime] Fix alignment of tuples in runtime layout string instantiation (#69975)
rdar://118366415

If a tuple was not already aligned, this would cause a wrong offset to be used in the layout string.
2023-11-27 08:03:38 -08:00
Joe Groff
a759703115 Merge pull request #69919 from jckarter/test-resilient-error-handling-same-file
Add test for error handling path combinations in same file as a resilient type.
2023-11-16 14:41:56 -08:00
Joe Groff
91a489b9b2 Add test for error handling path combinations in same file as a resilient type.
In local testing, I found that the compiler is inserting double deinits in some cases.
2023-11-16 10:14:57 -08:00
Joe Groff
1b91ad7e8e Merge pull request #69899 from jckarter/resilient-capture-self-during-deinit
SILGen: Mark constant captures for no_consume_or_assign checking instead of may_assign_but_not_consume.
2023-11-16 07:51:52 -08:00
Kavon Farvardin
222e33d6dd Merge pull request #69907 from kavon/noncopyable-statics-117082469
[SILGen] handle TypeExpr in BorrowedBaseVisitor
2023-11-16 04:54:56 -08:00
Kavon Farvardin
3a533b6338 [SILGen] handle TypeExpr in BorrowedBaseVisitor
A TypeExpr and other kinds of non-lvalue bases that the borrowed-base
visitor doesn't care about can be handled by calling back into the
original SILGenLValue instance.

resolves rdar://117082469
2023-11-16 00:18:16 -08:00
Joe Groff
16d974e9e1 SILGen: Mark constant captures for no_consume_or_assign checking instead of may_assign_but_not_consume.
An immutable noncopyable capture borrows the captured value in-place and can't do anything
to modify it, and the may_assign_but_not_consume checking behaves badly with some code patterns
generated for resilient types when `self` is captured during a deinit. This change allows for
more accurate checking and fixes rdar://118427997.
2023-11-15 17:26:42 -08:00
Joe Groff
f126b714bf MoveOnlyChecker: Properly insert cleanup for dead try_apply def.
When a address-only noncopyable value is dead-def'ed by an indirect return from a `try_apply`,
the cleanup should be inserted on the normal return successor block. Fixes rdar://118255228.
2023-11-15 08:42:07 -08:00
Allan Shortlidge
b72f0c95e4 Merge pull request #69757 from tshortli/refactor-lazy-type-refinement-contexts
Sema: Expand TypeRefinementContexts lazily for unparsed function bodies
2023-11-09 23:47:05 -08:00
Dario Rexin
36f3367275 [Runtime] Use threaded code in compact value witness runtime (#69756)
* [Runtime] Use threaded code in compact value witness runtime

These changed reduce branching and yield performance improvements of up to 10% for some cases.

* Fix offset in handleRefCountsInitWithTake
2023-11-09 19:12:29 -08:00
Allan Shortlidge
2aed784ede Sema: Expand TypeRefinementContexts lazily for unparsed function bodies.
When building the TypeRefinementContext subtree for a function declaration,
postpone creation of the subtree if the function body is unparsed. This allows
the compiler to completely avoid parsing function bodies that have been skipped
(e.g. with -experimental-skip-non-inlinable-function-bodies) while still
ensuring that the TRCs for functions are built lazily later if needed. When
lazily generating SIL for a function with -experimental-lazy-typecheck, the
TRCs must be built out while typechecking the function in order to emit correct
diagnostics and SIL for `if #available` queries.

Resolves rdar://117448323
2023-11-09 16:02:58 -08:00
Kavon Farvardin
80fe914d0c Revert "[NoncopyableGenerics] add basic end-to-end test"
This reverts commit 6fe00b665c

without reverting the associated fixes/changes.
2023-11-03 20:15:32 -07:00
swift-ci
6532b23b3e Merge pull request #69591 from kavon/noncopyable-generics-pt3
[NoncopyableGenerics] Basic end-to-end testing (without stdlib).
2023-11-03 13:06:43 -07:00
Dario Rexin
40b8079018 [Runtime] Fix missing memcpy in handleSingleRefCountInitWithCopy
rdar://117755666

Missing memcpy in handleSingleRefCountInitWithCopy caused wrong enum cases, crashes etc.
2023-11-03 00:27:45 -07:00
Kavon Farvardin
6fe00b665c [NoncopyableGenerics] add basic end-to-end test 2023-11-01 19:01:52 -07:00
Allan Shortlidge
0c910e54c6 Frontend: Enable -unavailable-decl-optimization=stub by default.
By default the compiler will now replace the bodies of unavailable functions
with stubs that call `_diagnoseUnavailableCodeReached()` instead.

Resolves rdar://116019744
2023-10-18 18:35:14 -07:00
Arnold Schwaighofer
e4fbde8063 Merge pull request #68996 from aschwaighofer/objective_c_protocol_symbolic_ref
Add support for objective c protocol symbolic references
2023-10-07 09:18:33 -07:00
Andrew Trick
a869958bc3 Remove formal_access.swift test
This test has been disabled for 5 years because it violates language
rules by design. Now that the rules are enforced, the test doesn't
work.

Fixes rdar://116589817 (Exclusivity violations in test cause segfault)
2023-10-06 12:52:06 -07:00
Arnold Schwaighofer
894095a5f2 Add a flag to enable/disable usage of objective c protocol symbolic references 2023-10-06 08:43:00 -07:00
Arnold Schwaighofer
b0424759d7 Add support for objective c protocol symbolic references
Using symbolic references instead of a text based mangling avoids the
expensive type descriptor scan when objective c protocols are requested.

rdar://111536582
2023-10-05 13:11:32 -07:00
Pavel Yaskevich
3414609586 [Tests] NFC: Expand init accessor with nonmutating set coverage 2023-09-29 13:21:17 -07:00
Dario Rexin
56d0975668 [Runtime] Add layout string handling in swift_arrayAssignWithCopyFrontToBack
By using a specialize function, we only call through the witness table and fetch the layout string once for the whoe buffer, instead of once per element.
2023-09-21 09:52:46 -07:00
Dario Rexin
5ef441c4b1 [IRGen] Only use value witness getEnumTag function for "normal" enums
rdar://115013153

For special enum cases, e.g. effectively optional references, the layout string will be the same as the payload, because we don't have to check for the particular case. For those cases we have to use the regular witnesses, which should be shared among all those cases.
2023-09-05 16:34:10 -07:00
swift-ci
972229d70d Merge pull request #68202 from nate-chandler/wrangle/20230829/2
[Test] Mark three tests unsupported on use_os_stdlib.
2023-08-29 20:43:48 -07:00
Nate Chandler
2d2e68aa18 [Test] Mark 3 tests unsupported on use_os_stdlib.
These tests require an OS with Swift 5.9, and that can't be expressed as
a REQUIRES: line.

rdar://114564735
2023-08-29 17:21:01 -07:00
Nate Chandler
ad71233b93 [Test] Require swift_interpreter in a couple tests.
Tests that use %target-jit-run require swift_interpreter.
2023-08-28 13:05:54 -07:00