Commit Graph

12816 Commits

Author SHA1 Message Date
Nuri Amari
a67b81843b Merge pull request #69434 from apple/vfe-objc-fixes
[swift-vfe] Disable for @objc classes
2023-10-27 12:42:56 -07:00
Nate Chandler
b8990b51e8 [IRGen] Promote generic args to complete.
When metadata record for a generic type is locally cached as ::Complete,
the metadata is known to be complete in that scope.  If it's for a
generic type, being complete means that all of its recursive generic
arguments are also complete.

Previously, though, that fact was not exploited.  So a metadata record
for such an argument which was originally obtained via an incomplete
request would remain cached in that incomplete state even when a generic
type in which it appeared as a generic argument was cached as complete.
At worst, the result was a runtime call (checkMetadataState) to promote
the complete the metadata record for the recursive argument.

Here, when a bound generic type's metadata is locally cached as
complete, its recursive generic arguments are visited; for each such
type for which a metadata record is already locally cached, the
preexisting record is recached as complete.
2023-10-27 12:04:27 -07:00
Saleem Abdulrasool
a94d22e017 Merge pull request #69455 from compnerd/out-in-inout 2023-10-26 22:46:01 -07:00
Saleem Abdulrasool
1cb0099901 IRGen,Serialization: account for transitive dynamic linkage
When building complex projects, there may cases of static libraries
which expose `@inlinable` functions which reference functions from
dynamically linked dependencies. In such a case, we need to consider the
provenance of the `function_ref` when determining the DLL storage for
linkage. We would previously use the deserialised metadata on the
`SILFunction` as there are entities where the `DeclContext` may not be
deserialised. However, this leaves us in a state where we are unable to
determine the actual provenance correctly in some cases. By simply
accessing the parent module directly from the `SILFunction` we ensure
that we properly identify the origin of the function allowing us to
query the DLL storage property. This further allows us to remove the
extra storage required for whether the `SILFunction` is statically
linked.
2023-10-26 18:03:45 -07:00
Alex Lorenz
b527c5923f Merge pull request #69424 from hyp/eng/117494091
[cxx-interop] use raw pointer metadata for dynamic FRT field metadata
2023-10-26 12:54:54 -07:00
Adrian Prantl
5d978b44ca Revert "Revert "Make the DWARF version emitted by the Swift compiler configurable."" 2023-10-26 12:29:18 -07:00
Nuri Amari
87b3127697 [swift-vfe] Disable for @objc classes
Swift methods can be called from Objective-C without a vtable
load, and more importantly without emitting an `llvm.type.checked.load`
instruction. These are effectively virtual callsites that are not
visible to the VFE logic in GlobalDCE.

To to safely enable swift-vfe we must prevent vtables whose functions
are callable from Objective-C from being eliminated.

To do this we ensure such vtables have public vcall_visibility, which
indirectly prevents GlobalDCE from stripping them.
2023-10-26 11:37:10 -07:00
Alex Lorenz
737a623e62 [cxx-interop] use raw pointer metadata for dynamic FRT field metadata
rdar://117494091
2023-10-26 08:19:44 -07:00
Adrian Prantl
2a32ca5944 Revert "Make the DWARF version emitted by the Swift compiler configurable." 2023-10-25 13:28:28 -07:00
Nuri Amari
a2eb58227a [swift-vfe][swift-wme] Stop disabling function mergers for Swift VFE / WME
The Swift and LLVM function mergers were disabled when Swift VFE or WME
are enabled because the function merger did not respect metadata on
calls to `llvm.type.checked.load`. This is no longer the case,
so we can turn these passes back on.
2023-10-25 11:09:47 -07:00
Allan Shortlidge
d0a4f2633c NFC: Fix unused variable warnings. 2023-10-25 09:42:21 -07:00
Adrian Prantl
d19fe381fa Use LLVM definitions for Swift section names (NFC) 2023-10-24 10:58:40 -07:00
Augusto Noronha
8e9c7fd992 Merge pull request #69335 from augusto2112/emit-xi-di-basic
Emit extra inhabitants in debug info for basic types
2023-10-23 16:11:21 -07:00
Kavon Farvardin
66712ce6e0 [Sema] introduce InverseType
This type will become the corresponding type that is resolved for an
`InverseTypeRepr`. This kind of type is not expected to appear past type
 checking (currently, not even past requirement lowering!).
2023-10-23 10:37:22 -07:00
Mishal Shah
aa6a588f45 Merge pull request #69163 from apple/rebranch
Merge `rebranch` into `main` to support `stable/20230725` llvm-project branch
2023-10-23 09:26:37 -07:00
Augusto Noronha
75e45bd024 Emit extra inhabitants in debug info for basic types
To support debugging embedded Swift, we will need to store information
that previously we searched in metadata. Extra inhabitants is one of
those.
2023-10-20 16:14:52 -07:00
swift-ci
b2dcca3e96 Merge pull request #69242 from ktoso/wip-handle-library-evolution-mode-with-distributed-actors
[Distributed] Handle dispatch thunks and superclasses in ad-hoc witness for decodeNextArguent
2023-10-19 23:40:30 -07:00
Konrad `ktoso` Malawski
b542a5dc19 Simplify branching logic 2023-10-20 13:43:46 +09:00
Konrad `ktoso` Malawski
2bda332738 Remove dumpContext 2023-10-20 13:15:47 +09:00
Konrad `ktoso` Malawski
137dddba17 handle detecting generic code better 2023-10-20 10:40:33 +09:00
Konrad `ktoso` Malawski
8159b239d1 [Distributed] Handle dispach thunks of decodeNextArgument in Distributed IRGen
correct way to detect dispatch thunk presence in GenDistributed
2023-10-20 10:30:46 +09:00
Ben Barham
360c5d8465 Merge remote-tracking branch 'origin/main' into 20231019-merge-main
Conflicts:
  - `lib/AST/TypeCheckRequests.cpp` renamed `isMoveOnly` which requires
    a static_cast on rebranch because `Optional` is now a `std::optional`.
