Commit Graph

1537 Commits

Author SHA1 Message Date
Yuta Saito
5763741bb5 [IRGen] Use addCompactFunctionReference for dynamic replacement
This repairs dynamic_replaceable_opaque_return_type_parameter.swift test
on WebAssembly.
2023-10-09 05:30:13 +00:00
swift-ci
048b1babd7 Merge remote-tracking branch 'origin/main' into rebranch 2023-10-08 09:14:00 -07:00
Slava Pestov
f321dd3321 Merge pull request #66247 from karwa/nested-protocols
Allow protocols to be nested in non-generic contexts
2023-10-08 12:00:46 -04:00
swift-ci
5b72fbae64 Merge remote-tracking branch 'origin/main' into rebranch 2023-10-06 17:15:26 -07:00
Karl Wagner
ab4f80ed95 [SE-0404] Allow protocols to be nested in non-generic contexts 2023-10-06 21:04:03 +02:00
Kuba Mracek
7da86b1148 [embedded] Serialize+deserialize vtables, fix using non-generic classes from other modules in embedded Swift 2023-10-06 10:25:22 -07:00
Augusto Noronha
ef45991a2a Keep certain function that are potentially used in the debugger
Currently, when compiling with no optimizations on, we still delete
functions that are sometimes used in the debugger. For example, users
might want to call functions which are unused, or compiler generated
setters/getters.

rdar://101046198
2023-10-04 10:16:31 -07:00
swift-ci
ddbe38ec7b Merge remote-tracking branch 'origin/main' into rebranch 2023-09-28 09:38:05 -07:00
Yuta Saito
8cfcc245b5 Merge pull request #68524 from kateinoigakukun/katei/expose-wasm-sym
[wasm] Add `@_expose(wasm)` attribute for top-level functions
2023-09-28 09:17:48 -07:00
swift-ci
2e6b1cd2f7 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-28 07:13:53 -07:00
Kuba Mracek
d78482270d [embedded] Move loweredFunctionHasGenericArguments to .isGeneric() on SILFunction 2023-09-27 10:00:39 -07:00
Kuba Mracek
325bc94cd6 [embedded] abort(0) -> llvm_unreachable 2023-09-27 09:19:42 -07:00
Kuba Mracek
b049319487 [embedded] Remove unspecialized functions before running IRGen 2023-09-26 22:25:37 -07:00
Yuta Saito
6d378a3ec3 [wasm] add @_expose(wasm) attribute support
This attribute instructs the compiler that this function declaration
should be "export"ed from this .wasm module. It's equivalent of Clang's
`__attribute__((export_name("name")))`
2023-09-26 14:13:33 +00:00
swift-ci
c211e09c5a Merge remote-tracking branch 'origin/main' into rebranch 2023-09-25 01:17:00 -07:00
Kuba Mracek
2babc5d67f [embedded] Use ASTContext directly from IRGenModule 2023-09-24 20:51:51 -07:00
Kuba Mracek
211f613e10 [embedded] Stop emitting metadata for extensions 2023-09-24 20:49:10 -07:00
Evan Wilde
ae6057984f Revert "Keep certain function that are potentially used in the debugger" 2023-09-20 13:06:12 -07:00
Augusto Noronha
3bc42c865e Merge pull request #68558 from augusto2112/keep-funcs-for-debugger
Keep certain function that are potentially used in the debugger
2023-09-20 08:23:46 -07:00
Augusto Noronha
e06ba23c75 Keep certain function that are potentially used in the debugger
Currently, when compiling with no optimizations on, we still delete
functions that are sometimes used in the debugger. For example, users
might want to call functions which are unused, or compiler generated
setters/getters.

