Skip to content

Commit 3702a00

Browse files
authored
Merge pull request #3638 from swiftwasm/main
2 parents 5c69a89 + 5c00c7e commit 3702a00

File tree

104 files changed

+49893
-2052
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+49893
-2052
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ endif()
503503
# Use dispatch as the system scheduler by default.
504504
# For convenience, we set this to false when concurrency is disabled.
505505
set(SWIFT_CONCURRENCY_USES_DISPATCH FALSE)
506-
if(SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY AND NOT SWIFT_STDLIB_SINGLE_THREADED_RUNTIME)
506+
if(SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY AND "${SWIFT_CONCURRENCY_GLOBAL_EXECUTOR}" STREQUAL "dispatch")
507507
set(SWIFT_CONCURRENCY_USES_DISPATCH TRUE)
508508
endif()
509509

docs/ABI/Mangling.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,13 @@ Globals
137137
global ::= type assoc-type-list 'MXA' // generic parameter ref (HISTORICAL)
138138
global ::= protocol 'Mp' // protocol descriptor
139139

140+
global ::= protocol 'Hr' // protocol descriptor runtime record
141+
global ::= nominal-type 'Hn' // nominal type descriptor runtime record
142+
#if SWIFT_RUNTIME_VERSION >= 5.1
143+
global ::= opaque-type 'Ho' // opaque type descriptor runtime record
144+
#endif
145+
global ::= protocol-conformance 'Hc' // protocol conformance runtime record
146+
140147
global ::= nominal-type 'Mo' // class metadata immediate member base offset
141148

142149
global ::= type 'MF' // metadata for remote mirrors: field descriptor

