Commit Graph

2441 Commits

Author SHA1 Message Date
Joe Groff
95f1bd3bf8 Merge pull request #34142 from jckarter/async-await-sil-instructions
SIL: Add instructions to represent async suspend points.
2020-10-02 13:19:49 -07:00
swift_jenkins
eea4e99548 Merge remote-tracking branch 'origin/main' into next 2020-10-01 22:56:39 -07:00
Holly Borla
355fbb3a8b Merge pull request #34109 from hborla/local-property-wrappers
[Property Wrappers] Support local property wrappers
2020-10-01 22:45:41 -07:00
Joe Groff
a664a33b52 SIL: Add instructions to represent async suspend points.
`get_async_continuation[_addr]` begins a suspend operation by accessing the continuation value that can resume
the task, which can then be used in a callback or event handler before executing `await_async_continuation` to
suspend the task.
2020-10-01 14:21:52 -07:00
Nathan Hawes
ad5b3152c0 Merge pull request #34062 from nathawes/fix-upstream-breakage-on-next
[next] Update for swiftNewTypeAttr capitalization change.
2020-09-30 12:07:28 -07:00
swift_jenkins
b1fa15fe87 Merge remote-tracking branch 'origin/main' into next 2020-09-29 23:14:40 -07:00
Holly Borla
2a67c651ee [Property Wrappers] Generalize a few property wrapper decl context
checks to check for type context instead of local context.

This generalization will help us implement property wrappers on
global variables, which should use the same approach of not adding
synthesized accessors to the AST and instead lazily visit them in
SILGen.
2020-09-29 13:38:41 -07:00
Nathan Hawes
40b6798d35 Update usages of 'SwiftNewtypeAttr' for the new spelling 'SwiftNewTypeAttr' 2020-09-29 10:46:13 -07:00
Arnold Schwaighofer
8e8c57caf5 SIL type lowering: Compute IsTypeExpansionSensitive and use it instead of TypeBase's hasOpaqueArchetypePropertiesOrCases
A type is IsTypeExpansionSensitive if it contains an opaque result type that influences how the type is lowered.

This could be because the type mentions an opaque archetype and
therefore we would look through to the underlying type depending on the
type expansion and could get a different SIL type. For example
'() -> out some P' could lower to '() -> @out Int'.

Or this could be because when we lower an aggregate type some of its
fields are opaque types that could be looked through and therefore the
aggregate has different lowering (e.g address vs. loadable) in different
type expansion contexts.

By replacing it this change also fixes an infinite recursion in
hasOpaqueArchetypePropertiesOrCases.

