Commit Graph

12816 Commits

Author SHA1 Message Date
swift-ci
4c1a014a9f Merge remote-tracking branch 'origin/main' into rebranch 2023-09-08 15:18:44 -07:00
Dario Rexin
ca3e3aa237 Merge pull request #68337 from drexin/wip-115013153
[IRGen] Only use value witness getEnumTag function for "normal" enums
2023-09-08 15:16:04 -07:00
Slava Pestov
eefa409656 AST: Change return type of ProtocolConformance::subst() to ProtocolConformanceRef 2023-09-08 15:56:30 -04:00
Shubham Sandeep Rastogi
585c700965 Merge pull request #68138 from rastogishubham/MCCASSwift
Add driver options to swift to enable MCCAS.
2023-09-08 10:17:10 -07:00
Shubham Sandeep Rastogi
3c949028e8 Add driver options to swift to enable MCCAS.
To enable MCCAS, the following driver options have been added

-cas-backend: Enable MCCAS backend in swift, the option
-cache-compile-job must also be used.

-cas-backend-mode=native: Set the CAS Backend mode to emit an object
file after materializing it from the CAS.

-cas-backend-mode=casid: Emit a file with the CASID for the CAS that was
created.

-cas-backend-mode=verify: Verify that the object file created is
identical to the object file materialized from the CAS.

-cas-emit-casid-file: Emit a .casid file next to the object file when
CAS Backend is enabled.
2023-09-08 07:13:57 -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
af68664ed6 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-06 08:13:48 -07:00
Felipe de Azevedo Piovezan
2c3c3c1933 Merge pull request #67077 from DianQK/type-decl-disubprogram
[IRGen][DebugInfo] split method declaration and definition.
2023-09-06 11:08:39 -04:00
swift-ci
703a27a750 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-06 07:55:49 -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
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
89338035f8 Merge remote-tracking branch 'origin/main' into rebranch 2023-08-31 23:34:46 -07:00
Dario Rexin
99a36b3f00 Merge pull request #68229 from drexin/wip-114575149
Fixes for layout strings enum support
2023-08-31 23:19:12 -07:00
Sophia Poirier
86d368f364 Merge remote-tracking branch 'upstream/main' into fix-rebranch-automerger 2023-08-31 14:10:52 -07:00
Michael Gottesman
ba06693745 Merge pull request #68228 from gottesmm/pr-088dba5d9c0854c0e00da0603eb99b770d99709c
[move-only] Rename mark_must_check -> mark_unresolved_non_copyable_value
2023-08-31 09:50:55 -07:00
swift-ci
39b640ce1b Merge remote-tracking branch 'origin/main' into rebranch 2023-08-31 09:05:17 -07:00
Michael Gottesman
37d60a08bb [move-only] Rename mark_must_check -> mark_unresolved_non_copyable_value.
I was originally hoping to reuse mark_must_check for multiple types of checkers.
In practice, this is not what happened... so giving it a name specifically to do
with non copyable types makes more sense and makes the code clearer.

Just a pure rename.
2023-08-30 22:29:30 -07:00
Dario Rexin
2006c643a5 [IRGen] Don't add skip for resilient types in layout strings
The runtime will skip the appropriate number of bytes based on the size of the object
2023-08-30 17:52:03 -07:00
Slava Pestov
361d49a843 AST: Remove DeclContext::getSelfProtocolType() 2023-08-30 15:15:08 -04: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
ae3a2830d1 Merge remote-tracking branch 'origin/main' into rebranch 2023-08-25 07:53:31 -07:00
Erik Eckstein
1a01f870e1 AllocStackHoisting: fix a quadratic complexity bug when merging stack locations.
Use consecutive instruction numbers to check for overlapping instead of iterating over the instruction list.

This fixes a compile time problem which shows up if there are many stack locations in a large basic block.

rdar://113207176
2023-08-25 10:49:21 +02:00
swift-ci
7b3c58cfbc Merge remote-tracking branch 'origin/main' into rebranch 2023-08-24 18:33:27 -07:00
Slava Pestov
68e1ba0a84 Merge pull request #68130 from slavapestov/irgen-fulfilling-tuple
IRGen: Fulfill pack metadata from tuple metadata
2023-08-24 21:24:15 -04:00
Nate Chandler
6ccd08b4e0 Merge branch 'main' into rebranch.
Resolve conflicts introduced in
https://github.com/apple/swift/pull/67944 as follows:

```
diff --git a/include/swift/Runtime/RuntimeFunctions.def b/include/swift/Runtime/RuntimeFunctions.def
index 3c973b5884b..44cde707d17 100644
--- a/include/swift/Runtime/RuntimeFunctions.def
+++ b/include/swift/Runtime/RuntimeFunctions.def
@@ -2537,16 +2537,10 @@ FUNCTION(AutoDiffCreateLinearMapContextWithType,
          swift_autoDiffCreateLinearMapContextWithType, SwiftCC,
          DifferentiationAvailability,
          RETURNS(RefCountedPtrTy),
-<<<<<<< HEAD
-         ARGS(SizeTy),
+         ARGS(TypeMetadataPtrTy),
          ATTRS(NoUnwind),
          EFFECT(AutoDiff),
          MEMEFFECTS(ArgMemOnly))
-=======
-         ARGS(TypeMetadataPtrTy),
-         ATTRS(NoUnwind, ArgMemOnly),
-         EFFECT(AutoDiff))
->>>>>>> public-github/main

 // void *swift_autoDiffProjectTopLevelSubcontext(AutoDiffLinearMapContext *);
 FUNCTION(AutoDiffProjectTopLevelSubcontext,
@@ -2563,16 +2557,10 @@ FUNCTION(AutoDiffAllocateSubcontextWithType,
          swift_autoDiffAllocateSubcontextWithType, SwiftCC,
          DifferentiationAvailability,
          RETURNS(Int8PtrTy),
-<<<<<<< HEAD
-         ARGS(RefCountedPtrTy, SizeTy),
+         ARGS(RefCountedPtrTy, TypeMetadataPtrTy),
          ATTRS(NoUnwind),
          EFFECT(AutoDiff),
          MEMEFFECTS(ArgMemOnly))
-=======
-         ARGS(RefCountedPtrTy, TypeMetadataPtrTy),
-         ATTRS(NoUnwind, ArgMemOnly),
-         EFFECT(AutoDiff))
->>>>>>> public-github/main
```
2023-08-24 16:24:32 -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
Slava Pestov
b2ffac54d3 IRGen: Fulfill pack metadata from tuple metadata
When the SelfMetadata in a witness thunk is the tuple type (repeat each Self),
we can fulfill the pack shape and type metadata for Pack{repeat each Self}
from tuple metadata.

The length is trivially projected; the type metadata pack is slightly more
involved, because tuple metadata stores a list of element/offset pairs, so
we must stack allocate a pack and fill it in.
2023-08-24 17:57:10 -04:00
Slava Pestov
d09fd91826 IRGen: Remove unused parameter from emitPackExpansionPack() 2023-08-24 17:57:10 -04:00
Kshitij Jain
d5a3e2e630 [AutoDiff] Fixes memory leaks in autodiff linear map context allocation builtins (#67944)
When the differentiating a function containing loops, we allocate a linear map context object on the heap. This context object may store non-trivial objects, such as closures, that need to be released explicitly. Fix the autodiff linear map context allocation builtins to correctly release such objects and not just free the memory they occupy.
2023-08-24 13:57:10 -07:00
Dario Rexin
97b2dc722e [IRGen] Assign extraTagByteCount to the correct union field in addSinglePayloadEnumFN 2023-08-24 11:01:55 -07:00
swift-ci
74ccb1c9fd Merge remote-tracking branch 'origin/main' into rebranch 2023-08-23 12:35:53 -07:00
nate-chandler
c3b8091815 Revert "Use clang.arc.attachedcall for emission of objc_retainAutoreleasedReturnValue" 2023-08-23 10:11:35 -07:00
Dario Rexin
0ff7f1db23 [IRGen] Don't generate layout strings for moveonly types 2023-08-21 10:58:47 -07:00
Dario Rexin
734e9b8ed4 [IRGen] Make enum metadata non-const for instantiated layout strings 2023-08-21 10:57:57 -07:00
Dario Rexin
56048ac19f [Runtime+IRGen] Fix existential offset for multiple protocol witnesses 2023-08-21 10:57:06 -07:00
Dario Rexin
8ab845fdca [Runtime+IRGen] Fix offsets of existentials in layout strings 2023-08-21 10:55:51 -07:00
Dario Rexin
30d628270b [IRGen+Runtime] Make more fine grained copies in layout string runtime functions 2023-08-21 10:55:02 -07:00
Dario Rexin
27b1764d13 [Runtime+IRGen] Fix layout string flag in type layout and add array functions 2023-08-21 10:54:35 -07:00
Dario Rexin
31de67c713 [IRGen+Runtime] Further fixes for layout strings 2023-08-21 10:54:14 -07:00
Dario Rexin
4a395cb8d3 [Runtime+IRGen] Some fixes and optimizations for layout strings 2023-08-21 10:53:44 -07:00
swift-ci
174b6bc00c Merge remote-tracking branch 'origin/main' into rebranch 2023-08-18 19:34:12 -07:00
Zak Kent
2abca625d7 Merge branch 'main' into update-immediate 2023-08-18 16:07:14 -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
90562a0fe9 IRGen: Fix linkage of opaque type descriptor with @_alwaysEmitIntoClient owner decl 2023-08-18 12:12:50 -04:00
Slava Pestov
99d68ba14c IRGen: Some progress toward tuple conformances 2023-08-18 12:12:50 -04:00