2023-10-19 16:16:23 -07:00
Erik Eckstein
3e8921e1ec IRGen: remove a wrong assert for global variable initialization
The assert was wrong because in case a global variable reference another global variable, it can be the case that the other variable is first generated as declaration and then "converted" to a definition by adding the constant initializer.

rdar://117189962
2023-10-19 20:29:58 +02:00
Kavon Farvardin
148897ac1a [nfc] refactor ValueDecl::isMoveOnly
I've renamed the method to `TypeDecl::isNoncopyable`, because the query
doesn't make sense for many other kinds of `ValueDecl`'s beyond the
`TypeDecl`'s. In fact, it looks like no one was relying on that anyway.

Thus, we now have a distinction where in Sema, you ask whether
a `Type` or `TypeDecl` is "Noncopyable". But within SIL, we still
preserve the notion of "move-only" since there is additionally the
move-only type wrapper for types that otherwise support copying.
2023-10-18 13:45:50 -07:00
Mishal Shah
3594f8ecaf Merge remote-tracking branch 'origin/main' into rebranch
Conflicts:
	test/IRGen/opaque-pointer-llvm.swift
2023-10-15 23:49:40 -07:00
Kuba (Brecka) Mracek
7e9013dd52 Merge pull request #69090 from kubamracek/embedded-actors-and-async-let
[embedded] Add support for actors and async let into the embedded Concurrency runtime
2023-10-15 13:37:35 -07:00
Arnold Schwaighofer
0a5cb1e93f Merge pull request #69160 from aschwaighofer/wip_partial_sil_support_for_generic_throws
Preliminary SIL and IRGen support for error_indirect
2023-10-13 09:34:44 -07:00
Arnold Schwaighofer
9482b0c86b Preliminary SIL and IRGen support for error_indirect
IRGen lowering of non-fixed-sized typed errors and the SIL support necessary to
spell out IRGen test cases.
2023-10-12 18:09:52 -07:00
swift-ci
13417f9331 Merge remote-tracking branch 'origin/main' into rebranch 2023-10-12 09:35:04 -07:00
Yuta Saito
051bf4dd43 Merge pull request #69107 from kateinoigakukun/yt/extern-wasm-sym
[wasm] Add @_extern(wasm) attribute support
2023-10-12 09:29:13 -07:00
Yuta Saito
bd898b0e7e [wasm] add @_extern(wasm) attribute support
This attribute instructs the compiler that this function declaration
should be "import"ed from host environment. It's equivalent of Clang's
`__attribute__((import_module("module"), import_name("field")))`
2023-10-10 22:42:08 +00:00
swift-ci
46c67c20cf Merge remote-tracking branch 'origin/main' into rebranch 2023-10-10 02:35:18 -07:00
Hamish Knight
03b6623f72 Merge pull request #69074 from hamishknight/over-extended 2023-10-10 10:25:57 +01:00
Kuba Mracek
90e1d2006f [embedded] Add support for actors and async let into the embedded Concurrency runtime 2023-10-09 22:43:50 -07:00
Evan Wilde
24d0db249b Merge remote-tracking branch 'main' into 'rebranch'
Conflicts:
  CMakeLists.txt
    Take new BRIDGING_MODE

  SwiftCompilerSources/Sources/SIL/GlobalVariable.swift
    Take new
2023-10-09 17:21:23 -07:00
Augusto Noronha
efc86aafb5 Merge pull request #68843 from augusto2112/keep-funcs-for-deb-tests
Keep certain function that are potentially used in the debugger
2023-10-09 13:58:21 -07:00
Hamish Knight
ccd32eb452 NFC: Remove ClangModuleLoader.h include from ExtInfo.h
This was unnecessarily pulling in a whole bunch
of Clang headers when all was needed was a
forward declaration.
2023-10-09 20:29:03 +01:00
Kuba (Brecka) Mracek
356bfd56db Merge pull request #69010 from kubamracek/embedded-zero-sized-structs
[embedded] Fix IR verification crash when using arrays of zero-sized structs
2023-10-09 08:44:05 -07:00
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
6e01afa811 Merge remote-tracking branch 'origin/main' into rebranch 2023-10-08 12:54:13 -07:00
Kuba (Brecka) Mracek
b9150abd53 Merge pull request #69043 from kubamracek/typed-throws-irgen-workaround
[Typed throws] Workaround for LLVM miscompile of unused swifterror, add executable test
2023-10-08 12:39:15 -07: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
Kuba Mracek
b254a2a2c0 [Typed throws] Workaround for LLVM miscompile of unused swifterror, add executable test 2023-10-07 22:03:32 -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
5b72fbae64 Merge remote-tracking branch 'origin/main' into rebranch 2023-10-06 17:15:26 -07:00