include/swift/AST/ASTMangler.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,8 @@ class ASTMangler : public Mangler {
252252
std::string mangleTypeForTypeName(Type type);
253253

254254
std::string mangleOpaqueTypeDescriptor(const OpaqueTypeDecl *decl);
255+
256+
std::string mangleOpaqueTypeDescriptorRecord(const OpaqueTypeDecl *decl);
255257

256258
std::string mangleDeclType(const ValueDecl *decl);
257259

include/swift/AST/Expr.h

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -307,12 +307,13 @@ class alignas(8) Expr : public ASTAllocated<Expr> {
307307
NumCaptures : 32
308308
);
309309

310-
SWIFT_INLINE_BITFIELD(ApplyExpr, Expr, 1+1+1+1+1,
310+
SWIFT_INLINE_BITFIELD(ApplyExpr, Expr, 1+1+1+1+1+1,
311311
ThrowsIsSet : 1,
312312
Throws : 1,
313313
ImplicitlyAsync : 1,
314314
ImplicitlyThrows : 1,
315-
NoAsync : 1
315+
NoAsync : 1,
316+
ShouldApplyDistributedThunk : 1
316317
);
317318

318319
SWIFT_INLINE_BITFIELD_EMPTY(CallExpr, ApplyExpr);
@@ -1206,7 +1207,9 @@ class DeclRefExpr : public Expr {
12061207
/// which are cross-actor invoked, because such calls actually go over the
12071208
/// transport/network, and may throw from this, rather than the function
12081209
/// implementation itself..
1209-
bool isImplicitlyThrows() const { return Bits.DeclRefExpr.IsImplicitlyThrows; }
1210+
bool isImplicitlyThrows() const {
1211+
return Bits.DeclRefExpr.IsImplicitlyThrows;
1212+
}
12101213

12111214
/// Set whether this reference must account for a `throw` occurring for reasons
12121215
/// other than the function implementation itself throwing, e.g. an
@@ -4391,7 +4394,7 @@ class ApplyExpr : public Expr {
43914394
///
43924395
/// where the new closure is declared to be async.
43934396
///
4394-
/// When the application is implciitly async, the result describes
4397+
/// When the application is implicitly async, the result describes
43954398
/// the actor to which we need to need to hop.
43964399
Optional<ImplicitActorHopTarget> isImplicitlyAsync() const {
43974400
if (!Bits.ApplyExpr.ImplicitlyAsync)
@@ -4419,6 +4422,15 @@ class ApplyExpr : public Expr {
44194422
Bits.ApplyExpr.ImplicitlyThrows = flag;
44204423
}
44214424

4425+
/// Informs IRGen to that this expression should be applied as its distributed
4426+
/// thunk, rather than invoking the function directly.
4427+
bool shouldApplyDistributedThunk() const {
4428+
return Bits.ApplyExpr.ShouldApplyDistributedThunk;
4429+
}
4430+
void setShouldApplyDistributedThunk(bool flag) {
4431+
Bits.ApplyExpr.ShouldApplyDistributedThunk = flag;
4432+
}
4433+
44224434
ValueDecl *getCalledValue() const;
44234435

44244436
static bool classof(const Expr *E) {

include/swift/AST/IRGenOptions.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,8 @@ class IRGenOptions {
361361

362362
unsigned WitnessMethodElimination : 1;
363363

364+
unsigned ConditionalRuntimeRecords : 1;
365+
364366
unsigned InternalizeAtLink : 1;
365367

366368
/// The number of threads for multi-threaded code generation.
@@ -422,7 +424,8 @@ class IRGenOptions {
422424
DisableRoundTripDebugTypes(false), DisableDebuggerShadowCopies(false),
423425
DisableConcreteTypeMetadataMangledNameAccessors(false),
424426
EnableGlobalISel(false), VirtualFunctionElimination(false),
425-
WitnessMethodElimination(false), InternalizeAtLink(false),
427+
WitnessMethodElimination(false), ConditionalRuntimeRecords(false),
428+
InternalizeAtLink(false),
426429
CmdArgs(),
427430
SanitizeCoverage(llvm::SanitizerCoverageOptions()),
428431
TypeInfoFilter(TypeInfoDumpFilter::All) {}

include/swift/AST/SearchPathOptions.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#define SWIFT_AST_SEARCHPATHOPTIONS_H
1515

1616
#include "swift/Basic/ArrayRefView.h"
17-
#include "swift/Basic/PathRemapper.h"
1817
#include "llvm/ADT/Hashing.h"
1918

2019
#include <string>
@@ -98,11 +97,6 @@ class SearchPathOptions {
9897

9998
/// A file containing modules we should perform batch scanning.
10099
std::string BatchScanInputFilePath;
101-
102-
/// Debug path mappings to apply to serialized search paths. These are
103-
/// specified in LLDB from the target.source-map entries.
104-
PathRemapper SearchPathRemapper;
105-
106100
private:
107101
static StringRef
108102
pathStringFromFrameworkSearchPath(const FrameworkSearchPath &next) {

include/swift/Basic/LangOptions.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -771,9 +771,6 @@ namespace swift {
771771
DisableOverlayModules,
772772
EnableClangSPI);
773773
}
774-
775-
std::vector<std::string> getRemappedExtraArgs(
776-
std::function<std::string(StringRef)> pathRemapCallback) const;
777774
};
778775

779776
} // end namespace swift

include/swift/Demangling/DemangleNodes.def

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ CONTEXT_NODE(NativeOwningMutableAddressor)
157157
CONTEXT_NODE(NativePinningAddressor)
158158
CONTEXT_NODE(NativePinningMutableAddressor)
159159
NODE(NominalTypeDescriptor)
160+
NODE(NominalTypeDescriptorRecord)
160161
NODE(NonObjCAttribute)
161162
NODE(Number)
162163
NODE(ObjCAsyncCompletionHandlerImpl)
@@ -182,7 +183,9 @@ NODE(ProtocolConformanceRefInTypeModule)
182183
NODE(ProtocolConformanceRefInProtocolModule)
183184
NODE(ProtocolConformanceRefInOtherModule)
184185
NODE(ProtocolDescriptor)
186+
NODE(ProtocolDescriptorRecord)
185187
NODE(ProtocolConformanceDescriptor)
188+
NODE(ProtocolConformanceDescriptorRecord)
186189
NODE(ProtocolList)
187190
NODE(ProtocolListWithClass)
188191
NODE(ProtocolListWithAnyObject)
@@ -289,6 +292,7 @@ NODE(AccessorFunctionReference)
289292
NODE(OpaqueType)
290293
NODE(OpaqueTypeDescriptorSymbolicReference)
291294
NODE(OpaqueTypeDescriptor)
295+
NODE(OpaqueTypeDescriptorRecord)
292296
NODE(OpaqueTypeDescriptorAccessor)
293297
NODE(OpaqueTypeDescriptorAccessorImpl)
294298
NODE(OpaqueTypeDescriptorAccessorKey)

include/swift/Frontend/FrontendOptions.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,6 @@ class FrontendOptions {
182182
/// module appears to not be a public module.
183183
Optional<bool> SerializeOptionsForDebugging;
184184

185-
/// When true the debug prefix map entries will be applied to debugging
186-
/// options before serialization. These can be reconstructed at debug time by
187-
/// applying the inverse map in SearchPathOptions.SearchPathRemapper.
188-
bool DebugPrefixSerializedDebuggingOptions = false;
189-
190185
/// When true, check if all required SwiftOnoneSupport symbols are present in
191186
/// the module.
192187
bool CheckOnoneSupportCompleteness = false;

include/swift/IRGen/Linking.h

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,18 @@ class LinkEntity {
222222
/// The pointer is a NominalTypeDecl*.
223223
NominalTypeDescriptor,
224224

225+
/// The nominal type descriptor runtime record for a nominal type.
226+
/// The pointer is a NominalTypeDecl*.
227+
NominalTypeDescriptorRecord,
228+
225229
/// The descriptor for an opaque type.
226230
/// The pointer is an OpaqueTypeDecl*.
227231
OpaqueTypeDescriptor,
228232

233+
/// The runtime record for a descriptor for an opaque type.
234+
/// The pointer is an OpaqueTypeDecl*.
235+
OpaqueTypeDescriptorRecord,
236+
229237
/// The descriptor accessor for an opaque type used for dynamic functions.
230238
/// The pointer is an OpaqueTypeDecl*.
231239
OpaqueTypeDescriptorAccessor,
@@ -272,6 +280,10 @@ class LinkEntity {
272280
/// The pointer is a ProtocolDecl*.
273281
ProtocolDescriptor,
274282

283+
/// The protocol descriptor runtime record for a protocol type.
284+
/// The pointer is a ProtocolDecl*.
285+
ProtocolDescriptorRecord,
286+
275287
/// The alias referring to the base of the requirements within the
276288
/// protocol descriptor, which is used to determine the offset of a
277289
/// particular requirement in the witness table.
@@ -372,6 +384,10 @@ class LinkEntity {
372384
/// The pointer is a RootProtocolConformance*.
373385
ProtocolConformanceDescriptor,
374386

387+
/// The protocol conformance descriptor runtime record for a conformance.
388+
/// The pointer is a RootProtocolConformance*.
389+
ProtocolConformanceDescriptorRecord,
390+
375391
// These are both type kinds and protocol-conformance kinds.
376392

377393
/// A lazy protocol witness accessor function. The pointer is a
@@ -481,6 +497,7 @@ class LinkEntity {
481497

482498
static bool isRootProtocolConformanceKind(Kind k) {
483499
return (k == Kind::ProtocolConformanceDescriptor ||
500+
k == Kind::ProtocolConformanceDescriptorRecord ||
484501
k == Kind::ProtocolWitnessTable);
485502
}
486503

@@ -834,12 +851,24 @@ class LinkEntity {
834851
return entity;
835852
}
836853

854+
static LinkEntity forNominalTypeDescriptorRecord(NominalTypeDecl *decl) {
855+
LinkEntity entity;
856+
entity.setForDecl(Kind::NominalTypeDescriptorRecord, decl);
857+
return entity;
858+
}
859+
837860
static LinkEntity forOpaqueTypeDescriptor(OpaqueTypeDecl *decl) {
838861
LinkEntity entity;
839862
entity.setForDecl(Kind::OpaqueTypeDescriptor, decl);
840863
return entity;
841864
}
842865

866+
static LinkEntity forOpaqueTypeDescriptorRecord(OpaqueTypeDecl *decl) {
867+
LinkEntity entity;
868+
entity.setForDecl(Kind::OpaqueTypeDescriptorRecord, decl);
869+
return entity;
870+
}
871+
843872
static LinkEntity forOpaqueTypeDescriptorAccessor(OpaqueTypeDecl *decl) {
844873
LinkEntity entity;
845874
entity.setForDecl(Kind::OpaqueTypeDescriptorAccessor, decl);
@@ -902,6 +931,12 @@ class LinkEntity {
902931
return entity;
903932
}
904933

934+
static LinkEntity forProtocolDescriptorRecord(ProtocolDecl *decl) {
935+
LinkEntity entity;
936+
entity.setForDecl(Kind::ProtocolDescriptorRecord, decl);
937+
return entity;
938+
}
939+
905940
static LinkEntity forProtocolRequirementsBaseDescriptor(ProtocolDecl *decl) {
906941
LinkEntity entity;
907942
entity.setForDecl(Kind::ProtocolRequirementsBaseDescriptor, decl);
@@ -1070,6 +1105,14 @@ class LinkEntity {
10701105
return entity;
10711106
}
10721107

1108+
static LinkEntity
1109+
forProtocolConformanceDescriptorRecord(const RootProtocolConformance *C) {
1110+
LinkEntity entity;
1111+
entity.setForProtocolConformance(Kind::ProtocolConformanceDescriptorRecord,
1112+
C);
1113+
return entity;
1114+
}
1115+
10731116
static LinkEntity forCoroutineContinuationPrototype(CanSILFunctionType type) {
10741117
LinkEntity entity;
10751118
entity.setForType(Kind::CoroutineContinuationPrototype, type);

0 commit comments

Comments
 (0)