rdar://68798822
2020-09-29 10:40:16 -07:00
Meghana Gupta
163d47ec90 Revert "Revert #33106 and #33205" (#34106) 2020-09-28 23:08:14 -07:00
Holly Borla
b33dbedd9b [SILGen] Teach SIlGen to emit local property wrappers 2020-09-28 16:57:35 -07:00
Andrew Trick
ea0da3fcdb Merge pull request #34074 from atrick/make-fieldidx-unique
Change SIL ref_element_addr getFieldNo() to return a unique index.
2020-09-25 14:38:46 -07:00
Meghana Gupta
77a76a8422 Revert "Merge pull request #33205 from meg-gupta/ometofunctionpass"
This reverts commit 8dbac48c18, reversing
changes made to c22ba90700.
2020-09-25 11:49:52 -07:00
Andrew Trick
5ae231eaab Rename getFieldNo() to getFieldIndex().
Do I really need to justify this?
2020-09-24 22:44:13 -07:00
Andrew Trick
28294725d4 Change SIL ref_element_addr getFieldNo() to return a unique index.
I don't have a test case for this bug based on the current code. But
the fix is clearly needed to have a unique AccessStorage object for
each property. The AccessPath commits will contain test cases for this
functionality.
2020-09-24 19:55:36 -07:00
Meghana Gupta
8dbac48c18 Merge pull request #33205 from meg-gupta/ometofunctionpass
[ownership] Convert OME into a function pass
2020-09-24 17:00:38 -07:00
Meghana Gupta
a415d87a28 Register deserialization notification handlers in ome only once 2020-09-24 14:38:01 -07:00
Varun Gandhi
e67c178eb1 [NFC] Use SILPrintContext for configuring printSIL. 2020-09-24 00:50:58 -07:00
Varun Gandhi
abce3de41c [NFC] Add some TODO comments for cleanup. 2020-09-24 00:38:45 -07:00
Varun Gandhi
37efac9ff8 Manually merge origin/main into origin/next.
Resolved conflict in lib/ClangImporter/ImportType.cpp.
2020-09-23 08:10:08 -07:00
Varun Gandhi
7b967a8030 Merge pull request #33085 from varungandhi-apple/vg-clang-types-in-sil-retry
Propagate Clang function types through SIL
2020-09-22 08:48:34 -07:00
swift_jenkins
7220ae3d2e Merge remote-tracking branch 'origin/master' into master-next 2020-09-21 13:26:46 -07:00
Robert Widmann
7bee5ffc0c Remove NLOptions::NL_Known* 2020-09-21 10:37:41 -06:00
Varun Gandhi
983399c1e7 [Printer] Conditionally print Clang types in emitted SIL. 2020-09-16 10:34:43 -07:00
Varun Gandhi
5e9bf1f7c6 [SIL] Store ClangTypeInfo in SILFunctionType.
This patch includes a large number of changes to make sure that:
1. When ExtInfo values are created, we store a ClangTypeInfo if applicable.
2. We reduce dependence on storing SIL representations in ASTExtInfo values.
3. Reduce places where we sloppily create ASTExtInfo values which should
   store a Clang type but don't. In certain places, this is unavoidable;
   see [NOTE: ExtInfo-Clang-type-invariant].

Ideally, we would check that the appropriate SILExtInfo does always store
a ClangTypeInfo. However, the presence of the HasClangFunctionTypes option
means that we would need to condition that assertion based on a dynamic check.
Plumbing the setting down to SILExtInfoBuilder's checkInvariants would be too
much work. So we weaken the check for now; we should strengthen it once we
"turn on" HasClangFunctionTypes and remove the dynamic feature switch.
2020-09-16 10:34:42 -07:00
swift_jenkins
3265b1e877 Merge remote-tracking branch 'origin/master' into master-next 2020-09-16 07:02:37 -07:00
Slava Pestov
8e83dd902f Sema: Don't compute isSimpleDidSet() from getStorageImplInfo() 2020-09-15 22:03:58 -04:00
Pavel Yaskevich
dd374a1d52 Merge remote-tracking branch 'origin/master' into fix-merge-master-master-next 2020-09-15 11:44:10 -07:00
Pavel Yaskevich
c56ae1e336 Merge pull request #33851 from freddi-kit/fix/may-trap-condition
[sil-opt] Fix covering all-case of trapping instruction of SILInstruction::mayTrap
2020-09-12 22:29:00 -07:00
swift_jenkins
5bde55608d Merge remote-tracking branch 'origin/master' into master-next 2020-09-11 09:13:32 -07:00
swift_jenkins
59f861034d Merge remote-tracking branch 'origin/master' into master-next 2020-09-11 05:35:11 -07:00
Erik Eckstein
093c2140e6 SILBuilder: require an insertion point when creating instructions.
This helps to avoid instruction leaks.
It's a NFC.
2020-09-11 14:29:51 +02:00
Erik Eckstein
56c857afa9 SIL: Check for leaked instructions in the SILVerifier and in the SILModule destructor. 2020-09-11 11:09:30 +02:00
Erik Eckstein
170d9e9eea SIL: Let SILGlobalVariables be destroyed.
This fixes a memory leak: instructions of the static initializer block were not be freed.

rdar://problem/66931238
2020-09-11 11:09:29 +02:00
Erik Eckstein
6f2cfa613a SILBasicBlock: a small refactoring - NFC 2020-09-11 11:09:29 +02:00
Erik Eckstein
eb5a79b175 SIL: Remove the bump pointer allocator for zombie function names from SILModule.
It's not needed because the names are stored in the ZombieFunctionTable anyway (this table was added later).
2020-09-11 11:09:29 +02:00
Erik Eckstein
1d62d3481c SIL: fix a memory leak, related to zombie functions
The leak happened in this scenario:
1. A function becomes dead and gets deleted (which means: it gets added to the zombie-list)
2. A function with the same name is created again. This can happen with specializations.

In such a case we just removed the zombie function from the zombie-list without deleting it.
But we cannot delete zombie functions, because they might still be referenced by metadata, like debug-info.

Therefore the right fix is to resurrect the zombie function if a new function is created with the same name.

rdar://problem/66931238
2020-09-11 11:09:29 +02:00
freddi
495087f26f [sil-opt] Fix to satisfy all trapping instruction case at SILInstruction::mayTrap 2020-09-08 11:58:48 +09:00
swift_jenkins
39a0bc2296 Merge remote-tracking branch 'origin/master' into master-next 2020-09-03 21:31:53 -07:00
Hamish Knight
a54765b3d0 Merge pull request #33781 from hamishknight/is-this-odr 2020-09-03 19:59:24 -07:00
Dan Zheng
5c3cb36a7c Merge pull request #33611 from dan-zheng/autodiff-fix-tangent-value-category
[AutoDiff] Fix PullbackCloner tangent value category mismatch issues.
2020-09-03 11:51:56 -07:00
Hamish Knight
ae5b38566c [SILGen] Expand isNativeToForeignThunk
Expand to other cases where we emit a
native-to-foreign thunk, but didn't previously
return true. Because this now includes @objc
entry-points for methods, adjust the linking logic
so it can maintain more restrictive linkages for
things like private decls.
2020-09-02 21:09:10 -07:00
Hamish Knight
c4c14ba2de [SILGen] Cleanup isForeignToNativeThunk slightly
Bail early for the foreign case.
2020-09-02 21:09:10 -07:00
Hamish Knight
da65826692 [SILGen] Remove an obsolete linking hack
We already make sure @objc entry-points aren't
optimized out.
2020-09-02 21:09:10 -07:00
Nathan Hawes
b49cd75770 Manually merge remote-tracking branch 'upstream/master' into HEAD
Conflicts:
	lib/AST/ExtInfo.cpp
2020-08-31 10:54:27 -07:00
Varun Gandhi
8df83150fb Merge pull request #33541 from varungandhi-apple/vg-clang-types-in-sil-setup
Setup code for Clang types in SIL.
2020-08-28 14:34:27 -07:00
swift_jenkins
0406537be2 Merge remote-tracking branch 'origin/master' into master-next 2020-08-28 08:40:11 -07:00
Joe Groff
f588f2f478 Merge pull request #33650 from jckarter/global_init_mangling
Remove hardcoded symbol name parsing from SILOptimizer passes
2020-08-28 08:34:35 -07:00
Varun Gandhi
fdbcd1236f [NFC] Bridge based on SILFunctionLanguage instead of Representation. 2020-08-27 13:14:05 -07:00
Varun Gandhi
eeec16f143 [NFC] Remove redundant ExtInfo parameter for getBridgedFunctionType.
At all call-sites, the extInfo passed as the third argument is computed directly
from the second argument, so we compute it directly in getBridgedFunctionType.
2020-08-27 13:14:05 -07:00