Commit Graph

2588 Commits

Author SHA1 Message Date
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
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
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
4e2e76f479 [Test] Disabled test failing in some configs.
rdar://106965845
2023-08-25 11:06:03 -07:00
swift-ci
c17f686795 Merge pull request #68129 from nate-chandler/test/20230824/1
[Test] Require asserts for some experimental-feature tests.
2023-08-24 16:14:45 -07:00
Dario Rexin
030daee5ad Merge pull request #68042 from drexin/wip-layout-strings-work
Improve layout strings runtime code and fix several issues
2023-08-24 16:03:34 -07:00
Nate Chandler
4e22193d9e [Test] Require asserts for some experimental-feature tests.
For LazyImmediate and TupleConformances.
2023-08-24 13:46:35 -07:00
Allan Shortlidge
e3bf6bdf0e Merge pull request #68112 from tshortli/enum-equatable-all-elements-unavailable
Sema: Set type on pattern in synthesized enum equatable/hashable conformance
2023-08-23 22:40:49 -07:00
Allan Shortlidge
d47a9c6ee9 Sema: Set type on pattern in synthesized enum equatable/hashable conformance.
Fixes a regression caused by https://github.com/apple/swift/pull/67636 in which
the patterns for case statements generated to match unavailable enum elements
were missing a type. The missing type caused a crash during SILGen if the
unavailable element case was the first one in the swtich statement.

Resolves rdar://113761850
2023-08-23 18:08:49 -07:00
Dario Rexin
b7bde131f0 Merge branch 'wip-layout-strings-work' 2023-08-22 14:07:05 -07:00
Michael Spencer
b2640e15e4 [test] Rename all module.map files to module.modulemap
`module.map` as a module map name has been discouraged since 2014, and
Clang will soon warn on its usage. This patch renames all instances of
`module.map` in the Swift tests to `module.modulemap` in preparation
for this change to Clang.

rdar://106123303
2023-08-21 15:58:59 -07:00
Dario Rexin
904418f517 [Test] Remove accidentally commited broken test code 2023-08-21 14:32:46 -07:00
Dario Rexin
7e3f56de24 [Runtime] Fix generic existentials in layout strings 2023-08-21 10:57:33 -07:00
Dario Rexin
56048ac19f [Runtime+IRGen] Fix existential offset for multiple protocol witnesses 2023-08-21 10:57:06 -07:00
Dario Rexin
7c0203dd55 [Runtime] Combine copy and destroy in assignWithCopy 2023-08-21 10:56:19 -07:00
Dario Rexin
8ab845fdca [Runtime+IRGen] Fix offsets of existentials in layout strings 2023-08-21 10:55:51 -07:00
Dario Rexin
c25b3b43a2 [Runtime] Restructure BytecodeLayouts 2023-08-21 10:52:24 -07:00
Pavel Yaskevich
416bbaec8d [TypeChecker] InitAccessors: Fix handling of defaultable init accessor properties during default init synthesis
Default initializable init properties shouldn't prevent default
init synthesis and such properties without anything to initialize
should be considered by it.
2023-08-21 09:05:26 -07:00
Pavel Yaskevich
1542bb5a71 Merge pull request #67763 from xedin/rdar-113412104
[DI] Properties with init accessors without "initializes" act as stored
2023-08-21 09:03:43 -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
Zak Kent
f82fa91de9 [Immediate] Promote linkage of lazily discovered internal symbols 2023-08-17 09:56:40 -07:00
Saleem Abdulrasool
39a47a0733 Merge pull request #65968 from finagolfin/droid
[android][test] Fix a handful of tests and disable one CxxToSwiftToCxx bridging test
2023-08-17 08:47:29 -07:00
zachary0kent
25f078adb5 Merge branch 'main' into lazy-immediate 2023-08-16 19:45:27 -07:00
Allan Shortlidge
117a5ecdae Merge pull request #67920 from tshortli/unavailable-decl-opt-complete-resilient-enum-switch
SILOptimizer: Remove switch cases matching unavailable enum elements
2023-08-16 09:06:20 -07:00
Alejandro Alonso
44198d16a4 Merge pull request #67611 from Azoy/raw-types-are-cool!
[WIP] Implement dependent layouts for raw types
2023-08-16 06:55:42 -07:00
Allan Shortlidge
e2bb7e8c8b SILOptimizer: Remove switch cases matching unavailable enum elements.
Unavailable enum elements cannot be instantiated at runtime without invoking
UB. Therefore the optimizer can consider a basic block unreachable if its only
predecessor is a block that terminates in a switch instruction matching an
unavailable enum element. Furthermore, removing the switch instruction cases
that refer to unavailable enum elements is _mandatory_ when
`-unavailable-decl-optimization=complete` is specified because otherwise
lowered IR for these instructions could refer to enum tag accessors that will
not be lowered, resulting in a failure during linking.

Resolves rdar://113872720.
2023-08-15 17:13:10 -07:00
Zak Kent
c59459940c [Test] Only run lazy tests on macOS 2023-08-14 13:28:23 -07:00
Zak Kent
5e75c76386 [Test] Add tests for lazy immediate mode 2023-08-14 13:28:22 -07:00