rdar://101046198
2023-09-18 13:51:56 -07:00
swift-ci
0d132bc4a7 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-18 10:14:22 -07:00
Kuba Mracek
a5d5621398 [embedded] Fix compiler asserts when building closures 2023-09-15 18:40:39 -07:00
swift-ci
ae30cba296 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-13 10:20:48 -07:00
Kuba Mracek
6ad968467f [embedded] only track specialized class metadata in embedded mode 2023-09-12 22:34:21 -07:00
Kuba Mracek
56085205d8 [embedded] specialize generic classes based on MetatypeInst too, fix lazy emit assert 2023-09-12 21:24:14 -07:00
Kuba Mracek
d0c2a4ccf8 [embedded] Initial support for generic classes in embedded Swift
- VTableSpecializer, a new pass that synthesizes a new vtable per each observed concrete type used
- Don't use full type metadata refs in embedded Swift
- Lazily emit specialized class metadata (LazySpecializedClassMetadata) in IRGen
- Don't emit regular class metadata for a class decl if it's generic (only emit the specialized metadata)
2023-09-12 09:44:54 -07:00
swift-ci
9977c4ec7f Merge remote-tracking branch 'origin/main' into rebranch 2023-09-11 17:55:02 -07:00
Kuba Mracek
ae63e7549b [embedded] Add support for (non-generic) classes in embedded Swift
- In embedded Swift, classes get a simplified metadata: Basically just a vtable + destructor + superclass pointer.
- Only non-resilient (intended as permanent restriction), non-generic classes (for now) supported.
- Relax the check that prohibits metadata emission and usage to allow classes.
2023-09-11 11:22:11 -07:00
swift-ci
5bb21c1303 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-07 01:14:42 -07:00
Kuba Mracek
25eb997a28 [embedded] Add basics of module serialization, importing and validation in embedded Swift.
- Add a flag to the serialized module (IsEmbeddedSwiftModule)
- Check on import that the mode matches (don't allow importing non-embedded module in embedded mode and vice versa)
- Drop TBD support, it's not expected to work in embedded Swift for now
- Drop auto-linking backdeploy libraries, it's not expected to backdeploy embedded Swift for now
- Drop prespecializations, not expected to work in embedded Swift for now
- Use CMO to serialize everything when emitting an embedded Swift module
- Change SILLinker to deserialize/import everything when importing an embedded Swift module
- Add an IR test for importing modules
- Add a deserialization validation test
2023-09-06 20:06:36 -07:00
swift-ci
f52fc06ac7 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-06 18:14:46 -07:00
zoecarver
48789914bb [embedded] Add initial tests; fix two issues in IRGen. 2023-09-06 10:48:17 -07:00
zoecarver
349d37ab24 [embedded] Start fencing parts of IRGen that are not compatible with embedded Swift. 2023-09-06 10:48:17 -07:00
swift-ci
7c389563cf Merge remote-tracking branch 'origin/main' into rebranch 2023-08-28 15:36:21 -07:00
Saleem Abdulrasool
ba9174df18 Cxx: build Cxx module statically on all platforms
This adjusts Cxx to be built statically on all platforms including
Windows.  The static library support is sufficient to support this
module linking statically on Windows.
2023-08-28 09:27:34 -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
swift-ci
f758144b55 Merge remote-tracking branch 'origin/main' into rebranch 2023-08-08 15:14:59 -07:00
Saleem Abdulrasool
1040116e32 IRGen: rework linking against CxxStdlib
Rewrite the handling for the `CxxStdlib` implicit linking to use a
slightly more functional style for filtering.  Additionally, add Windows
to the list providing the overlay.  The Windows linking scenario is a
slightly more complicated as the library names differ between static and
dynamic variants to disambiguate between import libraries and static
libraries.  Take this into account when embedding the library name so
that the linker can find the appropriate content.
2023-08-08 09:03:37 -07:00
swift-ci
d4bb2bb86b Merge remote-tracking branch 'origin/main' into rebranch 2023-08-06 10:14:39 -07:00
Allan Shortlidge
ca8bf981a4 NFC: Hoist queries for unavailable decl optimizations into the AST library.
Moving the query implementation up to the AST library from SIL will allow
conveniences to be written on specific AST element classes. For instance, this
will allow `EnumDecl` to expose a convenience that enumerates element decls
that are available during lowering.

Also, improve naming and documentation for these queries.
2023-08-04 17:39:26 -07: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
250082df25 [NFC] Reformat all the LLVMs
Reformatting everything now that we have `llvm` namespaces. I've
separated this from the main commit to help manage merge-conflicts and
for making it a bit easier to read the mega-patch.
2023-06-27 09:03:52 -07:00
Evan Wilde
f3ff561c6f [NFC] add llvm namespace to Optional and None
This is phase-1 of switching from llvm::Optional to std::optional in the
next rebranch. llvm::Optional was removed from upstream LLVM, so we need
to migrate off rather soon. On Darwin, std::optional, and llvm::Optional
have the same layout, so we don't need to be as concerned about ABI
beyond the name mangling. `llvm::Optional` is only returned from one
function in
```
getStandardTypeSubst(StringRef TypeName,
                     bool allowConcurrencyManglings);
```
It's the return value, so it should not impact the mangling of the
function, and the layout is the same as `std::optional`, so it should be
mostly okay. This function doesn't appear to have users, and the ABI was
already broken 2 years ago for concurrency and no one seemed to notice
so this should be "okay".

I'm doing the migration incrementally so that folks working on main can
cherry-pick back to the release/5.9 branch. Once 5.9 is done and locked
away, then we can go through and finish the replacement. Since `None`
and `Optional` show up in contexts where they are not `llvm::None` and
`llvm::Optional`, I'm preparing the work now by going through and
removing the namespace unwrapping and making the `llvm` namespace
explicit. This should make it fairly mechanical to go through and
replace llvm::Optional with std::optional, and llvm::None with
std::nullopt. It's also a change that can be brought onto the
release/5.9 with minimal impact. This should be an NFC change.
2023-06-27 09:03:52 -07:00
Holly Borla
da8e84caac Merge pull request #66914 from hborla/conformance-macro-in-extension
[Macros] Don't visit macro-generated extensions in `visitAuxiliaryDecls`.
2023-06-26 15:45:03 -07:00
Holly Borla
83030a9c63 [Macros] Don't visit macro-generated extensions in 'visitAuxiliaryDecls'.
Macro-generated extensions are hoisted to file scope, because extensions are
not valid in nested scopes. Callers of 'visitAuxiliaryDecls' assume that the
auxiliary decls are in the same decl context as the original, which is clearly
not the case for extensions, and it leads to issues like visiting extension at
the wrong time during SILGen. The extensions are already added to the top-level
decls, so we don't need to visit them as auxiliary decls, and we can type-check
macro-expanded decls at the end of visitation in TypeCheckDeclPrimary.
2023-06-23 23:25:32 -07:00
Doug Gregor
e306c11a22 [Macros] Ensure that we visit *all* members when emitting memberwise initializer
Fixes rdar://111122261.
2023-06-21 16:12:11 -07:00