Commit Graph

664 Commits

Author SHA1 Message Date
Erik Eckstein
ded1b6ea8c IRGen: get metadata symbol of class __StaticArrayStorage the correct way
Fixes an unresolved symbol error when building the stdlib on some platforms.

rdar://119991570
2024-01-04 18:32:23 +01:00
Erik Eckstein
e4ea7491a2 IRGen: fix and re-enable static read-only arrays
Static read-only arrays didn't work when passed to ObjectiveC as NSArray.
The storage class of static read-only arrays doesn't carry information about the Element type.
The new `__SwiftDeferredStaticNSArray` is generic over the element type and doesn't have to rely on the element type information of the array storage.

rdar://94185998
2023-12-13 11:45:01 +01:00
Kuba (Brecka) Mracek
ec87fbcaca Merge pull request #70344 from kubamracek/embedded-nounwind
[embedded] Mark all functions as 'nounwind' in embedded Swift, add dependency tests
2023-12-12 10:37:54 -08:00
Konrad `ktoso` Malawski
828f589be4 Initial Task Executor implementation Task(on:), addTask(on:) etc. (#68793)
Co-authored-by: John McCall <rjmccall@gmail.com>
2023-12-12 17:14:24 +09:00
Kuba Mracek
fdc69fb6a1 [embedded] Actually, use 'nounwind' even with C++ interop on, add comment 2023-12-11 13:37:41 -08:00
Kuba Mracek
9e8db64f45 [embedded] Don't apply 'nounwind' if C++ interop is enabled 2023-12-11 09:08:06 -08:00
Kuba Mracek
4e56d810fa [embedded] Mark all functions as 'nounwind' in embedded Swift, add dependency tests 2023-12-09 08:46:00 -08:00
Kuba Mracek
df09cf16b1 [embedded] Avoid using swiftcc on targets that don't support it 2023-11-13 12:59:41 -08:00
Mishal Shah
74840cc60a Revert "Add mandatory SIL pass implementing '@_alwaysEmitConformanceMetadata' protocol attribute" 2023-11-06 22:41:12 -08:00
Artem Chikin
feb5d457f6 Add mandatory SIL pass implementing '@_alwaysEmitConformanceMetadata' protocol attribute
Ensuring that conformances to such protocols must have their type metadata always emitted into the binary, regardless of wheter they are used or `public`.
2023-11-02 09:26:08 -07:00
Doug Gregor
40e07cf900 [Typed throws] IR generation and runtime support for function type metadata
Extend function type metadata with an entry for the thrown error type,
so that thrown error types are represented at runtime as well. Note
that this required the introduction of "extended" function type
flags into function type metadata, because we would have used the last
bit. Do so, and define one extended flag bit as representing typed
throws.

Add `swift_getExtendedFunctionTypeMetadata` to the runtime to build
function types that have the extended flags and a thrown error type.
Teach IR generation to call this function to form the metadata, when
appropriate.

Introduce all of the runtime mangling/demangling support needed for
thrown error types.
2023-10-29 09:12:32 -07:00
Slava Pestov
3b51407224 Merge pull request #69459 from slavapestov/fix-extended-existential-metadata-weak
IRGen: Weak-link references to swift_getExtendedExistentialTypeMetadata()
2023-10-28 11:55:32 -04:00
Slava Pestov
c9c0572be5 IRGen: Weak-link references to swift_getExtendedExistentialTypeMetadata()
Fixes rdar://117530421.
2023-10-27 17:36:28 -04:00
Adrian Prantl
5d978b44ca Revert "Revert "Make the DWARF version emitted by the Swift compiler configurable."" 2023-10-26 12:29:18 -07:00
Adrian Prantl
2a32ca5944 Revert "Make the DWARF version emitted by the Swift compiler configurable." 2023-10-25 13:28:28 -07:00
Adrian Prantl
d19fe381fa Use LLVM definitions for Swift section names (NFC) 2023-10-24 10:58:40 -07:00
swift-ci
d253b717d2 Merge remote-tracking branch 'origin/main' into rebranch 2023-10-07 19:35:15 -07:00
Kuba (Brecka) Mracek
c59c79318b Merge pull request #68928 from kubamracek/embedded-concurrency
[embedded] Initial Swift Concurrency for embedded Swift
2023-10-07 19:33:54 -07:00
swift-ci
745d48ad03 Merge remote-tracking branch 'origin/main' into rebranch 2023-10-07 09:34:00 -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
Kuba Mracek
5d8c55eacb [embedded] Initial Swift Concurrency for embedded Swift 2023-10-06 20:04:03 -07:00
swift-ci
f07b1aefb2 Merge remote-tracking branch 'origin/main' into rebranch 2023-10-06 09:16:41 -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
Artem Chikin
57e4f244d1 Fine-grained autolinking control
This change adds the following options to allow for greater control over the compiler's autolinking directive use:
- '-disable-autolink-library': equivalent to an existing '-disable-autolink-framework', this option takes a library name as input and ensures the compiler does not produce an autolink directive '-l<library-name>'.
- '-disable-autolink-frameworks': a boolean disable flag which turns off insertion of autolinking directives for all imported frameworks (of the type '-framework <framework-name>')
- '-disable-all-autolinking': a boolean disable flag which turns off insertion of *any* autolinking directives.

Resolves rdar://100859983
2023-10-05 15:12:48 -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
swift-ci
daeae9870d Merge remote-tracking branch 'origin/main' into rebranch 2023-09-25 21:51:57 -07:00
zoecarver
bed427b29d [embedded][ptrauth] Guard extra ptrauth verification on objc interop being enabled.
This verification runs on ObjC briging types which are not present in embedded stdlib or when objc interop is not enabled.
2023-09-25 10:17:31 -07:00
swift-ci
c211e09c5a Merge remote-tracking branch 'origin/main' into rebranch 2023-09-25 01:17:00 -07:00
Kuba Mracek
211f613e10 [embedded] Stop emitting metadata for extensions 2023-09-24 20:49:10 -07:00
swift-ci
33f718de98 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-22 22:17:24 -07:00
Kuba Mracek
3061564563 [embedded] Disable autolinking in embedded Swift 2023-09-21 22:30:52 -07:00
swift-ci
703a27a750 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-06 07:55:49 -07:00
Arnold Schwaighofer
1b8e20ee09 Fix IRGenModule::getMaximalTypeExpansionContext to use the proper associated context
In a per file compilation mode we want to use the file context -- which is
stored in the AssociatedContext -- rather than defaulting to the current Swift
Module context.

rdar://114344533
2023-09-05 13:16:43 -07:00
swift-ci
174b6bc00c Merge remote-tracking branch 'origin/main' into rebranch 2023-08-18 19:34:12 -07:00
Slava Pestov
c2f1193ae3 Merge pull request #67952 from slavapestov/tuple-conformance-tbd-etc
A pile of mostly unrelated one-liners
2023-08-18 15:31:26 -04:00
Slava Pestov
99d68ba14c IRGen: Some progress toward tuple conformances 2023-08-18 12:12:50 -04:00
swift-ci
73cf37d597 Merge remote-tracking branch 'origin/main' into rebranch 2023-08-16 17:33:42 -07:00
Pavel Yaskevich
eee923bc42 [IRGen] [AST] NFC: Remove @runtimeMetadata related code and metadata records 2023-08-15 12:17:31 -07:00
Ben Barham
249f2d030a [rebranch] Correct read only argument memory and apply in getRuntimeFn
`ReadOnly, ArgMemOnly` previously meant `can only read argument memory`.
But with the rebranch changes, this became `(can only read *all* memory)
and (can read or write argument memory)`. Use `ArgMemReadOnly` for this
instead.

To expand on this, these attributes (prior to memory effects) used to be
split into two. There was the *kind* of access, eg.
```
readnone
readonly
writeonly
```
and the accessed *location*, eg.
```
argmemonly
inaccessiblememonly
inaccessiblemem_or_argmemonly
```

So `RuntimeFunctions.def` would use `ReadOnly, ArgMemOnly` to mean `can
only read argument memory`.

In the previous rebranch commits, this was changed such that `ReadOnly`
mapped to `MemoryEffectsBase::readOnly()` and `ArgMemOnly` to
`MemoryEffectsBase::argMemOnly()`.

And there lies the issue -
  - `MemoryEffectsBase::readOnly()` == `MemoryEffectsBase(Ref)` ie. all
    locations can only read
  - `MemoryEffectsBase::argMemOnly()` == `MemoryEffectsBase(ArgMem,
    ModRef)`, ie. can only access argument memory

But then OR'ing those together this would become:
```
ArgMem: ModRef, InaccessibleMem: Ref, Other: Ref
```
rather than the previously intended:
```
ArgMem: Ref, InaccessibleMem: NoModRef, Other: NoModRef
```
2023-08-10 22:03:50 -07:00
Arnold Schwaighofer
ad88fc6cbe Revert "[rebranch] Pass memory effects through to getRuntimeFn" 2023-08-09 10:27:10 -07:00
Ben Barham
b4ad633de7 [rebranch] Pass memory effects through to getRuntimeFn
These were being lost in the `IRGenModule::get##ID##Fn()`
implementation.
2023-08-08 13:50:16 -07:00
Ben Barham
6c43018b56 Merge pull request #67661 from bnbarham/fix-mem-effects
[rebranch] Finish off memory effects change
2023-08-02 09:28:12 -07:00
Ben Barham
f70e168616 [rebranch] Rename NO_MEMEFFECTS to UNKNOWN_MEMEFFECTS
`NO_MEMEFFECTS` is quite similar to "none", which isn't the same as
unknown in this context. Rename to `UNKNOWN_MEMEFFECTS` for clarity.
2023-08-02 09:26:09 -07:00
swift-ci
4427f22c22 Merge remote-tracking branch 'origin/main' into rebranch 2023-08-01 22:57:48 -07:00
Konrad `ktoso` Malawski
95920b2570 [Concurrency] Fix init task group with flags availability
resolves rdar://112469076
2023-08-02 12:02:27 +09:00
Ben Barham
1d3b5f40a0 [rebranch] Finish off memory effects change
`ReadOnly`/`ArgMemOnly` were mostly moved over, but a few were missed.
Update them all. Also default to `unknown` for no memory effects rather
than none (ie. we should be conservative).
2023-08-01 15:29:40 -07:00
Evan Wilde
60e3124524 llvm::SmallSetVector is no longer a SetVector
LLVM changing SmallSetVector resulted in it no longer being a SetVector.
swift::SmallSetVector is an llvm::SetVector though, so I just changed
out the types. If we need to change more, we can do that.
2023-07-26 22:03:39 -07:00
Evan Wilde
874299d5fa Move to llvm::MemoryEffects
The memory effects are no longer represented as raw attributes, but as
its own type. This patch migrates IRGen over to using the new unified
memory effect type.
2023-07-26 14:39:07 -07:00
Evan Wilde
d574e6e7d0 Update DebugInfo option location 2023-07-25 12:28:28 -07:00
Evan Wilde
044002934b Remove Typed-Pointer cutouts
This removes some of the typed pointer cutouts in IRGen.
LLVM has removed the typed pointers, so `LLVMContext.setOpaquePointers`
doesn't make sense. Clang doesn't have opaque pointers either.

Also removing defunct assertions in IRGen were checking pointer-type
information. With llvm moving to opaque pointer types, these functions
are no longer returning useful information and are deprecated.

Specifically
 - `isOpaqueOrPointeeTypeMatches` always returns true
 - `supportsTypedPointers()` always returns false
 - `getNonOpaquePointerElementType()->isFunctionTy()` will never get hit
2023-07-25 12:28:28 -07:00