diff --git a/include/swift/AST/TypeNodes.def b/include/swift/AST/TypeNodes.def index b910f88e33e5f..ae755002445d1 100644 --- a/include/swift/AST/TypeNodes.def +++ b/include/swift/AST/TypeNodes.def @@ -144,7 +144,8 @@ ABSTRACT_TYPE(Builtin, Type) BUILTIN_CONCRETE_TYPE(BuiltinVector, BuiltinType) BUILTIN_GENERIC_TYPE(BuiltinFixedArray, BuiltinType) BUILTIN_CONCRETE_TYPE(BuiltinUnboundGeneric, BuiltinType) - TYPE_RANGE(Builtin, BuiltinInteger, BuiltinUnboundGeneric) + BUILTIN_CONCRETE_TYPE(BuiltinImplicitIsolationActor, BuiltinType) + TYPE_RANGE(Builtin, BuiltinInteger, BuiltinImplicitIsolationActor) TYPE(Tuple, Type) ABSTRACT_TYPE(ReferenceStorage, Type) #define REF_STORAGE(Name, ...) \ @@ -234,6 +235,7 @@ SINGLETON_TYPE(RawPointer, BuiltinRawPointer) SINGLETON_TYPE(RawUnsafeContinuation, BuiltinRawUnsafeContinuation) SINGLETON_TYPE(NativeObject, BuiltinNativeObject) SINGLETON_TYPE(BridgeObject, BuiltinBridgeObject) +SINGLETON_TYPE(ImplicitIsolationActor, BuiltinImplicitIsolationActor) SINGLETON_TYPE(UnsafeValueBuffer, BuiltinUnsafeValueBuffer) SINGLETON_TYPE(DefaultActorStorage, BuiltinDefaultActorStorage) SINGLETON_TYPE(NonDefaultDistributedActorStorage, BuiltinNonDefaultDistributedActorStorage) diff --git a/include/swift/AST/Types.h b/include/swift/AST/Types.h index 4e81fc19580e7..b5f1086abb544 100644 --- a/include/swift/AST/Types.h +++ b/include/swift/AST/Types.h @@ -2014,6 +2014,19 @@ BEGIN_CAN_TYPE_WRAPPER(BuiltinVectorType, BuiltinType) PROXY_CAN_TYPE_SIMPLE_GETTER(getElementType) END_CAN_TYPE_WRAPPER(BuiltinVectorType, BuiltinType) +class BuiltinImplicitIsolationActorType : public BuiltinType { + friend class ASTContext; + + BuiltinImplicitIsolationActorType(const ASTContext &context) + : BuiltinType(TypeKind::BuiltinImplicitIsolationActor, context) {} + +public: + static bool classof(const TypeBase *T) { + return T->getKind() == TypeKind::BuiltinImplicitIsolationActor; + } +}; +DEFINE_EMPTY_CAN_TYPE_WRAPPER(BuiltinImplicitIsolationActorType, BuiltinType) + /// Size descriptor for a builtin integer type. This is either a fixed bit /// width or an abstract target-dependent value such as "size of a pointer". class BuiltinIntegerWidth { diff --git a/include/swift/Basic/LangOptions.h b/include/swift/Basic/LangOptions.h index d1bc0292821f0..3a82d66954022 100644 --- a/include/swift/Basic/LangOptions.h +++ b/include/swift/Basic/LangOptions.h @@ -671,6 +671,9 @@ namespace swift { bool RestrictNonProductionExperimentalFeatures = false; #endif + /// Set to true if we support AArch64TBI. + bool HasAArch64TBI = false; + bool isConcurrencyModelTaskToThread() const { return ActiveConcurrencyModel == ConcurrencyModel::TaskToThread; } diff --git a/include/swift/Frontend/Frontend.h b/include/swift/Frontend/Frontend.h index 029e296ab5d38..6e331491a25bd 100644 --- a/include/swift/Frontend/Frontend.h +++ b/include/swift/Frontend/Frontend.h @@ -274,6 +274,9 @@ class CompilerInvocation { /// C++ stdlib is the default for the specified target. void computeCXXStdlibOptions(); + /// Compute whether or not we support aarch64TBI + void computeAArch64TBIOptions(); + /// Computes the runtime resource path relative to the given Swift /// executable. static void computeRuntimeResourcePathFromExecutablePath( diff --git a/include/swift/SIL/ConcurrencyUtils.h b/include/swift/SIL/ConcurrencyUtils.h new file mode 100644 index 0000000000000..982305b1f10ed --- /dev/null +++ b/include/swift/SIL/ConcurrencyUtils.h @@ -0,0 +1,40 @@ +//===--- ConcurrencyUtils.h -----------------------------------------------===// +// +// This source file is part of the Swift.org open source project +// +// Copyright (c) 2014 - 2025 Apple Inc. and the Swift project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See https://swift.org/LICENSE.txt for license information +// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors +// +//===----------------------------------------------------------------------===// + +#ifndef SWIFT_SIL_CONCURRENCYUTILS_H +#define SWIFT_SIL_CONCURRENCYUTILS_H + +#include "swift/SIL/SILType.h" + +namespace swift { + +class SILValue; +class SILBuilder; +class SILLocation; + +/// Clear the implicit isolated bits of value. +/// +/// \p value must be Builtin.ImplicitIsolationActor +/// +/// \p finalType if empty, we always return +/// Builtin.ImplicitIsolationActor. Otherwise we bitcast to finalType after +/// tieing the lifetime of the result to \p value. +SILValue clearImplicitIsolationActorBits(SILBuilder &b, SILLocation loc, + SILValue value, + SILType finalType = {}); + +SILValue setImplicitIsolationActorBits(SILBuilder &b, SILLocation loc, + SILValue value); + +} // namespace swift + +#endif diff --git a/include/swift/SIL/SILBuilder.h b/include/swift/SIL/SILBuilder.h index a7de04820d7c8..34af0ecd834d7 100644 --- a/include/swift/SIL/SILBuilder.h +++ b/include/swift/SIL/SILBuilder.h @@ -1334,6 +1334,17 @@ class SILBuilder { forwardingOwnershipKind)); } + /// Create an unchecked_value_cast when Ownership SSA is enabled and + /// unchecked_bitwise_cast otherwise. + /// + /// Intended to be used in utility code that needs to support both Ownership + /// SSA and non-Ownership SSA code. + SILValue emitUncheckedValueCast(SILLocation loc, SILValue op, SILType ty) { + if (hasOwnership()) + return createUncheckedValueCast(loc, op, ty); + return createUncheckedBitwiseCast(loc, op, ty); + } + RefToBridgeObjectInst *createRefToBridgeObject(SILLocation Loc, SILValue Ref, SILValue Bits) { return createRefToBridgeObject(Loc, Ref, Bits, Ref->getOwnershipKind()); @@ -2338,6 +2349,13 @@ class SILBuilder { getSILDebugLocation(Loc), Operand, Kind)); } + SILValue emitUncheckedOwnershipConversion(SILLocation Loc, SILValue Operand, + ValueOwnershipKind Kind) { + if (!hasOwnership()) + return Operand; + return createUncheckedOwnershipConversion(Loc, Operand, Kind); + } + FixLifetimeInst *createFixLifetime(SILLocation Loc, SILValue Operand) { return insert(new (getModule()) FixLifetimeInst(getSILDebugLocation(Loc), Operand)); @@ -2357,6 +2375,18 @@ class SILBuilder { dependenceKind); } + /// Emit a mark_dependence instruction placing the kind only if ownership is + /// set in the current function. + /// + /// This is intended to be used in code that is generic over Ownership SSA and + /// non-Ownership SSA code. + SILValue emitMarkDependence(SILLocation Loc, SILValue value, SILValue base, + MarkDependenceKind dependenceKind) { + return createMarkDependence(Loc, value, base, value->getOwnershipKind(), + hasOwnership() ? dependenceKind + : MarkDependenceKind::Escaping); + } + MarkDependenceInst * createMarkDependence(SILLocation Loc, SILValue value, SILValue base, ValueOwnershipKind forwardingOwnershipKind, diff --git a/include/swift/SIL/SILType.h b/include/swift/SIL/SILType.h index 41fdfae5daba3..c71bfecb4ea1c 100644 --- a/include/swift/SIL/SILType.h +++ b/include/swift/SIL/SILType.h @@ -266,6 +266,10 @@ class SILType { bool isBuiltinBridgeObject() const { return is(); } + bool isBuiltinImplicitIsolationActor() const { + return is(); + } + SILType getBuiltinVectorElementType() const { auto vector = castTo(); return getPrimitiveObjectType(vector.getElementType()); @@ -1025,9 +1029,16 @@ class SILType { /// Return '()' static SILType getEmptyTupleType(const ASTContext &C); + /// Return (elementTypes). + static SILType getTupleType(const ASTContext &ctx, + ArrayRef elementTypes); + /// Get the type for opaque actor isolation values. static SILType getOpaqueIsolationType(const ASTContext &C); + /// Return Builtin.ImplicitIsolationActor. + static SILType getBuiltinImplicitIsolationActorType(const ASTContext &ctx); + // // Utilities for treating SILType as a pointer-like type. // diff --git a/include/swift/Strings.h b/include/swift/Strings.h index f1c2dba3461ed..6a146c4d49143 100644 --- a/include/swift/Strings.h +++ b/include/swift/Strings.h @@ -144,6 +144,9 @@ constexpr static BuiltinNameStringLiteral BUILTIN_TYPE_NAME_NATIVEOBJECT = { /// The name of the Builtin type for BridgeObject constexpr static BuiltinNameStringLiteral BUILTIN_TYPE_NAME_BRIDGEOBJECT = { "Builtin.BridgeObject"}; +constexpr static BuiltinNameStringLiteral + BUILTIN_TYPE_NAME_IMPLICITISOLATIONACTOR = { + "Builtin.ImplicitIsolationActor"}; /// The name of the Builtin type for RawPointer constexpr static BuiltinNameStringLiteral BUILTIN_TYPE_NAME_RAWPOINTER = { "Builtin.RawPointer"}; diff --git a/lib/AST/ASTDumper.cpp b/lib/AST/ASTDumper.cpp index 872793e4c1701..5ee7fa1642846 100644 --- a/lib/AST/ASTDumper.cpp +++ b/lib/AST/ASTDumper.cpp @@ -6109,6 +6109,8 @@ namespace { TRIVIAL_TYPE_PRINTER(BuiltinRawUnsafeContinuation, builtin_raw_unsafe_continuation) TRIVIAL_TYPE_PRINTER(BuiltinNativeObject, builtin_native_object) TRIVIAL_TYPE_PRINTER(BuiltinBridgeObject, builtin_bridge_object) + TRIVIAL_TYPE_PRINTER(BuiltinImplicitIsolationActor, + builtin_implicit_isolated_actor) TRIVIAL_TYPE_PRINTER(BuiltinUnsafeValueBuffer, builtin_unsafe_value_buffer) TRIVIAL_TYPE_PRINTER(SILToken, sil_token) diff --git a/lib/AST/ASTMangler.cpp b/lib/AST/ASTMangler.cpp index b7f53971dcc8b..d97eaca060865 100644 --- a/lib/AST/ASTMangler.cpp +++ b/lib/AST/ASTMangler.cpp @@ -1458,6 +1458,8 @@ void ASTMangler::appendType(Type type, GenericSignature sig, auto loc = cast(tybase); return appendType(loc->getSinglyDesugaredType(), sig, forDecl); } + case TypeKind::BuiltinImplicitIsolationActor: + return appendOperator("BA"); case TypeKind::BuiltinFixedArray: { auto bfa = cast(tybase); appendType(bfa->getSize(), sig, forDecl); diff --git a/lib/AST/ASTPrinter.cpp b/lib/AST/ASTPrinter.cpp index ad93f9d5ec34e..85c1106c2861d 100644 --- a/lib/AST/ASTPrinter.cpp +++ b/lib/AST/ASTPrinter.cpp @@ -6156,6 +6156,7 @@ class TypePrinter : public TypeVisitor>(Name) + .Case("FixedArray", BuiltinTypeKind::BuiltinFixedArray) + .StartsWith("Vec", BuiltinTypeKind::BuiltinVector) + .Case("RawPointer", BuiltinTypeKind::BuiltinRawPointer) + .Case("RawUnsafeContinuation", + BuiltinTypeKind::BuiltinRawUnsafeContinuation) + .Case("Job", BuiltinTypeKind::BuiltinJob) + .Case("DefaultActorStorage", + BuiltinTypeKind::BuiltinDefaultActorStorage) + .Case("NonDefaultDistributedActorStorage", + BuiltinTypeKind::BuiltinNonDefaultDistributedActorStorage) + .Case("Executor", BuiltinTypeKind::BuiltinExecutor) + .Case("NativeObject", BuiltinTypeKind::BuiltinNativeObject) + .Case("BridgeObject", BuiltinTypeKind::BuiltinBridgeObject) + .Case("UnsafeValueBuffer", BuiltinTypeKind::BuiltinUnsafeValueBuffer) + .Case("PackIndex", BuiltinTypeKind::BuiltinPackIndex) + .StartsWith("FP", BuiltinTypeKind::BuiltinFloat) + .Case("Word", BuiltinTypeKind::BuiltinInteger) + .Case("IntLiteral", BuiltinTypeKind::BuiltinIntegerLiteral) + .StartsWith("Int", BuiltinTypeKind::BuiltinInteger) + .Case("ImplicitIsolationActor", + BuiltinTypeKind::BuiltinImplicitIsolationActor) + .Default({}); + + // Handle types that are not BuiltinTypeKinds. + if (!kind) { + if (Name == "SILToken") + return Context.TheSILTokenType; + + // AnyObject is the empty class-constrained existential. + if (Name == "AnyObject") + return CanType(ProtocolCompositionType::theAnyObjectType(Context)); + + return Type(); } - // Vectors are VecNxT, where "N" is the number of elements and - // T is the element type. - if (Name.starts_with("Vec")) { + switch (*kind) { + case BuiltinTypeKind::BuiltinFixedArray: + return BuiltinUnboundGenericType::get(TypeKind::BuiltinFixedArray, Context); + + case BuiltinTypeKind::BuiltinVector: { + // Vectors are VecNxT, where "N" is the number of elements and + // T is the element type. Name = Name.substr(3); StringRef::size_type xPos = Name.find('x'); if (xPos == StringRef::npos) @@ -82,67 +121,64 @@ Type swift::getBuiltinType(ASTContext &Context, StringRef Name) { return BuiltinVectorType::get(Context, elementType, numElements); } - - if (Name == "RawPointer") + case BuiltinTypeKind::BuiltinRawPointer: return Context.TheRawPointerType; - if (Name == "RawUnsafeContinuation") + case BuiltinTypeKind::BuiltinRawUnsafeContinuation: return Context.TheRawUnsafeContinuationType; - if (Name == "Job") + case BuiltinTypeKind::BuiltinJob: return Context.TheJobType; - if (Name == "DefaultActorStorage") + case BuiltinTypeKind::BuiltinDefaultActorStorage: return Context.TheDefaultActorStorageType; - if (Name == "NonDefaultDistributedActorStorage") + case BuiltinTypeKind::BuiltinNonDefaultDistributedActorStorage: return Context.TheNonDefaultDistributedActorStorageType; - if (Name == "Executor") + case BuiltinTypeKind::BuiltinExecutor: return Context.TheExecutorType; - if (Name == "NativeObject") + case BuiltinTypeKind::BuiltinNativeObject: return Context.TheNativeObjectType; - if (Name == "BridgeObject") + case BuiltinTypeKind::BuiltinBridgeObject: return Context.TheBridgeObjectType; - if (Name == "SILToken") - return Context.TheSILTokenType; - if (Name == "UnsafeValueBuffer") + case BuiltinTypeKind::BuiltinUnsafeValueBuffer: return Context.TheUnsafeValueBufferType; - if (Name == "PackIndex") + case BuiltinTypeKind::BuiltinPackIndex: return Context.ThePackIndexType; - - if (Name == "FPIEEE32") - return Context.TheIEEE32Type; - if (Name == "FPIEEE64") - return Context.TheIEEE64Type; + case BuiltinTypeKind::BuiltinFloat: + // Target specific FP types. + if (Name == "FPIEEE32") + return Context.TheIEEE32Type; + if (Name == "FPIEEE64") + return Context.TheIEEE64Type; + if (Name == "FPIEEE16") + return Context.TheIEEE16Type; + if (Name == "FPIEEE80") + return Context.TheIEEE80Type; + if (Name == "FPIEEE128") + return Context.TheIEEE128Type; + if (Name == "FPPPC128") + return Context.ThePPC128Type; + return Type(); + case BuiltinTypeKind::BuiltinInteger: + if (Name == "Word") + return BuiltinIntegerType::getWordType(Context); - if (Name == "Word") - return BuiltinIntegerType::getWordType(Context); + if (Name == "Int") { + return BuiltinUnboundGenericType::get(TypeKind::BuiltinInteger, Context); + } - if (Name == "IntLiteral") + // Handle 'int8' and friends. + if (Name.substr(0, 3) == "Int") { + unsigned BitWidth; + if (!Name.substr(3).getAsInteger(10, BitWidth) && BitWidth <= 2048 && + BitWidth != 0) // Cap to prevent unsound things. + return BuiltinIntegerType::get(BitWidth, Context); + } + return Type(); + case BuiltinTypeKind::BuiltinIntegerLiteral: return Context.TheIntegerLiteralType; - - if (Name == "Int") { - return BuiltinUnboundGenericType::get(TypeKind::BuiltinInteger, Context); - } - - // Handle 'int8' and friends. - if (Name.substr(0, 3) == "Int") { - unsigned BitWidth; - if (!Name.substr(3).getAsInteger(10, BitWidth) && - BitWidth <= 2048 && BitWidth != 0) // Cap to prevent unsound things. - return BuiltinIntegerType::get(BitWidth, Context); + case BuiltinTypeKind::BuiltinUnboundGeneric: + return Type(); + case BuiltinTypeKind::BuiltinImplicitIsolationActor: + return Context.TheImplicitIsolationActorType; } - - // Target specific FP types. - if (Name == "FPIEEE16") - return Context.TheIEEE16Type; - if (Name == "FPIEEE80") - return Context.TheIEEE80Type; - if (Name == "FPIEEE128") - return Context.TheIEEE128Type; - if (Name == "FPPPC128") - return Context.ThePPC128Type; - - // AnyObject is the empty class-constrained existential. - if (Name == "AnyObject") - return CanType( - ProtocolCompositionType::theAnyObjectType(Context)); return Type(); } @@ -3472,6 +3508,7 @@ bool BuiltinType::isBitwiseCopyable() const { return true; case BuiltinTypeKind::BuiltinNativeObject: case BuiltinTypeKind::BuiltinBridgeObject: + case BuiltinTypeKind::BuiltinImplicitIsolationActor: case BuiltinTypeKind::BuiltinUnsafeValueBuffer: case BuiltinTypeKind::BuiltinDefaultActorStorage: case BuiltinTypeKind::BuiltinNonDefaultDistributedActorStorage: @@ -3527,6 +3564,10 @@ StringRef BuiltinType::getTypeName(SmallVectorImpl &result, case BuiltinTypeKind::BuiltinBridgeObject: printer << MAYBE_GET_NAMESPACED_BUILTIN(BUILTIN_TYPE_NAME_BRIDGEOBJECT); break; + case BuiltinTypeKind::BuiltinImplicitIsolationActor: + printer << MAYBE_GET_NAMESPACED_BUILTIN( + BUILTIN_TYPE_NAME_IMPLICITISOLATIONACTOR); + break; case BuiltinTypeKind::BuiltinUnsafeValueBuffer: printer << MAYBE_GET_NAMESPACED_BUILTIN( BUILTIN_TYPE_NAME_UNSAFEVALUEBUFFER); diff --git a/lib/AST/ConformanceLookup.cpp b/lib/AST/ConformanceLookup.cpp index 9f80de0d3f45a..bdf7385f75c70 100644 --- a/lib/AST/ConformanceLookup.cpp +++ b/lib/AST/ConformanceLookup.cpp @@ -480,6 +480,14 @@ getBuiltinBuiltinTypeConformance(Type type, const BuiltinType *builtinType, ProtocolDecl *protocol) { if (auto kp = protocol->getKnownProtocolKind()) { switch (*kp) { + case KnownProtocolKind::Actor: { + if (builtinType->getBuiltinTypeKind() != + BuiltinTypeKind::BuiltinImplicitIsolationActor) + break; + return ProtocolConformanceRef(type->getASTContext().getBuiltinConformance( + type, protocol, BuiltinConformanceKind::Synthesized)); + } + case KnownProtocolKind::Sendable: case KnownProtocolKind::SendableMetatype: case KnownProtocolKind::Copyable: diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp index 8adb0cebf09c2..54a82f7ab9c40 100644 --- a/lib/AST/Type.cpp +++ b/lib/AST/Type.cpp @@ -194,6 +194,7 @@ bool CanType::isReferenceTypeImpl(CanType type, const GenericSignatureImpl *sig, // These types are always class references. case TypeKind::BuiltinNativeObject: case TypeKind::BuiltinBridgeObject: + case TypeKind::BuiltinImplicitIsolationActor: case TypeKind::Class: case TypeKind::BoundGenericClass: case TypeKind::SILBox: @@ -514,6 +515,8 @@ bool TypeBase::isActorType() { } bool TypeBase::isAnyActorType() { + if (getCanonicalType() == getASTContext().TheImplicitIsolationActorType) + return true; if (auto actor = getAnyActor()) return actor->isAnyActor(); return false; @@ -4444,6 +4447,7 @@ ReferenceCounting TypeBase::getReferenceCounting() { llvm_unreachable("sugared canonical type?"); case TypeKind::BuiltinNativeObject: + case TypeKind::BuiltinImplicitIsolationActor: case TypeKind::SILBox: return ReferenceCounting::Native; diff --git a/lib/Demangling/Demangler.cpp b/lib/Demangling/Demangler.cpp index e6b5902ad0cb2..6b3660aa551f3 100644 --- a/lib/Demangling/Demangler.cpp +++ b/lib/Demangling/Demangler.cpp @@ -1440,6 +1440,10 @@ NodePointer Demangler::demangleBuiltinType() { NodePointer Ty = nullptr; const int maxTypeSize = 4096; // a very conservative upper bound switch (nextChar()) { + case 'A': + Ty = createNode(Node::Kind::BuiltinTypeName, + BUILTIN_TYPE_NAME_IMPLICITISOLATIONACTOR); + break; case 'b': Ty = createNode(Node::Kind::BuiltinTypeName, BUILTIN_TYPE_NAME_BRIDGEOBJECT); diff --git a/lib/Demangling/Remangler.cpp b/lib/Demangling/Remangler.cpp index 228f890f7593c..6998aa2725afe 100644 --- a/lib/Demangling/Remangler.cpp +++ b/lib/Demangling/Remangler.cpp @@ -909,7 +909,9 @@ ManglingError Remangler::mangleBuiltinTypeName(Node *node, unsigned depth) { Buffer << 'B'; StringRef text = node->getText(); - if (text == BUILTIN_TYPE_NAME_BRIDGEOBJECT) { + if (text == BUILTIN_TYPE_NAME_IMPLICITISOLATIONACTOR) { + Buffer << 'A'; + } else if (text == BUILTIN_TYPE_NAME_BRIDGEOBJECT) { Buffer << 'b'; } else if (text == BUILTIN_TYPE_NAME_UNSAFEVALUEBUFFER) { Buffer << 'B'; diff --git a/lib/DriverTool/sil_opt_main.cpp b/lib/DriverTool/sil_opt_main.cpp index a3f7217c432ef..8e74ad4a7d15c 100644 --- a/lib/DriverTool/sil_opt_main.cpp +++ b/lib/DriverTool/sil_opt_main.cpp @@ -814,6 +814,8 @@ int sil_opt_main(ArrayRef argv, void *MainAddr) { Invocation.getLangOptions().UnavailableDeclOptimizationMode = options.UnavailableDeclOptimization; + Invocation.computeAArch64TBIOptions(); + // Enable strict concurrency if we have the feature specified or if it was // specified via a command line option to sil-opt. if (Invocation.getLangOptions().hasFeature(Feature::StrictConcurrency)) { diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index e4d91285b4458..b2e035b3665ac 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -371,6 +371,13 @@ setBridgingHeaderFromFrontendOptions(ClangImporterOptions &ImporterOpts, FrontendOpts.InputsAndOutputs.getFilenameOfFirstInput(); } +void CompilerInvocation::computeAArch64TBIOptions() { + auto &LLVMArgs = getFrontendOptions().LLVMArgs; + auto aarch64_use_tbi = + std::find(LLVMArgs.begin(), LLVMArgs.end(), "-aarch64-use-tbi"); + LangOpts.HasAArch64TBI = aarch64_use_tbi != LLVMArgs.end(); +} + void CompilerInvocation::computeCXXStdlibOptions() { // The MSVC driver in Clang is not aware of the C++ stdlib, and currently // always assumes libstdc++, which is incorrect: the Microsoft stdlib is @@ -4099,6 +4106,8 @@ bool CompilerInvocation::parseArgs( setIRGenOutputOptsFromFrontendOptions(IRGenOpts, FrontendOpts); setBridgingHeaderFromFrontendOptions(ClangImporterOpts, FrontendOpts); computeCXXStdlibOptions(); + computeAArch64TBIOptions(); + if (LangOpts.hasFeature(Feature::Embedded)) { IRGenOpts.InternalizeAtLink = true; IRGenOpts.DisableLegacyTypeInfo = true; diff --git a/lib/IRGen/GenConcurrency.cpp b/lib/IRGen/GenConcurrency.cpp index 95945c087da3d..1fabe2f05b30d 100644 --- a/lib/IRGen/GenConcurrency.cpp +++ b/lib/IRGen/GenConcurrency.cpp @@ -879,3 +879,131 @@ irgen::emitTaskCreate(IRGenFunction &IGF, llvm::Value *flags, newContext = IGF.Builder.CreateBitCast(newContext, IGF.IGM.Int8PtrTy); return { newTask, newContext }; } + +namespace { + +/// A TypeInfo implementation for Builtin.Executor. +class ImplicitIsolationActorTypeInfo final + : public ScalarPairTypeInfo { + +public: + ImplicitIsolationActorTypeInfo(llvm::StructType *storageType, Size size, + Alignment align, SpareBitVector &&spareBits) + : ScalarPairTypeInfo(storageType, size, std::move(spareBits), align, + IsNotTriviallyDestroyable, IsCopyable, IsFixedSize, + IsABIAccessible) {} + + TypeLayoutEntry *buildTypeLayoutEntry(IRGenModule &IGM, SILType T, + bool useStructLayouts) const override { + if (!useStructLayouts) { + return IGM.typeLayoutCache.getOrCreateTypeInfoBasedEntry(*this, T); + } + return IGM.typeLayoutCache.getOrCreateScalarEntry( + *this, T, ScalarKind::NativeStrongReference); + } + + static Size getFirstElementSize(IRGenModule &IGM) { + return IGM.getPointerSize(); + } + + static StringRef getFirstElementLabel() { return ".actor"; } + + static bool isFirstElementTrivial() { return false; } + + void emitRetainFirstElement( + IRGenFunction &IGF, llvm::Value *data, + std::optional atomicity = std::nullopt) const { + if (!atomicity) + atomicity = IGF.getDefaultAtomicity(); + IGF.emitNativeStrongRetain(data, *atomicity); + } + + void emitReleaseFirstElement( + IRGenFunction &IGF, llvm::Value *data, + std::optional atomicity = std::nullopt) const { + if (!atomicity) + atomicity = IGF.getDefaultAtomicity(); + IGF.emitNativeStrongRelease(data, *atomicity); + } + + void emitAssignFirstElement(IRGenFunction &IGF, llvm::Value *data, + Address address) const { + IGF.emitNativeStrongAssign(data, address); + } + + static Size getSecondElementOffset(IRGenModule &IGM) { + return IGM.getPointerSize(); + } + static Size getSecondElementSize(IRGenModule &IGM) { + return IGM.getPointerSize(); + } + static StringRef getSecondElementLabel() { return ".witness_table_pointer"; } + bool isSecondElementTrivial() const { return true; } + + void emitRetainSecondElement( + IRGenFunction &IGF, llvm::Value *data, + std::optional atomicity = std::nullopt) const {} + void emitReleaseSecondElement( + IRGenFunction &IGF, llvm::Value *data, + std::optional atomicity = std::nullopt) const {} + void emitAssignSecondElement(IRGenFunction &IGF, llvm::Value *context, + Address dataAddr) const { + IGF.Builder.CreateStore(context, dataAddr); + } + + // Both pointers may have extra info. + bool mayHaveExtraInhabitants(IRGenModule &IGM) const override { return true; } + PointerInfo getPointerInfo(IRGenModule &IGM) const { + return PointerInfo::forHeapObject(IGM); + } + unsigned getFixedExtraInhabitantCount(IRGenModule &IGM) const override { + return getPointerInfo(IGM).getExtraInhabitantCount(IGM); + } + APInt getFixedExtraInhabitantValue(IRGenModule &IGM, unsigned bits, + unsigned index) const override { + return getPointerInfo(IGM).getFixedExtraInhabitantValue(IGM, bits, index, + 0); + } + llvm::Value *getExtraInhabitantIndex(IRGenFunction &IGF, Address src, + SILType T, + bool isOutlined) const override { + src = projectFirstElement(IGF, src); + return getPointerInfo(IGF.IGM).getExtraInhabitantIndex(IGF, src); + } + void storeExtraInhabitant(IRGenFunction &IGF, llvm::Value *index, + Address dest, SILType T, + bool isOutlined) const override { + // Store the extra-inhabitant value in the first (identity) word. + auto first = projectFirstElement(IGF, dest); + getPointerInfo(IGF.IGM).storeExtraInhabitant(IGF, index, first); + + // Zero the second word. + auto second = projectSecondElement(IGF, dest); + IGF.Builder.CreateStore(llvm::ConstantInt::get(IGF.IGM.ExecutorSecondTy, 0), + second); + } +}; + +} // end anonymous namespace + +const LoadableTypeInfo &IRGenModule::getImplicitIsolationActorTypeInfo() { + return Types.getImplicitIsolationActorTypeInfo(); +} + +const LoadableTypeInfo &TypeConverter::getImplicitIsolationActorTypeInfo() { + if (ImplicitIsolationActorTI) + return *ImplicitIsolationActorTI; + + auto ty = IGM.SwiftImplicitIsolationActorType; + SpareBitVector spareBits; + spareBits.append(IGM.getHeapObjectSpareBits()); + spareBits.append(IGM.getWitnessTablePtrSpareBits()); + + ImplicitIsolationActorTI = new ImplicitIsolationActorTypeInfo( + ty, IGM.getPointerSize() * 2, IGM.getPointerAlignment(), + std::move(spareBits)); + ImplicitIsolationActorTI->NextConverted = FirstType; + FirstType = ImplicitIsolationActorTI; + return *ImplicitIsolationActorTI; +} diff --git a/lib/IRGen/GenType.cpp b/lib/IRGen/GenType.cpp index 26dc3e4b5f277..6de8d060c8e16 100644 --- a/lib/IRGen/GenType.cpp +++ b/lib/IRGen/GenType.cpp @@ -2255,6 +2255,8 @@ const TypeInfo *TypeConverter::convertType(CanType ty) { } case TypeKind::BuiltinNativeObject: return &getNativeObjectTypeInfo(); + case TypeKind::BuiltinImplicitIsolationActor: + return &getImplicitIsolationActorTypeInfo(); case TypeKind::BuiltinBridgeObject: return &getBridgeObjectTypeInfo(); case TypeKind::BuiltinUnsafeValueBuffer: diff --git a/lib/IRGen/GenType.h b/lib/IRGen/GenType.h index 19d8eb5a5b9c2..73c7bc1e2d2a4 100644 --- a/lib/IRGen/GenType.h +++ b/lib/IRGen/GenType.h @@ -112,6 +112,7 @@ class TypeConverter { const LoadableTypeInfo *JobTI = nullptr; const LoadableTypeInfo *ExecutorTI = nullptr; const LoadableTypeInfo *WitnessTablePtrTI = nullptr; + const LoadableTypeInfo *ImplicitIsolationActorTI = nullptr; const TypeInfo *TypeMetadataPtrTI = nullptr; const TypeInfo *SwiftContextPtrTI = nullptr; const TypeInfo *TaskContinuationFunctionPtrTI = nullptr; @@ -202,6 +203,7 @@ class TypeConverter { const LoadableTypeInfo &getNativeObjectTypeInfo(); const LoadableTypeInfo &getUnknownObjectTypeInfo(); const LoadableTypeInfo &getBridgeObjectTypeInfo(); + const LoadableTypeInfo &getImplicitIsolationActorTypeInfo(); const LoadableTypeInfo &getRawPointerTypeInfo(); const LoadableTypeInfo &getRawUnsafeContinuationTypeInfo(); const LoadableTypeInfo &getJobTypeInfo(); diff --git a/lib/IRGen/IRGenDebugInfo.cpp b/lib/IRGen/IRGenDebugInfo.cpp index 3390f11f4b2f6..90bfe12b88469 100644 --- a/lib/IRGen/IRGenDebugInfo.cpp +++ b/lib/IRGen/IRGenDebugInfo.cpp @@ -1953,6 +1953,12 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo { llvm::DINode::FlagArtificial, MangledName); } + case TypeKind::BuiltinImplicitIsolationActor: { + return createDoublePointerSizedStruct( + Scope, "Builtin.ImplicitIsolationActor", nullptr, MainFile, 0, + llvm::DINode::FlagArtificial, MangledName); + } + case TypeKind::DynamicSelf: { // Self. We don't have a way to represent instancetype in DWARF, // so we emit the static type instead. This is similar to what we diff --git a/lib/IRGen/IRGenFunction.cpp b/lib/IRGen/IRGenFunction.cpp index e4ec6b07fe44b..836b154dfb51b 100644 --- a/lib/IRGen/IRGenFunction.cpp +++ b/lib/IRGen/IRGenFunction.cpp @@ -105,6 +105,10 @@ SILModule &IRGenFunction::getSILModule() const { return IGM.getSILModule(); } +ASTContext &IRGenFunction::getASTContext() const { + return getSILModule().getASTContext(); +} + Lowering::TypeConverter &IRGenFunction::getSILTypes() const { return IGM.getSILTypes(); } diff --git a/lib/IRGen/IRGenFunction.h b/lib/IRGen/IRGenFunction.h index 832d6504985a7..f384369070cb0 100644 --- a/lib/IRGen/IRGenFunction.h +++ b/lib/IRGen/IRGenFunction.h @@ -84,6 +84,7 @@ class IRGenFunction { llvm::Function *const CurFn; ModuleDecl *getSwiftModule() const; SILModule &getSILModule() const; + ASTContext &getASTContext() const; Lowering::TypeConverter &getSILTypes() const; const IRGenOptions &getOptions() const; diff --git a/lib/IRGen/IRGenModule.cpp b/lib/IRGen/IRGenModule.cpp index 6f567ce303c2e..609ea5628b30c 100644 --- a/lib/IRGen/IRGenModule.cpp +++ b/lib/IRGen/IRGenModule.cpp @@ -784,6 +784,12 @@ IRGenModule::IRGenModule(IRGenerator &irgen, PtrTy, PtrTy, }); + SwiftImplicitIsolationActorType = + createStructType(*this, "swift.implicit_isolated_actor_type", + { + RefCountedPtrTy, // ref counted pointer + Int8PtrTy, // witness table pointer + }); } IRGenModule::~IRGenModule() { diff --git a/lib/IRGen/IRGenModule.h b/lib/IRGen/IRGenModule.h index 562b7ce2f0947..8f9e41993ed62 100644 --- a/lib/IRGen/IRGenModule.h +++ b/lib/IRGen/IRGenModule.h @@ -857,6 +857,9 @@ class IRGenModule { llvm::IntegerType *CoroAllocatorFlagsTy; llvm::StructType *CoroAllocatorTy; + llvm::StructType + *SwiftImplicitIsolationActorType; // { %swift.refcounted, i8* } + llvm::GlobalVariable *TheTrivialPropertyDescriptor = nullptr; llvm::Constant *swiftImmortalRefCount = nullptr; @@ -1100,6 +1103,7 @@ class IRGenModule { const LoadableTypeInfo & getReferenceObjectTypeInfo(ReferenceCounting refcounting); const LoadableTypeInfo &getNativeObjectTypeInfo(); + const LoadableTypeInfo &getImplicitIsolationActorTypeInfo(); const LoadableTypeInfo &getUnknownObjectTypeInfo(); const LoadableTypeInfo &getBridgeObjectTypeInfo(); const LoadableTypeInfo &getRawPointerTypeInfo(); diff --git a/lib/IRGen/IRGenSIL.cpp b/lib/IRGen/IRGenSIL.cpp index c9678b127d800..8f2b89c479d4e 100644 --- a/lib/IRGen/IRGenSIL.cpp +++ b/lib/IRGen/IRGenSIL.cpp @@ -312,7 +312,9 @@ class LoweredValue { bool isBoxWithAddress() const { return kind == Kind::OwnedAddress; } - + + bool isExplosionVector() const { return kind == Kind::ExplosionVector; } + const StackAddress &getStackAddress() const { return Storage.get(kind); } @@ -3373,12 +3375,44 @@ void IRGenSILFunction::visitExistentialMetatypeInst( setLoweredExplosion(i, result); } -static void emitApplyArgument(IRGenSILFunction &IGF, - SILValue arg, - SILType paramType, - Explosion &out, - SILInstruction *apply = nullptr, - unsigned idx = 0) { +static llvm::Value *clearImplicitIsolatedActorBits(IRGenFunction &IGF, + llvm::Value *value) { + // Helper. We conditionally use this and just use a simple helper function + // here so we do not expose the internals of clearing implicit isolated actor + // bits into the rest of the file. The work here is very straight forward. + auto getTBIClearMask = [](IRGenFunction &IGF) -> llvm::Value * { + auto *one = llvm::ConstantInt::get(IGF.IGM.IntPtrTy, 1); + auto *three = llvm::ConstantInt::get(IGF.IGM.IntPtrTy, 3); + auto *four = llvm::ConstantInt::get(IGF.IGM.IntPtrTy, 4); + auto *valueToShiftLit = llvm::ConstantInt::get(IGF.IGM.IntPtrTy, 3); + + auto *sizeOfWord = + llvm::ConstantInt::get(IGF.IGM.IntPtrTy, one->getBitWidth() >> 3); + + // sizeof(Word) - 1 + auto *sub = IGF.Builder.CreateSub(sizeOfWord, one); + // (sizeof(Word) - 1) << 3 + auto *innerShift = IGF.Builder.CreateShl(sub, three); + // ((sizeof(Word) - 1) << 3) + 4 + auto *innerShiftOffset = IGF.Builder.CreateAdd(innerShift, four); + auto *negBits = llvm::ConstantInt::get(IGF.IGM.IntPtrTy, -1); + // (valueToShiftLit << innerShiftOffset) ^ -1. + return IGF.Builder.CreateXor( + IGF.Builder.CreateShl(valueToShiftLit, innerShiftOffset), negBits); + }; + + auto *cast = IGF.Builder.CreateBitOrPointerCast(value, IGF.IGM.IntPtrTy); + auto *bitMask = IGF.getASTContext().LangOpts.HasAArch64TBI + ? getTBIClearMask(IGF) + : llvm::ConstantInt::get(IGF.IGM.IntPtrTy, -4); + auto *result = IGF.Builder.CreateAnd(cast, bitMask); + return IGF.Builder.CreateBitOrPointerCast(result, value->getType()); +} + +static void emitApplyArgument(IRGenSILFunction &IGF, SILValue arg, + SILType paramType, Explosion &out, + SILInstruction *apply = nullptr, unsigned idx = 0, + bool isImplicitIsolatedParameter = false) { bool isSubstituted = (arg->getType() != paramType); // For indirect arguments, we just need to pass a pointer. @@ -3420,7 +3454,20 @@ static void emitApplyArgument(IRGenSILFunction &IGF, } canForwardLoadToIndirect = true; }(); - IGF.getLoweredExplosion(arg, out); + + // If we are emitting a parameter for an implicit isolated parameter, then + // we need to clear the implicit isolated actor bits. + if (isImplicitIsolatedParameter) { + auto &loweredValue = IGF.getLoweredValue(arg); + assert(loweredValue.isExplosionVector() && + "Should be an explosion of two pointers"); + auto explosionVector = loweredValue.getKnownExplosionVector(); + assert(explosionVector.size() == 2 && "We should have two values"); + out.add(explosionVector[0]); + out.add(clearImplicitIsolatedActorBits(IGF, explosionVector[1])); + } else { + IGF.getLoweredExplosion(arg, out); + } if (canForwardLoadToIndirect) { IGF.setForwardableArgument(idx); } @@ -3838,6 +3885,20 @@ void IRGenSILFunction::visitFullApplySite(FullApplySite site) { } } + // Extract the implicit isolated parameter so that we can mask it as + // appropriate. + // + // NOTE: We cannot just drop_front since we could be between the indirect + // results and the parameters. + std::optional implicitIsolatedParameterIndex; + if (auto actorIsolation = site.getFunction()->getActorIsolation(); + actorIsolation && actorIsolation->isCallerIsolationInheriting() && + site.isCallerIsolationInheriting()) { + auto *iso = site.getIsolatedArgumentOperandOrNullPtr(); + assert(iso); + implicitIsolatedParameterIndex = site.getAppliedArgIndex(*iso); + } + // Lower the arguments and return value in the callee's generic context. GenericContextScope scope(IGM, origCalleeType->getInvocationGenericSignature()); @@ -3898,8 +3959,11 @@ void IRGenSILFunction::visitFullApplySite(FullApplySite site) { emission->setIndirectTypedErrorResultSlot(addr.getAddress()); continue; } + emitApplyArgument(*this, args[index], emission->getParameterType(index), - llArgs, site.getInstruction(), index); + llArgs, site.getInstruction(), index, + implicitIsolatedParameterIndex && + *implicitIsolatedParameterIndex == index); } // Pass the generic arguments. @@ -6284,10 +6348,10 @@ static bool hasReferenceSemantics(IRGenSILFunction &IGF, auto operType = silType.getASTType(); auto valueType = operType->getOptionalObjectType(); auto objType = valueType ? valueType : operType; - return (objType->mayHaveSuperclass() - || objType->isClassExistentialType() - || objType->is() - || objType->is()); + return (objType->mayHaveSuperclass() || objType->isClassExistentialType() || + objType->is() || + objType->is() || + objType->is()); } static llvm::Value *emitIsUnique(IRGenSILFunction &IGF, SILValue operand, diff --git a/lib/IRGen/MetadataRequest.cpp b/lib/IRGen/MetadataRequest.cpp index bfd08bc1959a0..f748993d3e297 100644 --- a/lib/IRGen/MetadataRequest.cpp +++ b/lib/IRGen/MetadataRequest.cpp @@ -1799,6 +1799,12 @@ namespace { return emitDirectMetadataRef(type); } + MetadataResponse visitBuiltinImplicitIsolationActor( + CanBuiltinImplicitIsolationActorType type, + DynamicMetadataRequest request) { + return emitDirectMetadataRef(type); + } + MetadataResponse visitBuiltinBridgeObjectType(CanBuiltinBridgeObjectType type, DynamicMetadataRequest request) { @@ -1835,6 +1841,12 @@ namespace { return emitDirectMetadataRef(type); } + MetadataResponse visitBuiltinImplicitIsolationActorType( + CanBuiltinImplicitIsolationActorType type, + DynamicMetadataRequest request) { + return emitDirectMetadataRef(type); + } + MetadataResponse visitBuiltinPackIndexType(CanBuiltinPackIndexType type, DynamicMetadataRequest request) { diff --git a/lib/SIL/IR/SILFunctionType.cpp b/lib/SIL/IR/SILFunctionType.cpp index ba3b4c7143a87..c74476d02b20f 100644 --- a/lib/SIL/IR/SILFunctionType.cpp +++ b/lib/SIL/IR/SILFunctionType.cpp @@ -1704,11 +1704,7 @@ class DestructureInputs { // require it. if (IsolationInfo && IsolationInfo->isCallerIsolationInheriting() && extInfoBuilder.isAsync() && !Foreign.async) { - auto actorProtocol = TC.Context.getProtocol(KnownProtocolKind::Actor); - auto actorType = - ExistentialType::get(actorProtocol->getDeclaredInterfaceType()); - addParameter(-1, - CanType(actorType).wrapInOptionalType(), + addParameter(-1, CanType(TC.Context.TheImplicitIsolationActorType), ParameterConvention::Direct_Guaranteed, ParameterTypeFlags().withIsolated(true), true /*implicit leading parameter*/); diff --git a/lib/SIL/IR/SILType.cpp b/lib/SIL/IR/SILType.cpp index 8ffb695558c65..7afb3e5ef4a3e 100644 --- a/lib/SIL/IR/SILType.cpp +++ b/lib/SIL/IR/SILType.cpp @@ -103,6 +103,21 @@ SILType SILType::getEmptyTupleType(const ASTContext &C) { return getPrimitiveObjectType(C.TheEmptyTupleType); } +SILType SILType::getTupleType(const ASTContext &ctx, + ArrayRef elementTypes) { + if (elementTypes.empty()) + return SILType::getEmptyTupleType(ctx); + + SmallVector tupleTypeElts; + auto category = elementTypes[0].getCategory(); + for (auto type : elementTypes) { + assert(type.getCategory() == category && "Mismatched tuple elt categories"); + tupleTypeElts.push_back(TupleTypeElt(type.getRawASTType())); + } + auto tupleType = TupleType::get(tupleTypeElts, ctx); + return SILType::getPrimitiveType(tupleType->getCanonicalType(), category); +} + SILType SILType::getSILTokenType(const ASTContext &C) { return getPrimitiveObjectType(C.TheSILTokenType); } @@ -117,6 +132,11 @@ SILType SILType::getOpaqueIsolationType(const ASTContext &C) { return getPrimitiveObjectType(CanType(actorType).wrapInOptionalType()); } +SILType SILType::getBuiltinImplicitIsolationActorType(const ASTContext &ctx) { + return getPrimitiveObjectType( + ctx.TheImplicitIsolationActorType->getCanonicalType()); +} + bool SILType::isTrivial(const SILFunction &F) const { auto contextType = hasTypeParameter() ? F.mapTypeIntoContext(*this) : *this; diff --git a/lib/SIL/IR/TypeLowering.cpp b/lib/SIL/IR/TypeLowering.cpp index bf96464e2b263..d3d24439afb76 100644 --- a/lib/SIL/IR/TypeLowering.cpp +++ b/lib/SIL/IR/TypeLowering.cpp @@ -345,6 +345,7 @@ namespace { IMPL(BuiltinPackIndex, Trivial) IMPL(BuiltinNativeObject, Reference) IMPL(BuiltinBridgeObject, Reference) + IMPL(BuiltinImplicitIsolationActor, Reference) IMPL(BuiltinVector, Trivial) IMPL(SILToken, Trivial) IMPL(AnyMetatype, Trivial) @@ -2381,6 +2382,18 @@ namespace { UnsafeValueBufferTypeLowering(silType, Expansion, isSensitive); } + TypeLowering *visitBuiltinImplicitIsolationActorType( + CanBuiltinImplicitIsolationActorType type, AbstractionPattern origType, + IsTypeExpansionSensitive_t isSensitive) { + auto silType = SILType::getPrimitiveObjectType(type); + auto properties = SILTypeProperties(); + properties.setTypeExpansionSensitive(isSensitive); + properties.setNonTrivial(); + properties.setLexical(IsLexical); + return new (TC) + MiscNontrivialTypeLowering(silType, properties, Expansion); + } + TypeLowering *visitPackType(CanPackType packType, AbstractionPattern origType, IsTypeExpansionSensitive_t isSensitive) { diff --git a/lib/SIL/Utils/CMakeLists.txt b/lib/SIL/Utils/CMakeLists.txt index bb4ecf1edf78a..829479aa4cd75 100644 --- a/lib/SIL/Utils/CMakeLists.txt +++ b/lib/SIL/Utils/CMakeLists.txt @@ -2,6 +2,7 @@ target_sources(swiftSIL PRIVATE BasicBlockUtils.cpp BitDataflow.cpp CalleeCache.cpp + ConcurrencyUtils.cpp DebugUtils.cpp Dominance.cpp DynamicCasts.cpp diff --git a/lib/SIL/Utils/ConcurrencyUtils.cpp b/lib/SIL/Utils/ConcurrencyUtils.cpp new file mode 100644 index 0000000000000..e0f7e95200cca --- /dev/null +++ b/lib/SIL/Utils/ConcurrencyUtils.cpp @@ -0,0 +1,152 @@ +//===--- ConcurrencyUtils.cpp ---------------------------------------------===// +// +// This source file is part of the Swift.org open source project +// +// Copyright (c) 2014 - 2025 Apple Inc. and the Swift project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See https://swift.org/LICENSE.txt for license information +// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors +// +//===----------------------------------------------------------------------===// + +#include "swift/SIL/ConcurrencyUtils.h" + +#include "swift/SIL/SILBuilder.h" +#include "swift/SIL/SILLocation.h" + +using namespace swift; + +/// We could use a higher bit. But by reusing the first bit, we just save a +/// little bit of code. +/// +/// $valueToShift << (((sizeof(Word) - 1) << 3) + 4) +/// +/// Mathematicaly this is $valueToShift * 2**((sizeof(Word) - 1)*8 + 4) +/// +/// On 64 bit this is 60. This works since we want to use the bottom two bits of +/// the top nibble of the TBI bits. +static SILValue getTBIBits(SILBuilder &b, SILLocation loc, + unsigned valueToShift = 1) { + auto &ctx = b.getASTContext(); + auto silWordType = SILType::getBuiltinWordType(ctx); + + auto id = ctx.getIdentifier(getBuiltinName(BuiltinValueKind::Sizeof)); + auto *builtin = cast(getBuiltinValueDecl(ctx, id)); + auto wordType = BuiltinIntegerType::getWordType(ctx)->getCanonicalType(); + auto metatypeTy = SILType::getPrimitiveObjectType(CanMetatypeType::get( + wordType->getCanonicalType(), MetatypeRepresentation::Thin)); + auto metatypeVal = b.createMetatype(loc, metatypeTy); + + auto sizeOfWord = + b.createBuiltin(loc, id, silWordType, + SubstitutionMap::get(builtin->getGenericSignature(), + ArrayRef{wordType}, + LookUpConformanceInModule()), + {metatypeVal}); + auto one = b.createIntegerLiteral(loc, silWordType, 1); + auto three = b.createIntegerLiteral(loc, silWordType, 3); + auto four = b.createIntegerLiteral(loc, silWordType, 4); + auto valueToShiftLit = b.createIntegerLiteral(loc, silWordType, valueToShift); + + // sizeof(Word) - 1 + auto sub = b.createBuiltinBinaryFunction(loc, "sub", silWordType, silWordType, + {sizeOfWord, one}); + // (sizeof(Word) - 1) << 3 + auto innerShift = b.createBuiltinBinaryFunction(loc, "shl", silWordType, + silWordType, {sub, three}); + // ((sizeof(Word) - 1) << 3) + 4 + auto innerShiftOffset = b.createBuiltinBinaryFunction( + loc, "add", silWordType, silWordType, {innerShift, four}); + auto outerShift = + b.createBuiltinBinaryFunction(loc, "shl", silWordType, silWordType, + {valueToShiftLit, innerShiftOffset}); + return outerShift; +} + +/// Construct the TBI mask in a platform independent way that works on all +/// platforms. +/// +/// We compute: +/// +/// mask = (0x3 << (((sizeof(Word) - 1) << 3) + 4)) ^ -1 +static SILValue getTBIClearMask(SILBuilder &b, SILLocation loc) { + auto &ctx = b.getASTContext(); + auto silWordType = SILType::getBuiltinWordType(ctx); + auto negBits = b.createIntegerLiteral(loc, silWordType, -1); + + return b.createBuiltinBinaryFunction(loc, "xor", silWordType, silWordType, + {getTBIBits(b, loc, 3), negBits}); +} + +static SILValue transformTupleElts( + SILBuilder &b, SILLocation loc, SILValue mv, SILType finalType, + llvm::function_ref destructureValues)> func) { + auto &ctx = b.getASTContext(); + auto silWordType = SILType::getBuiltinWordType(ctx); + auto tupleType = + SILType::getTupleType(b.getASTContext(), {silWordType, silWordType}); + auto cast = b.emitUncheckedValueCast(loc, mv, tupleType); + SmallVector destructureValues; + b.emitDestructureOperation(loc, cast, destructureValues); + SILValue reformedValue = func(destructureValues); + auto reformedPointer = + b.emitUncheckedValueCast(loc, reformedValue, finalType); + + // NOTE: Our reformed pointer is actually has none ownership here. Our value + // gains guaranteed ownership by the merging the guaranteedness of mv (the + // mark dependence base). + // + // DISCUSSION: This is important since we allows for us to avoid needing to + // insert end_borrows on the reformed value in our caller which would be + // required if we used an unchecked_ownership_conversion. The author + // originally did that thinking it would be safer but hit problems in + // SILGenApply since even if we inserted an end_borrow for the + // unchecked_ownership_conversion, we failed to insert the end_borrow along + // error paths of try_apply due to the way SILGenApply is setup. After some + // thought, it became clear we could safely just rely on mark_dependence to + // mixin the guaranteedness and get the semantics that we cared about (tieing + // the reformed value to the lifetime of the original value in a guaranteed + // way). + return b.emitMarkDependence(loc, reformedPointer, mv, + MarkDependenceKind::NonEscaping); +} + +SILValue swift::clearImplicitIsolationActorBits(SILBuilder &b, SILLocation loc, + SILValue value, + SILType finalType) { + if (!finalType) + finalType = + SILType::getBuiltinImplicitIsolationActorType(b.getASTContext()); + + auto &ctx = b.getASTContext(); + + return transformTupleElts( + b, loc, value, finalType, [&](ArrayRef tupleElts) { + auto silWordType = SILType::getBuiltinWordType(ctx); + SILValue bitMask = ctx.LangOpts.HasAArch64TBI + ? getTBIClearMask(b, loc) + : b.createIntegerLiteral(loc, silWordType, -4); + + auto result = b.createBuiltinBinaryFunction( + loc, "and", silWordType, silWordType, {tupleElts[1], bitMask}); + return b.createTuple(loc, {tupleElts[0], result}); + }); +} + +SILValue swift::setImplicitIsolationActorBits(SILBuilder &b, SILLocation loc, + SILValue value) { + auto &ctx = b.getASTContext(); + + return transformTupleElts( + b, loc, value, value->getType(), [&](ArrayRef tupleElts) { + auto silWordType = SILType::getBuiltinWordType(ctx); + SILValue bitMask = ctx.LangOpts.HasAArch64TBI + ? getTBIBits(b, loc) + : b.createIntegerLiteral(loc, silWordType, 1); + + auto result = b.createBuiltinBinaryFunction( + loc, "or", silWordType, silWordType, {tupleElts[1], bitMask}); + return b.createTuple(loc, {tupleElts[0], result}); + }); +} diff --git a/lib/SILGen/ConcurrencyUtils.h b/lib/SILGen/ConcurrencyUtils.h new file mode 100644 index 0000000000000..07d4f106a8857 --- /dev/null +++ b/lib/SILGen/ConcurrencyUtils.h @@ -0,0 +1,74 @@ +//===--- ConcurrencyUtils.h -----------------------------------------------===// +// +// This source file is part of the Swift.org open source project +// +// Copyright (c) 2014 - 2025 Apple Inc. and the Swift project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See https://swift.org/LICENSE.txt for license information +// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors +// +//===----------------------------------------------------------------------===// + +#ifndef SWIFT_SILGEN_CONCURRENCYUTILS_H +#define SWIFT_SILGEN_CONCURRENCYUTILS_H + +#include "RValue.h" +#include "SILGenFunction.h" + +#include "swift/SIL/ConcurrencyUtils.h" + +namespace swift { + +class SILLocation; +class Expr; + +namespace Lowering { + +class SILGenFunction; +class RValue; +class ManagedValue; + +inline ManagedValue +clearImplicitIsolationActorBits(SILGenFunction &SGF, SILLocation loc, + ManagedValue implicitIsolatedActor, + SILType type = {}) { + return ManagedValue::forBorrowedRValue(clearImplicitIsolationActorBits( + SGF.B, loc, implicitIsolatedActor.getUnmanagedValue(), type)); +} + +/// Clear the TBI bits if AArch64HasTBI is set. Otherwise clear the low tagged +/// bits. +/// +/// \param expr - the expression which yielded this r-value; its type +/// will become the substituted formal type of this r-value +/// \param implicitIsolatedActor should be an Optional. +inline RValue +clearImplicitIsolationActorBits(SILGenFunction &SGF, Expr *expr, + ManagedValue implicitIsolatedActor, + SILType type = {}) { + return RValue(SGF, expr, + clearImplicitIsolationActorBits(SGF, SILLocation(expr), + implicitIsolatedActor, type)); +} + +inline ManagedValue +setImplicitIsolationActorBits(SILGenFunction &SGF, SILLocation loc, + ManagedValue implicitIsolatedActor) { + return ManagedValue::forBorrowedRValue(setImplicitIsolationActorBits( + SGF.B, loc, implicitIsolatedActor.getUnmanagedValue())); +} + +inline RValue +setImplicitIsolationActorBits(SILGenFunction &SGF, Expr *expr, + ManagedValue implicitIsolatedActor) { + return RValue(SGF, expr, + setImplicitIsolationActorBits(SGF, SILLocation(expr), + implicitIsolatedActor)); +} + +} // namespace Lowering + +} // namespace swift + +#endif diff --git a/lib/SILGen/SILGenApply.cpp b/lib/SILGen/SILGenApply.cpp index 8233054d1327c..afc71e87f7907 100644 --- a/lib/SILGen/SILGenApply.cpp +++ b/lib/SILGen/SILGenApply.cpp @@ -13,6 +13,7 @@ #include "ArgumentScope.h" #include "ArgumentSource.h" #include "Callee.h" +#include "ConcurrencyUtils.h" #include "Conversion.h" #include "ExecutorBreadcrumb.h" #include "FormalEvaluation.h" @@ -5862,8 +5863,12 @@ ApplyOptions CallEmission::emitArgumentsForNormalApply( args.push_back({}); // NOTE: Even though this calls emitActorInstanceIsolation, this also // handles glboal actor isolated cases. - args.back().push_back(SGF.emitActorInstanceIsolation( - callSite->Loc, executor, executor.getType().getASTType())); + auto erasedActor = + SGF.emitActorInstanceIsolation(callSite->Loc, executor, + executor.getType().getASTType()) + .borrow(SGF, callSite->Loc); + args.back().push_back( + SGF.B.convertToImplicitIsolationActor(callSite->Loc, erasedActor)); } uncurriedLoc = callSite->Loc; diff --git a/lib/SILGen/SILGenBridging.cpp b/lib/SILGen/SILGenBridging.cpp index d7cb7c1324009..ca6d472eece24 100644 --- a/lib/SILGen/SILGenBridging.cpp +++ b/lib/SILGen/SILGenBridging.cpp @@ -1667,23 +1667,22 @@ void SILGenFunction::emitNativeToForeignThunk(SILDeclRef thunk) { isolatedParameter && isolatedParameter->hasOption(SILParameterInfo::ImplicitLeading)) { assert(F.isAsync() && "Can only be async"); assert(isolation && "No isolation?!"); - switch (isolation->getKind()) { - case ActorIsolation::Unspecified: - case ActorIsolation::Nonisolated: - case ActorIsolation::NonisolatedUnsafe: - case ActorIsolation::CallerIsolationInheriting: - args.push_back(emitNonIsolatedIsolation(loc).getValue()); - break; - case ActorIsolation::ActorInstance: - llvm::report_fatal_error("Should never see this"); - break; - case ActorIsolation::GlobalActor: - args.push_back(emitLoadGlobalActorExecutor(isolation->getGlobalActor())); - break; - case ActorIsolation::Erased: - llvm::report_fatal_error("Should never see this"); - break; - } + auto value = [&]() -> SILValue { + switch (isolation->getKind()) { + case ActorIsolation::Unspecified: + case ActorIsolation::Nonisolated: + case ActorIsolation::NonisolatedUnsafe: + case ActorIsolation::CallerIsolationInheriting: + return emitNonIsolatedIsolation(loc).getValue(); + case ActorIsolation::ActorInstance: + llvm::report_fatal_error("Should never see this"); + case ActorIsolation::GlobalActor: + return emitLoadGlobalActorExecutor(isolation->getGlobalActor()); + case ActorIsolation::Erased: + llvm::report_fatal_error("Should never see this"); + } + }(); + args.push_back(B.convertToImplicitIsolationActor(loc, value)); } // Bridge the arguments. diff --git a/lib/SILGen/SILGenBuilder.cpp b/lib/SILGen/SILGenBuilder.cpp index fae9e1dfc528e..ae743f22fcce0 100644 --- a/lib/SILGen/SILGenBuilder.cpp +++ b/lib/SILGen/SILGenBuilder.cpp @@ -1244,3 +1244,16 @@ ManagedValue SILGenBuilder::borrowObjectRValue(SILGenFunction &SGF, } return SGF.emitFormalEvaluationManagedBeginBorrow(loc, value); } + +SILValue SILGenBuilder::convertToImplicitIsolationActor(SILLocation loc, + SILValue value) { + auto type = SILType::getBuiltinImplicitIsolationActorType(getASTContext()); + if (value->getType() == type) + return value; + assert(value->getType() == SILType::getOpaqueIsolationType(getASTContext()) && + "Can only convert Optional to " + "Builtin.ImplicitIsolationActor"); + if (value->getOwnershipKind() != OwnershipKind::Guaranteed) + value = SGF.emitManagedBeginBorrow(loc, value).getValue(); + return emitUncheckedValueCast(loc, value, type); +} diff --git a/lib/SILGen/SILGenBuilder.h b/lib/SILGen/SILGenBuilder.h index 2a296a82a33af..c01ea266b32ac 100644 --- a/lib/SILGen/SILGenBuilder.h +++ b/lib/SILGen/SILGenBuilder.h @@ -551,6 +551,18 @@ class SILGenBuilder : public SILBuilder { createTupleAddrConstructor(loc, destAddr, values, isInitOfDest); } + + SILValue convertToImplicitIsolationActor(SILLocation loc, SILValue value); + + ManagedValue convertToImplicitIsolationActor(SILLocation loc, + ManagedValue value) { + auto type = SILType::getBuiltinImplicitIsolationActorType(getASTContext()); + if (value.getType() == type) + return value; + SILValue result = + convertToImplicitIsolationActor(loc, value.borrow(SGF, loc).getValue()); + return ManagedValue::forBorrowedRValue(result); + } }; } // namespace Lowering diff --git a/lib/SILGen/SILGenConcurrency.cpp b/lib/SILGen/SILGenConcurrency.cpp index b6500bd388a9f..66a9a0a9019a6 100644 --- a/lib/SILGen/SILGenConcurrency.cpp +++ b/lib/SILGen/SILGenConcurrency.cpp @@ -27,7 +27,7 @@ using namespace Lowering; static void setExpectedExecutorForGeneric(SILGenFunction &SGF) { auto loc = RegularLocation::getAutoGeneratedLocation(SGF.F.getLocation()); - SGF.ExpectedExecutor.set(SGF.emitGenericExecutor(loc)); + SGF.ExpectedExecutor.set(SGF.emitNonIsolatedIsolation(loc).getValue()); } static void setExpectedExecutorForGlobalActor(SILGenFunction &SGF, @@ -284,8 +284,9 @@ void SILGenFunction::emitConstructorExpectedExecutorProlog() { loc.markAsPrologue(); loc = loc.asAutoGenerated(); - auto initialExecutor = emitGenericExecutor(loc); - B.createHopToExecutor(loc, initialExecutor, /*mandatory*/ false); + auto initialExecutor = emitNonIsolatedIsolation(loc); + B.createHopToExecutor(loc, initialExecutor.getValue(), + /*mandatory*/ false); return; } } @@ -424,6 +425,10 @@ emitNonOptionalActorInstanceIsolation(SILGenFunction &SGF, SILLocation loc, if (actor.getType() == anyActorTy) return actor; + if (actor.getType() == + SILType::getBuiltinImplicitIsolationActorType(SGF.getASTContext())) + return actor; + CanType anyActorType = anyActorTy.getASTType(); // If the actor is a distributed actor, (1) it had better be local @@ -448,6 +453,11 @@ SILGenFunction::emitActorInstanceIsolation(SILLocation loc, ManagedValue actor, return actor; } + // If we started with a Builtin.ImplicitIsolationActor, we're done. + if (actorType == + getASTContext().TheImplicitIsolationActorType->getCanonicalType()) + return actor; + // Otherwise, if we have an optional value, we need to transform the payload. auto actorObjectType = actorType.getOptionalObjectType(); if (actorObjectType) { diff --git a/lib/SILGen/SILGenConstructor.cpp b/lib/SILGen/SILGenConstructor.cpp index 071b1dc46c62e..e350ad1d10d0e 100644 --- a/lib/SILGen/SILGenConstructor.cpp +++ b/lib/SILGen/SILGenConstructor.cpp @@ -953,7 +953,7 @@ void SILGenFunction::emitClassConstructorAllocator(ConstructorDecl *ctor) { if (F.isNonisolatedNonsending()) { auto paramTy = F.mapTypeIntoContext( - SILType::getOpaqueIsolationType(F.getASTContext())); + SILType::getBuiltinImplicitIsolationActorType(F.getASTContext())); auto inContextParamTy = F.getLoweredType(paramTy.getASTType()) .getCategoryType(paramTy.getCategory()); SILArgument *arg = F.begin()->createFunctionArgument(inContextParamTy); diff --git a/lib/SILGen/SILGenExpr.cpp b/lib/SILGen/SILGenExpr.cpp index efb9a575e8866..d786ea2cef70e 100644 --- a/lib/SILGen/SILGenExpr.cpp +++ b/lib/SILGen/SILGenExpr.cpp @@ -13,6 +13,7 @@ #include "ArgumentScope.h" #include "ArgumentSource.h" #include "Callee.h" +#include "ConcurrencyUtils.h" #include "Condition.h" #include "Conversion.h" #include "Initialization.h" @@ -7385,13 +7386,10 @@ RValue RValueEmitter::visitCurrentContextIsolationExpr( auto *isolatedArg = SGF.F.maybeGetIsolatedArgument(); assert(isolatedArg && "Caller Isolation Inheriting without isolated parameter"); - ManagedValue isolatedMV; - if (isolatedArg->getOwnershipKind() == OwnershipKind::Guaranteed) { - isolatedMV = ManagedValue::forBorrowedRValue(isolatedArg); - } else { - isolatedMV = ManagedValue::forUnmanagedOwnedValue(isolatedArg); - } - return RValue(SGF, E, isolatedMV); + auto isolatedMV = ManagedValue::forBorrowedRValue(isolatedArg); + return clearImplicitIsolationActorBits( + SGF, E, isolatedMV, + SILType::getOpaqueIsolationType(SGF.getASTContext())); } } diff --git a/lib/SILGen/SILGenPoly.cpp b/lib/SILGen/SILGenPoly.cpp index 04bdba354370f..ee3d28daf6182 100644 --- a/lib/SILGen/SILGenPoly.cpp +++ b/lib/SILGen/SILGenPoly.cpp @@ -5669,7 +5669,8 @@ static void buildThunkBody(SILGenFunction &SGF, SILLocation loc, assert(forwardedIsolationValue); SGF.B.createHopToExecutor(loc, forwardedIsolationValue, false); - argValues.push_back(forwardedIsolationValue); + argValues.push_back( + SGF.B.convertToImplicitIsolationActor(loc, forwardedIsolationValue)); } // Add the rest of the arguments. @@ -7128,49 +7129,47 @@ SILGenFunction::emitVTableThunk(SILDeclRef base, return *derivedIsolationCache; }; - switch (baseIsolation) { - case ActorIsolation::Unspecified: - case ActorIsolation::Nonisolated: - case ActorIsolation::NonisolatedUnsafe: - args.push_back(emitNonIsolatedIsolation(loc).getValue()); - break; - case ActorIsolation::Erased: - llvm::report_fatal_error("Found erased actor isolation?!"); - break; - case ActorIsolation::GlobalActor: { - auto globalActor = baseIsolation.getGlobalActor()->getCanonicalType(); - args.push_back(emitGlobalActorIsolation(loc, globalActor).getValue()); - break; - } - case ActorIsolation::ActorInstance: - case ActorIsolation::CallerIsolationInheriting: { - auto derivedIsolation = getDerivedIsolation(); - switch (derivedIsolation) { + auto arg = [&]() -> SILValue { + switch (baseIsolation) { case ActorIsolation::Unspecified: case ActorIsolation::Nonisolated: case ActorIsolation::NonisolatedUnsafe: - args.push_back(emitNonIsolatedIsolation(loc).getValue()); - break; + return emitNonIsolatedIsolation(loc).getValue(); case ActorIsolation::Erased: llvm::report_fatal_error("Found erased actor isolation?!"); - break; + return SILValue(); case ActorIsolation::GlobalActor: { - auto globalActor = - derivedIsolation.getGlobalActor()->getCanonicalType(); - args.push_back(emitGlobalActorIsolation(loc, globalActor).getValue()); - break; + auto globalActor = baseIsolation.getGlobalActor()->getCanonicalType(); + return emitGlobalActorIsolation(loc, globalActor).getValue(); } case ActorIsolation::ActorInstance: case ActorIsolation::CallerIsolationInheriting: { - auto isolatedArg = F.maybeGetIsolatedArgument(); - assert(isolatedArg); - args.push_back(isolatedArg); - break; + auto derivedIsolation = getDerivedIsolation(); + switch (derivedIsolation) { + case ActorIsolation::Unspecified: + case ActorIsolation::Nonisolated: + case ActorIsolation::NonisolatedUnsafe: + return emitNonIsolatedIsolation(loc).getValue(); + case ActorIsolation::Erased: + llvm::report_fatal_error("Found erased actor isolation?!"); + return SILValue(); + case ActorIsolation::GlobalActor: { + auto globalActor = + derivedIsolation.getGlobalActor()->getCanonicalType(); + return emitGlobalActorIsolation(loc, globalActor).getValue(); + } + case ActorIsolation::ActorInstance: + case ActorIsolation::CallerIsolationInheriting: { + auto isolatedArg = F.maybeGetIsolatedArgument(); + assert(isolatedArg); + return isolatedArg; + } + } } } - break; - } - } + }(); + + args.push_back(B.convertToImplicitIsolationActor(loc, arg)); // If our derived isolation is caller isolation inheriting and our base // isn't, we need to insert a hop so that derived can assume that it does @@ -7632,49 +7631,47 @@ void SILGenFunction::emitProtocolWitness( } return *witnessIsolationCache; }; - switch (reqtIsolation) { - case ActorIsolation::Unspecified: - case ActorIsolation::Nonisolated: - case ActorIsolation::NonisolatedUnsafe: - args.push_back(emitNonIsolatedIsolation(loc).getValue()); - break; - case ActorIsolation::Erased: - llvm::report_fatal_error("Found erased actor isolation?!"); - break; - case ActorIsolation::GlobalActor: { - auto globalActor = reqtIsolation.getGlobalActor()->getCanonicalType(); - args.push_back(emitGlobalActorIsolation(loc, globalActor).getValue()); - break; - } - case ActorIsolation::ActorInstance: - case ActorIsolation::CallerIsolationInheriting: { - auto witnessIsolation = getWitnessIsolation(); - switch (witnessIsolation) { + auto arg = [&]() -> SILValue { + switch (reqtIsolation) { case ActorIsolation::Unspecified: case ActorIsolation::Nonisolated: case ActorIsolation::NonisolatedUnsafe: - args.push_back(emitNonIsolatedIsolation(loc).getValue()); - break; + return emitNonIsolatedIsolation(loc).getValue(); case ActorIsolation::Erased: llvm::report_fatal_error("Found erased actor isolation?!"); - break; + return SILValue(); case ActorIsolation::GlobalActor: { - auto globalActor = - witnessIsolation.getGlobalActor()->getCanonicalType(); - args.push_back(emitGlobalActorIsolation(loc, globalActor).getValue()); - break; + auto globalActor = reqtIsolation.getGlobalActor()->getCanonicalType(); + return emitGlobalActorIsolation(loc, globalActor).getValue(); } case ActorIsolation::ActorInstance: case ActorIsolation::CallerIsolationInheriting: { - auto isolatedArg = F.maybeGetIsolatedArgument(); - assert(isolatedArg); - args.push_back(isolatedArg); - break; + auto witnessIsolation = getWitnessIsolation(); + switch (witnessIsolation) { + case ActorIsolation::Unspecified: + case ActorIsolation::Nonisolated: + case ActorIsolation::NonisolatedUnsafe: + return emitNonIsolatedIsolation(loc).getValue(); + case ActorIsolation::Erased: + llvm::report_fatal_error("Found erased actor isolation?!"); + return SILValue(); + case ActorIsolation::GlobalActor: { + auto globalActor = + witnessIsolation.getGlobalActor()->getCanonicalType(); + return emitGlobalActorIsolation(loc, globalActor).getValue(); + } + case ActorIsolation::ActorInstance: + case ActorIsolation::CallerIsolationInheriting: { + auto isolatedArg = F.maybeGetIsolatedArgument(); + assert(isolatedArg); + return isolatedArg; + } + } } } - break; - } - } + }(); + + args.push_back(B.convertToImplicitIsolationActor(loc, arg)); // If our reqtIsolation was not caller isolation inheriting, but our witness // isolation is caller isolation inheriting, hop onto the reqtIsolation so diff --git a/lib/SILOptimizer/Mandatory/LowerHopToActor.cpp b/lib/SILOptimizer/Mandatory/LowerHopToActor.cpp index 0941e312795c7..64de164ecf4d0 100644 --- a/lib/SILOptimizer/Mandatory/LowerHopToActor.cpp +++ b/lib/SILOptimizer/Mandatory/LowerHopToActor.cpp @@ -11,15 +11,17 @@ //===----------------------------------------------------------------------===// #define DEBUG_TYPE "insert-hop-to-executor" + #include "swift/AST/ConformanceLookup.h" #include "swift/Basic/Assertions.h" #include "swift/Basic/FrozenMultiMap.h" +#include "swift/SIL/ConcurrencyUtils.h" +#include "swift/SIL/Dominance.h" #include "swift/SIL/SILBuilder.h" #include "swift/SIL/SILFunction.h" -#include "swift/SIL/Dominance.h" #include "swift/SILOptimizer/Analysis/DominanceAnalysis.h" -#include "swift/SILOptimizer/Utils/SILOptFunctionBuilder.h" #include "swift/SILOptimizer/PassManager/Transforms.h" +#include "swift/SILOptimizer/Utils/SILOptFunctionBuilder.h" #include "llvm/ADT/ScopedHashTable.h" using namespace swift; @@ -53,6 +55,7 @@ namespace { class LowerHopToActor { SILFunction *F; DominanceInfo *Dominance; + SILOptFunctionBuilder &FuncBuilder; /// A map from an actor value to the dominating instruction that /// will derive the executor. @@ -72,11 +75,9 @@ class LowerHopToActor { SILValue actor, bool makeOptional); public: - LowerHopToActor(SILFunction *f, - DominanceInfo *dominance) - : F(f), - Dominance(dominance) - { } + LowerHopToActor(SILFunction *f, DominanceInfo *dominance, + SILOptFunctionBuilder &funcBuilder) + : F(f), Dominance(dominance), FuncBuilder(funcBuilder) {} /// The entry point to the transformation. bool run(); @@ -194,6 +195,179 @@ static AccessorDecl *getUnownedExecutorGetter(ASTContext &ctx, return nullptr; } +/// Emit the instructions to derive an executor value from an actor value. +static SILValue getExecutorForActor(SILBuilder &B, SILLocation loc, + SILValue actor) { + auto *F = actor->getFunction(); + auto &ctx = F->getASTContext(); + auto executorType = SILType::getPrimitiveObjectType(ctx.TheExecutorType); + + // If the actor type is a default actor, go ahead and devirtualize here. + auto module = F->getModule().getSwiftModule(); + CanType actorType = actor->getType().getASTType(); + + // Determine if the actor is a "default actor" in which case we'll build a + // default actor executor ref inline, rather than calling out to the + // user-provided executor function. + if (isDefaultActorType(actorType, module, F->getResilienceExpansion())) { + auto builtinName = ctx.getIdentifier( + getBuiltinName(BuiltinValueKind::BuildDefaultActorExecutorRef)); + auto builtinDecl = cast(getBuiltinValueDecl(ctx, builtinName)); + auto subs = SubstitutionMap::get(builtinDecl->getGenericSignature(), + {actorType}, LookUpConformanceInModule()); + return B.createBuiltin(loc, builtinName, executorType, subs, {actor}); + } + + // Otherwise, go through (Distributed)Actor.unownedExecutor. + auto actorKind = actorType->isDistributedActor() + ? KnownProtocolKind::DistributedActor + : KnownProtocolKind::Actor; + auto actorProtocol = ctx.getProtocol(actorKind); + auto req = getUnownedExecutorGetter(ctx, actorProtocol); + assert(req && "Concurrency library broken"); + SILDeclRef fn(req, SILDeclRef::Kind::Func); + + // Open an existential actor type. + if (actorType->isExistentialType()) { + actorType = ExistentialArchetypeType::get(actorType)->getCanonicalType(); + SILType loweredActorType = F->getLoweredType(actorType); + actor = B.createOpenExistentialRef(loc, actor, loweredActorType); + } + + auto actorConf = lookupConformance(actorType, actorProtocol); + assert(actorConf && "hop_to_executor with actor that doesn't conform to " + "Actor or DistributedActor"); + + auto subs = SubstitutionMap::get(req->getGenericSignature(), {actorType}, + {actorConf}); + auto fnType = F->getModule().Types.getConstantFunctionType(*F, fn); + + auto witness = B.createWitnessMethod(loc, actorType, actorConf, fn, + SILType::getPrimitiveObjectType(fnType)); + auto witnessCall = B.createApply(loc, witness, subs, {actor}); + + // The protocol requirement returns an UnownedSerialExecutor; extract + // the Builtin.Executor from it. + auto executorDecl = ctx.getUnownedSerialExecutorDecl(); + auto executorProps = executorDecl->getStoredProperties(); + assert(executorProps.size() == 1); + return B.createStructExtract(loc, witnessCall, executorProps[0]); +} + +static SILValue getExecutorForOptionalActor(SILBuilder &B, SILLocation loc, + SILValue actor) { + auto &ctx = B.getASTContext(); + auto executorType = SILType::getPrimitiveObjectType(ctx.TheExecutorType); + auto optionalExecutorType = SILType::getOptionalType(executorType); + + // Unwrap the optional and call 'unownedExecutor'. + auto *someDecl = ctx.getOptionalSomeDecl(); + auto *curBB = B.getInsertionBB(); + auto *contBB = B.getInsertionPoint() == curBB->end() + ? B.getFunction().createBasicBlockAfter(curBB) + : curBB->split(B.getInsertionPoint()); + auto *someBB = B.getFunction().createBasicBlockAfter(curBB); + auto *noneBB = B.getFunction().createBasicBlockAfter(someBB); + + // unmarked executor + SILValue result = contBB->createPhiArgument(optionalExecutorType, + actor->getOwnershipKind()); + + SmallVector, 1> caseBBs; + caseBBs.push_back(std::make_pair(someDecl, someBB)); + B.setInsertionPoint(curBB); + auto *switchEnum = B.createSwitchEnum(loc, actor, noneBB, caseBBs); + + SILValue unwrappedActor; + if (B.hasOwnership()) { + unwrappedActor = switchEnum->createOptionalSomeResult(); + B.setInsertionPoint(someBB); + } else { + B.setInsertionPoint(someBB); + unwrappedActor = B.createUncheckedEnumData(loc, actor, someDecl); + } + + // Call 'unownedExecutor' in the some block and wrap the result into + // an optional. + SILValue unwrappedExecutor = getExecutorForActor(B, loc, unwrappedActor); + SILValue someValue = + B.createOptionalSome(loc, unwrappedExecutor, optionalExecutorType); + B.createBranch(loc, contBB, {someValue}); + + // In the none case, create a nil executor value, which represents + // the generic executor. + B.setInsertionPoint(noneBB); + SILValue noneValue = B.createOptionalNone(loc, optionalExecutorType); + B.createBranch(loc, contBB, {noneValue}); + if (contBB->begin() == contBB->end()) { + B.setInsertionPoint(contBB); + } else { + B.setInsertionPoint(contBB->begin()); + } + return result; +} + +static SILValue +getExecutorForImplicitIsolationActor(SILOptFunctionBuilder &funcBuilder, + SILBuilderWithScope &parentBuilder, + SILLocation loc, SILValue actor) { + auto &ctx = parentBuilder.getASTContext(); + + // First create our parameter infos. Our params are @guaranteed @isolated + // @leading Builtin.ImplicitIsolationActor. + auto implicitIsolatedActorType = + SILType::getBuiltinImplicitIsolationActorType(ctx); + SmallVector parameterInfo; + parameterInfo.push_back(SILParameterInfo( + implicitIsolatedActorType.getASTType(), + ParameterConvention::Direct_Guaranteed, + {SILParameterInfo::ImplicitLeading, SILParameterInfo::Isolated})); + + // Then create our result types. Our result is Optional. + auto executorType = SILType::getPrimitiveObjectType(ctx.TheExecutorType); + auto optionalExecutorType = SILType::getOptionalType(executorType); + SmallVector resultInfo; + resultInfo.push_back(SILResultInfo(optionalExecutorType.getASTType(), + ResultConvention::Unowned)); + + // Then use that to create our function type and SILFunction. We purposely use + // a shared function so we can take advantage of linkonce_odr. + auto autoGenLoc = RegularLocation::getAutoGeneratedLocation(); + CanSILFunctionType funcType = SILFunctionType::get( + nullptr, SILFunctionType::ExtInfo::getThin(), SILCoroutineKind::None, + ParameterConvention::Direct_Unowned, parameterInfo, {}, resultInfo, {}, + {}, {}, ctx); + auto *newFunc = funcBuilder.getOrCreateSharedFunction( + autoGenLoc, "_swift_implicitisolationactor_to_executor_cast", funcType, + IsNotBare, IsNotTransparent, IsNotSerialized, ProfileCounter(), + IsNotThunk, IsNotDynamic, IsNotDistributed, IsNotRuntimeAccessible); + + // If our function does not yet have a body... create that body. + // + // Our body is just a concatenation of clearing the implicit isolated actor + // bits + cast to Optional + getExecutorForOptionalActor. + if (newFunc->empty()) { + // First turn off ownership. + newFunc->setOwnershipEliminated(); + // Turn off inlining. This is a helper function to reduce code-size. We are + // too late for SIL to inline... but we want to also prevent LLVM from + // inlining as well. + newFunc->setInlineStrategy(Inline_t::NoInline); + + auto *front = newFunc->createBasicBlock(); + SILBuilder builder(front); + auto *fArg = front->createFunctionArgument(implicitIsolatedActorType); + auto value = clearImplicitIsolationActorBits( + builder, autoGenLoc, fArg, SILType::getOpaqueIsolationType(ctx)); + value = getExecutorForOptionalActor(builder, autoGenLoc, value); + builder.createReturn(autoGenLoc, value); + } + + // Then create the apply that calls our helper. + auto *funcRef = parentBuilder.createFunctionRef(loc, newFunc); + return parentBuilder.createApply(loc, funcRef, SubstitutionMap(), {actor}); +} + SILValue LowerHopToActor::emitGetExecutor(SILBuilderWithScope &B, SILLocation loc, SILValue actor, bool makeOptional) { @@ -204,125 +378,34 @@ SILValue LowerHopToActor::emitGetExecutor(SILBuilderWithScope &B, // If the operand is already a BuiltinExecutorType, just wrap it // in an optional. if (makeOptional && actor->getType().is()) { - return B.createOptionalSome( - loc, actor, - SILType::getOptionalType(actor->getType())); + return B.createOptionalSome(loc, actor, + SILType::getOptionalType(actor->getType())); } - auto &ctx = F->getASTContext(); - auto executorType = SILType::getPrimitiveObjectType(ctx.TheExecutorType); - auto optionalExecutorType = SILType::getOptionalType(executorType); - - /// Emit the instructions to derive an executor value from an actor value. - auto getExecutorFor = [&](SILValue actor) -> SILValue { - // If the actor type is a default actor, go ahead and devirtualize here. - auto module = F->getModule().getSwiftModule(); - CanType actorType = actor->getType().getASTType(); - - // Determine if the actor is a "default actor" in which case we'll build a default - // actor executor ref inline, rather than calling out to the user-provided executor function. - if (isDefaultActorType(actorType, module, F->getResilienceExpansion())) { - auto builtinName = ctx.getIdentifier( - getBuiltinName(BuiltinValueKind::BuildDefaultActorExecutorRef)); - auto builtinDecl = cast(getBuiltinValueDecl(ctx, builtinName)); - auto subs = SubstitutionMap::get(builtinDecl->getGenericSignature(), - {actorType}, - LookUpConformanceInModule()); - return B.createBuiltin(loc, builtinName, executorType, subs, {actor}); - } - - // Otherwise, go through (Distributed)Actor.unownedExecutor. - auto actorKind = actorType->isDistributedActor() ? - KnownProtocolKind::DistributedActor : - KnownProtocolKind::Actor; - auto actorProtocol = ctx.getProtocol(actorKind); - auto req = getUnownedExecutorGetter(ctx, actorProtocol); - assert(req && "Concurrency library broken"); - SILDeclRef fn(req, SILDeclRef::Kind::Func); - - // Open an existential actor type. - if (actorType->isExistentialType()) { - actorType = ExistentialArchetypeType::get(actorType)->getCanonicalType(); - SILType loweredActorType = F->getLoweredType(actorType); - actor = B.createOpenExistentialRef(loc, actor, loweredActorType); - } - - auto actorConf = lookupConformance(actorType, actorProtocol); - assert(actorConf && - "hop_to_executor with actor that doesn't conform to Actor or DistributedActor"); - - auto subs = SubstitutionMap::get(req->getGenericSignature(), - {actorType}, {actorConf}); - auto fnType = F->getModule().Types.getConstantFunctionType(*F, fn); - - auto witness = - B.createWitnessMethod(loc, actorType, actorConf, fn, - SILType::getPrimitiveObjectType(fnType)); - auto witnessCall = B.createApply(loc, witness, subs, {actor}); - - // The protocol requirement returns an UnownedSerialExecutor; extract - // the Builtin.Executor from it. - auto executorDecl = ctx.getUnownedSerialExecutorDecl(); - auto executorProps = executorDecl->getStoredProperties(); - assert(executorProps.size() == 1); - return B.createStructExtract(loc, witnessCall, executorProps[0]); - }; - bool needEndBorrow = false; SILValue unmarkedExecutor; - if (auto wrappedActor = actorType->getOptionalObjectType()) { + if (actorType == F->getASTContext().TheImplicitIsolationActorType) { + unmarkedExecutor = + getExecutorForImplicitIsolationActor(FuncBuilder, B, loc, actor); + } else if (auto wrappedActor = actorType->getOptionalObjectType()) { assert(makeOptional); - - if (B.hasOwnership() && actor->getOwnershipKind() != OwnershipKind::Guaranteed) { + if (B.hasOwnership() && + actor->getOwnershipKind() != OwnershipKind::Guaranteed) { actor = B.createBeginBorrow(loc, actor); needEndBorrow = true; } - // Unwrap the optional and call 'unownedExecutor'. - auto *someDecl = B.getASTContext().getOptionalSomeDecl(); - auto *curBB = B.getInsertionPoint()->getParent(); - auto *contBB = curBB->split(B.getInsertionPoint()); - auto *someBB = B.getFunction().createBasicBlockAfter(curBB); - auto *noneBB = B.getFunction().createBasicBlockAfter(someBB); - - unmarkedExecutor = contBB->createPhiArgument( - optionalExecutorType, actor->getOwnershipKind()); - - SmallVector, 1> caseBBs; - caseBBs.push_back(std::make_pair(someDecl, someBB)); - B.setInsertionPoint(curBB); - auto *switchEnum = B.createSwitchEnum(loc, actor, noneBB, caseBBs); - - SILValue unwrappedActor; - if (B.hasOwnership()) { - unwrappedActor = switchEnum->createOptionalSomeResult(); - B.setInsertionPoint(someBB); - } else { - B.setInsertionPoint(someBB); - unwrappedActor = B.createUncheckedEnumData(loc, actor, someDecl); - } - - // Call 'unownedExecutor' in the some block and wrap the result into - // an optional. - SILValue unwrappedExecutor = getExecutorFor(unwrappedActor); - SILValue someValue = - B.createOptionalSome(loc, unwrappedExecutor, optionalExecutorType); - B.createBranch(loc, contBB, {someValue}); - - // In the none case, create a nil executor value, which represents - // the generic executor. - B.setInsertionPoint(noneBB); - SILValue noneValue = B.createOptionalNone(loc, optionalExecutorType); - B.createBranch(loc, contBB, {noneValue}); - B.setInsertionPoint(contBB->begin()); + unmarkedExecutor = getExecutorForOptionalActor(B, loc, actor); } else { - unmarkedExecutor = getExecutorFor(actor); + unmarkedExecutor = getExecutorForActor(B, loc, actor); + } - // Inject the result into an optional if requested. - if (makeOptional) { - unmarkedExecutor = B.createOptionalSome(loc, unmarkedExecutor, - SILType::getOptionalType(unmarkedExecutor->getType())); - } + // Inject the result into an optional if requested and if our executor is not + // yet optional. + if (makeOptional && !unmarkedExecutor->getType().getOptionalObjectType()) { + unmarkedExecutor = B.createOptionalSome( + loc, unmarkedExecutor, + SILType::getOptionalType(unmarkedExecutor->getType())); } // Mark the dependence of the resulting value on the actor value to @@ -342,7 +425,8 @@ class LowerHopToActorPass : public SILFunctionTransform { void run() override { auto fn = getFunction(); auto domTree = getAnalysis()->get(fn); - LowerHopToActor pass(getFunction(), domTree); + SILOptFunctionBuilder funcBuilder(*this); + LowerHopToActor pass(getFunction(), domTree, funcBuilder); if (pass.run()) invalidateAnalysis(SILAnalysis::InvalidationKind::BranchesAndInstructions); } diff --git a/test/Concurrency/Runtime/actor_counters.swift b/test/Concurrency/Runtime/actor_counters.swift index 5749f6012db42..26c19a1143839 100644 --- a/test/Concurrency/Runtime/actor_counters.swift +++ b/test/Concurrency/Runtime/actor_counters.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -Xfrontend -sil-verify-all -target %target-swift-5.1-abi-triple %import-libdispatch -parse-as-library) +// RUN: %target-run-simple-swift( -Xfrontend -sil-verify-all -target %target-swift-5.1-abi-triple %import-libdispatch -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/actor_counters_freestanding.swift b/test/Concurrency/Runtime/actor_counters_freestanding.swift index 827e94356115c..afe2a5359c870 100644 --- a/test/Concurrency/Runtime/actor_counters_freestanding.swift +++ b/test/Concurrency/Runtime/actor_counters_freestanding.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -Xfrontend -sil-verify-all -target %target-swift-5.1-abi-triple %import-libdispatch -parse-as-library) +// RUN: %target-run-simple-swift( -Xfrontend -sil-verify-all -target %target-swift-5.1-abi-triple %import-libdispatch -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/actor_deinit_escaping_self.swift b/test/Concurrency/Runtime/actor_deinit_escaping_self.swift index dd3e23d0aef39..13879a163b1a2 100644 --- a/test/Concurrency/Runtime/actor_deinit_escaping_self.swift +++ b/test/Concurrency/Runtime/actor_deinit_escaping_self.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -target %target-future-triple %import-libdispatch -parse-as-library) +// RUN: %target-run-simple-swift( -target %target-future-triple %import-libdispatch -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: libdispatch diff --git a/test/Concurrency/Runtime/actor_detach.swift b/test/Concurrency/Runtime/actor_detach.swift index b7b178a28bd38..22b65d6e33b7d 100644 --- a/test/Concurrency/Runtime/actor_detach.swift +++ b/test/Concurrency/Runtime/actor_detach.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple) | %FileCheck %s +// RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/actor_dynamic_subclass.swift b/test/Concurrency/Runtime/actor_dynamic_subclass.swift index 83a73fce14bfe..c02ba70cea761 100644 --- a/test/Concurrency/Runtime/actor_dynamic_subclass.swift +++ b/test/Concurrency/Runtime/actor_dynamic_subclass.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift(-target %target-swift-5.1-abi-triple -parse-as-library) +// RUN: %target-run-simple-swift(-target %target-swift-5.1-abi-triple -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/actor_init.swift b/test/Concurrency/Runtime/actor_init.swift index c40acc77dec4b..f1b5ce6134da5 100644 --- a/test/Concurrency/Runtime/actor_init.swift +++ b/test/Concurrency/Runtime/actor_init.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift(%import-libdispatch -target %target-swift-5.1-abi-triple -parse-as-library) | %FileCheck %s +// RUN: %target-run-simple-swift(%import-libdispatch -target %target-swift-5.1-abi-triple -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/actor_keypaths.swift b/test/Concurrency/Runtime/actor_keypaths.swift index dcf601158760c..be64cfa2513e1 100644 --- a/test/Concurrency/Runtime/actor_keypaths.swift +++ b/test/Concurrency/Runtime/actor_keypaths.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple) +// RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/actor_recursive_deinit.swift b/test/Concurrency/Runtime/actor_recursive_deinit.swift index 2a05c23a23894..bedad75ba3501 100644 --- a/test/Concurrency/Runtime/actor_recursive_deinit.swift +++ b/test/Concurrency/Runtime/actor_recursive_deinit.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift(-target %target-future-triple -parse-stdlib -parse-as-library) | %FileCheck %s +// RUN: %target-run-simple-swift(-target %target-future-triple -parse-stdlib -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async.swift b/test/Concurrency/Runtime/async.swift index 9360f32c392d1..741fc3419b5de 100644 --- a/test/Concurrency/Runtime/async.swift +++ b/test/Concurrency/Runtime/async.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple %import-libdispatch) +// RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple %import-libdispatch -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_initializer.swift b/test/Concurrency/Runtime/async_initializer.swift index 1e2596d169ac2..feb0c8b937a7b 100644 --- a/test/Concurrency/Runtime/async_initializer.swift +++ b/test/Concurrency/Runtime/async_initializer.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift(-parse-as-library -target %target-swift-5.1-abi-triple) | %FileCheck %s +// RUN: %target-run-simple-swift(-parse-as-library -target %target-swift-5.1-abi-triple -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_let_fibonacci.swift b/test/Concurrency/Runtime/async_let_fibonacci.swift index 10d6075ae1ad4..8e02cfd96aecd 100644 --- a/test/Concurrency/Runtime/async_let_fibonacci.swift +++ b/test/Concurrency/Runtime/async_let_fibonacci.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple -parse-as-library) +// RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_let_throw_completion_order.swift b/test/Concurrency/Runtime/async_let_throw_completion_order.swift index 504d3f69506e4..ff87dc71330b3 100644 --- a/test/Concurrency/Runtime/async_let_throw_completion_order.swift +++ b/test/Concurrency/Runtime/async_let_throw_completion_order.swift @@ -1,5 +1,7 @@ // rdar://81481317 // RUN: %target-run-simple-swift(-target %target-swift-5.1-abi-triple -parse-as-library) | %FileCheck %s +// RUN: %target-run-simple-swift(-target %target-swift-5.1-abi-triple -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_let_throws.swift b/test/Concurrency/Runtime/async_let_throws.swift index 21fb512b2f382..bd3089dcf271e 100644 --- a/test/Concurrency/Runtime/async_let_throws.swift +++ b/test/Concurrency/Runtime/async_let_throws.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple -parse-as-library) | %FileCheck %s +// RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_parameter_pack.swift b/test/Concurrency/Runtime/async_parameter_pack.swift index bc6a82776178a..c024ef850e617 100644 --- a/test/Concurrency/Runtime/async_parameter_pack.swift +++ b/test/Concurrency/Runtime/async_parameter_pack.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -target %target-swift-5.9-abi-triple) +// RUN: %target-run-simple-swift( -target %target-swift-5.9-abi-triple -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_properties_actor.swift b/test/Concurrency/Runtime/async_properties_actor.swift index 8e0419a81e0f9..ebb2f4809b839 100644 --- a/test/Concurrency/Runtime/async_properties_actor.swift +++ b/test/Concurrency/Runtime/async_properties_actor.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift(-parse-as-library -Xfrontend -enable-copy-propagation -Xfrontend -enable-lexical-lifetimes=false -target %target-swift-5.1-abi-triple) | %FileCheck %s +// RUN: %target-run-simple-swift(-parse-as-library -Xfrontend -enable-copy-propagation -Xfrontend -enable-lexical-lifetimes=false -target %target-swift-5.1-abi-triple -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_sequence.swift b/test/Concurrency/Runtime/async_sequence.swift index f358cb32956b8..b48898b6cb9fa 100644 --- a/test/Concurrency/Runtime/async_sequence.swift +++ b/test/Concurrency/Runtime/async_sequence.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple -parse-as-library) +// RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_stream.swift b/test/Concurrency/Runtime/async_stream.swift index 553d4d736bbd8..59976a67f19ad 100644 --- a/test/Concurrency/Runtime/async_stream.swift +++ b/test/Concurrency/Runtime/async_stream.swift @@ -1,5 +1,7 @@ // RUN: %target-typecheck-verify-swift -strict-concurrency=complete -disable-availability-checking -parse-as-library // RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking -parse-as-library) +// RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: concurrency // REQUIRES: executable_test diff --git a/test/Concurrency/Runtime/async_task_async_let_child_cancel.swift b/test/Concurrency/Runtime/async_task_async_let_child_cancel.swift index 9afa4aa262507..a2362c7c5736f 100644 --- a/test/Concurrency/Runtime/async_task_async_let_child_cancel.swift +++ b/test/Concurrency/Runtime/async_task_async_let_child_cancel.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift(-target %target-swift-5.1-abi-triple -parse-as-library) | %FileCheck %s --dump-input=always +// RUN: %target-run-simple-swift(-target %target-swift-5.1-abi-triple -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s --dump-input=always +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_task_cancellation_early.swift b/test/Concurrency/Runtime/async_task_cancellation_early.swift index 88c626c962d7a..60d6ff6b68d74 100644 --- a/test/Concurrency/Runtime/async_task_cancellation_early.swift +++ b/test/Concurrency/Runtime/async_task_cancellation_early.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking %import-libdispatch -parse-as-library) | %FileCheck %s --dump-input=always +// RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking %import-libdispatch -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s --dump-input=always +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_task_cancellation_taskGroup.swift b/test/Concurrency/Runtime/async_task_cancellation_taskGroup.swift index f78437db7884c..2eaeaced17994 100644 --- a/test/Concurrency/Runtime/async_task_cancellation_taskGroup.swift +++ b/test/Concurrency/Runtime/async_task_cancellation_taskGroup.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple %import-libdispatch -parse-as-library) | %FileCheck %s --dump-input=always +// RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple %import-libdispatch -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s --dump-input=always +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_task_cancellation_while_running.swift b/test/Concurrency/Runtime/async_task_cancellation_while_running.swift index fd9da7e007dcd..c768fa3f7a51a 100644 --- a/test/Concurrency/Runtime/async_task_cancellation_while_running.swift +++ b/test/Concurrency/Runtime/async_task_cancellation_while_running.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple %import-libdispatch -parse-as-library) | %FileCheck %s +// RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple %import-libdispatch -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_task_detach.swift b/test/Concurrency/Runtime/async_task_detach.swift index 60262638a9824..0a951eab59fc4 100644 --- a/test/Concurrency/Runtime/async_task_detach.swift +++ b/test/Concurrency/Runtime/async_task_detach.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple -parse-as-library) | %FileCheck %s +// RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_task_executor_default_actor_funcs.swift b/test/Concurrency/Runtime/async_task_executor_default_actor_funcs.swift index cb75f8ecb105b..73eb1d0644fd3 100644 --- a/test/Concurrency/Runtime/async_task_executor_default_actor_funcs.swift +++ b/test/Concurrency/Runtime/async_task_executor_default_actor_funcs.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking %import-libdispatch -parse-as-library ) +// RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking %import-libdispatch -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_task_executor_nonisolated_async_func.swift b/test/Concurrency/Runtime/async_task_executor_nonisolated_async_func.swift index a5a0da5954030..e652914b4d3c9 100644 --- a/test/Concurrency/Runtime/async_task_executor_nonisolated_async_func.swift +++ b/test/Concurrency/Runtime/async_task_executor_nonisolated_async_func.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking %import-libdispatch -parse-as-library ) +// RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking %import-libdispatch -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_task_executor_nsobject.swift b/test/Concurrency/Runtime/async_task_executor_nsobject.swift index d652f7d246f01..61a825e5f3e1b 100644 --- a/test/Concurrency/Runtime/async_task_executor_nsobject.swift +++ b/test/Concurrency/Runtime/async_task_executor_nsobject.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking %import-libdispatch -parse-as-library ) +// RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking %import-libdispatch -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_task_executor_structured_concurrency.swift b/test/Concurrency/Runtime/async_task_executor_structured_concurrency.swift index 3d2805bf8274b..4a7967d189b3d 100644 --- a/test/Concurrency/Runtime/async_task_executor_structured_concurrency.swift +++ b/test/Concurrency/Runtime/async_task_executor_structured_concurrency.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking %import-libdispatch -parse-as-library ) +// RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking %import-libdispatch -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_task_executor_unstructured_task_ownership.swift b/test/Concurrency/Runtime/async_task_executor_unstructured_task_ownership.swift index ae76d31dc55ee..85e939d8bf068 100644 --- a/test/Concurrency/Runtime/async_task_executor_unstructured_task_ownership.swift +++ b/test/Concurrency/Runtime/async_task_executor_unstructured_task_ownership.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking %import-libdispatch -parse-as-library ) | %FileCheck %s +// RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking %import-libdispatch -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_task_executor_withExecutor.swift b/test/Concurrency/Runtime/async_task_executor_withExecutor.swift index f714c2a9e2300..51bbc08ea1b8d 100644 --- a/test/Concurrency/Runtime/async_task_executor_withExecutor.swift +++ b/test/Concurrency/Runtime/async_task_executor_withExecutor.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking %import-libdispatch -parse-as-library ) +// RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking %import-libdispatch -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_task_handle_cancellation.swift b/test/Concurrency/Runtime/async_task_handle_cancellation.swift index 822abd6c3278f..7ff6e6b3d1e73 100644 --- a/test/Concurrency/Runtime/async_task_handle_cancellation.swift +++ b/test/Concurrency/Runtime/async_task_handle_cancellation.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple %import-libdispatch -parse-as-library) | %FileCheck %s --dump-input=always +// RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple %import-libdispatch -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s --dump-input=always +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_task_locals_async_let.swift b/test/Concurrency/Runtime/async_task_locals_async_let.swift index aa6b980d0e7e5..9089f85037bec 100644 --- a/test/Concurrency/Runtime/async_task_locals_async_let.swift +++ b/test/Concurrency/Runtime/async_task_locals_async_let.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -plugin-path %swift-plugin-dir -target %target-swift-5.1-abi-triple -parse-as-library) | %FileCheck %s +// RUN: %target-run-simple-swift( -plugin-path %swift-plugin-dir -target %target-swift-5.1-abi-triple -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_task_locals_basic.swift b/test/Concurrency/Runtime/async_task_locals_basic.swift index b8cde99791d34..58af953c3868a 100644 --- a/test/Concurrency/Runtime/async_task_locals_basic.swift +++ b/test/Concurrency/Runtime/async_task_locals_basic.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -plugin-path %swift-plugin-dir -parse-as-library %import-libdispatch) | %FileCheck %s +// RUN: %target-run-simple-swift( -plugin-path %swift-plugin-dir -parse-as-library %import-libdispatch -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_task_locals_copy_to_async.swift b/test/Concurrency/Runtime/async_task_locals_copy_to_async.swift index bb9aaae6b8538..fb97b9ab1abcd 100644 --- a/test/Concurrency/Runtime/async_task_locals_copy_to_async.swift +++ b/test/Concurrency/Runtime/async_task_locals_copy_to_async.swift @@ -1,5 +1,7 @@ // REQUIRES: rdar80824152 // RUN: %target-run-simple-swift( -plugin-path %swift-plugin-dir -target %target-swift-5.1-abi-triple -parse-as-library %import-libdispatch) | %FileCheck %s +// RUN: %target-run-simple-swift( -plugin-path %swift-plugin-dir -target %target-swift-5.1-abi-triple -parse-as-library %import-libdispatch -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_task_locals_copy_to_sync.swift b/test/Concurrency/Runtime/async_task_locals_copy_to_sync.swift index 9ebaf08c40916..301f07c49f265 100644 --- a/test/Concurrency/Runtime/async_task_locals_copy_to_sync.swift +++ b/test/Concurrency/Runtime/async_task_locals_copy_to_sync.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -plugin-path %swift-plugin-dir -target %target-swift-5.1-abi-triple -parse-as-library %import-libdispatch) | %FileCheck %s +// RUN: %target-run-simple-swift( -plugin-path %swift-plugin-dir -target %target-swift-5.1-abi-triple -parse-as-library %import-libdispatch -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_task_locals_groups.swift b/test/Concurrency/Runtime/async_task_locals_groups.swift index 02ee42b2f855e..d4ff7ae92950e 100644 --- a/test/Concurrency/Runtime/async_task_locals_groups.swift +++ b/test/Concurrency/Runtime/async_task_locals_groups.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -plugin-path %swift-plugin-dir -target %target-swift-5.1-abi-triple -parse-as-library %import-libdispatch) | %FileCheck %s +// RUN: %target-run-simple-swift( -plugin-path %swift-plugin-dir -target %target-swift-5.1-abi-triple -parse-as-library %import-libdispatch -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_task_locals_in_task_group_may_need_to_copy.swift b/test/Concurrency/Runtime/async_task_locals_in_task_group_may_need_to_copy.swift index 896c7bc7f2ac8..4e4c752ea0a88 100644 --- a/test/Concurrency/Runtime/async_task_locals_in_task_group_may_need_to_copy.swift +++ b/test/Concurrency/Runtime/async_task_locals_in_task_group_may_need_to_copy.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -plugin-path %swift-plugin-dir -Xfrontend -strict-concurrency=complete -target %target-swift-5.1-abi-triple -parse-as-library %import-libdispatch) | %FileCheck %s --dump-input=always +// RUN: %target-run-simple-swift( -plugin-path %swift-plugin-dir -Xfrontend -strict-concurrency=complete -target %target-swift-5.1-abi-triple -parse-as-library %import-libdispatch -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s --dump-input=always +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_task_locals_prevent_illegal_use_but_specific_case_is_ok.swift b/test/Concurrency/Runtime/async_task_locals_prevent_illegal_use_but_specific_case_is_ok.swift index 1944c168542f0..04b83fd1d225a 100644 --- a/test/Concurrency/Runtime/async_task_locals_prevent_illegal_use_but_specific_case_is_ok.swift +++ b/test/Concurrency/Runtime/async_task_locals_prevent_illegal_use_but_specific_case_is_ok.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -plugin-path %swift-plugin-dir -target %target-swift-5.1-abi-triple -parse-as-library %import-libdispatch) | %FileCheck %s --dump-input=always +// RUN: %target-run-simple-swift( -plugin-path %swift-plugin-dir -target %target-swift-5.1-abi-triple -parse-as-library %import-libdispatch -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s --dump-input=always +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_task_locals_synchronous_bind.swift b/test/Concurrency/Runtime/async_task_locals_synchronous_bind.swift index b5f181c49ae95..1ea38a65b000b 100644 --- a/test/Concurrency/Runtime/async_task_locals_synchronous_bind.swift +++ b/test/Concurrency/Runtime/async_task_locals_synchronous_bind.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -plugin-path %swift-plugin-dir -target %target-swift-5.1-abi-triple -parse-as-library) | %FileCheck %s +// RUN: %target-run-simple-swift( -plugin-path %swift-plugin-dir -target %target-swift-5.1-abi-triple -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_task_locals_wrapper.swift b/test/Concurrency/Runtime/async_task_locals_wrapper.swift index 7d70843920795..d407efca6d18e 100644 --- a/test/Concurrency/Runtime/async_task_locals_wrapper.swift +++ b/test/Concurrency/Runtime/async_task_locals_wrapper.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -plugin-path %swift-plugin-dir -target %target-swift-5.1-abi-triple -parse-as-library) | %FileCheck %s +// RUN: %target-run-simple-swift( -plugin-path %swift-plugin-dir -target %target-swift-5.1-abi-triple -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_task_naming.swift b/test/Concurrency/Runtime/async_task_naming.swift index 7b597a1271dd6..5dd33fdb919a5 100644 --- a/test/Concurrency/Runtime/async_task_naming.swift +++ b/test/Concurrency/Runtime/async_task_naming.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking) | %FileCheck %s +// RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_task_priority_current.swift b/test/Concurrency/Runtime/async_task_priority_current.swift index 58b0f6fc40967..cae419fcf5753 100644 --- a/test/Concurrency/Runtime/async_task_priority_current.swift +++ b/test/Concurrency/Runtime/async_task_priority_current.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple %import-libdispatch -parse-as-library) | %FileCheck --dump-input=always %s +// RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple %import-libdispatch -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck --dump-input=always %s +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_task_sleep.swift b/test/Concurrency/Runtime/async_task_sleep.swift index a08429c4502f0..926fae5aa0626 100644 --- a/test/Concurrency/Runtime/async_task_sleep.swift +++ b/test/Concurrency/Runtime/async_task_sleep.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple %import-libdispatch -parse-as-library) | %FileCheck %s --dump-input always +// RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple %import-libdispatch -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s --dump-input always +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency // REQUIRES: libdispatch diff --git a/test/Concurrency/Runtime/async_task_sleep_cancel.swift b/test/Concurrency/Runtime/async_task_sleep_cancel.swift index 245f960f792f1..03429ad31caec 100644 --- a/test/Concurrency/Runtime/async_task_sleep_cancel.swift +++ b/test/Concurrency/Runtime/async_task_sleep_cancel.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple %import-libdispatch -parse-as-library) | %FileCheck %s --dump-input always +// RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple %import-libdispatch -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s --dump-input always +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency // REQUIRES: libdispatch diff --git a/test/Concurrency/Runtime/async_task_withUnsafeCurrentTask.swift b/test/Concurrency/Runtime/async_task_withUnsafeCurrentTask.swift index 5aa0983468caf..5547e4d95e8b5 100644 --- a/test/Concurrency/Runtime/async_task_withUnsafeCurrentTask.swift +++ b/test/Concurrency/Runtime/async_task_withUnsafeCurrentTask.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple -parse-as-library) 2>&1 | %FileCheck %s --dump-input=always +// RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) 2>&1 | %FileCheck %s --dump-input=always +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency // REQUIRES: swift_task_debug_log diff --git a/test/Concurrency/Runtime/async_task_yield.swift b/test/Concurrency/Runtime/async_task_yield.swift index 07110f890ad94..34ae1e2db00b4 100644 --- a/test/Concurrency/Runtime/async_task_yield.swift +++ b/test/Concurrency/Runtime/async_task_yield.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift(-target %target-swift-5.1-abi-triple -parse-as-library) +// RUN: %target-run-simple-swift(-target %target-swift-5.1-abi-triple -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_taskgroup_addUnlessCancelled.swift b/test/Concurrency/Runtime/async_taskgroup_addUnlessCancelled.swift index 12bfa0abc2641..da68ea317426e 100644 --- a/test/Concurrency/Runtime/async_taskgroup_addUnlessCancelled.swift +++ b/test/Concurrency/Runtime/async_taskgroup_addUnlessCancelled.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple -parse-as-library) | %FileCheck %s +// RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_taskgroup_asynciterator_semantics.swift b/test/Concurrency/Runtime/async_taskgroup_asynciterator_semantics.swift index 9abefe8417a59..616e7e790d6fd 100644 --- a/test/Concurrency/Runtime/async_taskgroup_asynciterator_semantics.swift +++ b/test/Concurrency/Runtime/async_taskgroup_asynciterator_semantics.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple -parse-as-library) | %FileCheck %s --dump-input=always +// RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s --dump-input=always +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_taskgroup_cancelAll_only_specific_group.swift b/test/Concurrency/Runtime/async_taskgroup_cancelAll_only_specific_group.swift index 1ed9c55d0d84a..9c8895ec1802c 100644 --- a/test/Concurrency/Runtime/async_taskgroup_cancelAll_only_specific_group.swift +++ b/test/Concurrency/Runtime/async_taskgroup_cancelAll_only_specific_group.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple %import-libdispatch -parse-as-library) | %FileCheck %s --dump-input always +// RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple %import-libdispatch -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s --dump-input always +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_taskgroup_cancel_parent_affects_group.swift b/test/Concurrency/Runtime/async_taskgroup_cancel_parent_affects_group.swift index 4699feb3726ad..267572f167334 100644 --- a/test/Concurrency/Runtime/async_taskgroup_cancel_parent_affects_group.swift +++ b/test/Concurrency/Runtime/async_taskgroup_cancel_parent_affects_group.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple %import-libdispatch -parse-as-library) | %FileCheck %s --dump-input always +// RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple %import-libdispatch -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s --dump-input always +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_taskgroup_cancel_then_completions.swift b/test/Concurrency/Runtime/async_taskgroup_cancel_then_completions.swift index 640155502d2b8..18ef79a1a1d06 100644 --- a/test/Concurrency/Runtime/async_taskgroup_cancel_then_completions.swift +++ b/test/Concurrency/Runtime/async_taskgroup_cancel_then_completions.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple %import-libdispatch -parse-as-library) | %FileCheck %s --dump-input always +// RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple %import-libdispatch -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s --dump-input always +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_taskgroup_cancel_then_spawn.swift b/test/Concurrency/Runtime/async_taskgroup_cancel_then_spawn.swift index d97d5330ea0f2..c313a37c56cd1 100644 --- a/test/Concurrency/Runtime/async_taskgroup_cancel_then_spawn.swift +++ b/test/Concurrency/Runtime/async_taskgroup_cancel_then_spawn.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple %import-libdispatch -parse-as-library) | %FileCheck %s --dump-input always +// RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple %import-libdispatch -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s --dump-input always +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_taskgroup_discarding.swift b/test/Concurrency/Runtime/async_taskgroup_discarding.swift index 7bb390ae0bcce..9684d834a7496 100644 --- a/test/Concurrency/Runtime/async_taskgroup_discarding.swift +++ b/test/Concurrency/Runtime/async_taskgroup_discarding.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking -parse-as-library) | %FileCheck %s +// RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // TODO: move to target-run-simple-leaks-swift once CI is using at least Xcode 14.3 // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_taskgroup_discarding_dontLeak.swift b/test/Concurrency/Runtime/async_taskgroup_discarding_dontLeak.swift index fe185503dbbbd..cdc4dc8a2bd40 100644 --- a/test/Concurrency/Runtime/async_taskgroup_discarding_dontLeak.swift +++ b/test/Concurrency/Runtime/async_taskgroup_discarding_dontLeak.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking -parse-as-library) | %FileCheck %s --dump-input=always +// RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s --dump-input=always +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // TODO: move to target-run-simple-leaks-swift once CI is using at least Xcode 14.3 // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_taskgroup_discarding_dontLeak_class_error.swift b/test/Concurrency/Runtime/async_taskgroup_discarding_dontLeak_class_error.swift index 599ea8455f1c4..566ab948654d8 100644 --- a/test/Concurrency/Runtime/async_taskgroup_discarding_dontLeak_class_error.swift +++ b/test/Concurrency/Runtime/async_taskgroup_discarding_dontLeak_class_error.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking -parse-as-library) | %FileCheck %s --dump-input=always +// RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s --dump-input=always +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: concurrency // REQUIRES: executable_test diff --git a/test/Concurrency/Runtime/async_taskgroup_discarding_neverConsumingTasks.swift b/test/Concurrency/Runtime/async_taskgroup_discarding_neverConsumingTasks.swift index f9f15389482b7..e3f850073327a 100644 --- a/test/Concurrency/Runtime/async_taskgroup_discarding_neverConsumingTasks.swift +++ b/test/Concurrency/Runtime/async_taskgroup_discarding_neverConsumingTasks.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking -parse-as-library) | %FileCheck %s --dump-input=always +// RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s --dump-input=always +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency // REQUIRES: concurrency_runtime diff --git a/test/Concurrency/Runtime/async_taskgroup_dontLeakTasks.swift b/test/Concurrency/Runtime/async_taskgroup_dontLeakTasks.swift index 4ae3cf7bd8990..ef6cbfa3d00d1 100644 --- a/test/Concurrency/Runtime/async_taskgroup_dontLeakTasks.swift +++ b/test/Concurrency/Runtime/async_taskgroup_dontLeakTasks.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple -parse-as-library) | %FileCheck %s +// RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // TODO: move to target-run-simple-leaks-swift once CI is using at least Xcode 14.3 // Task group addTask is not supported in freestanding mode diff --git a/test/Concurrency/Runtime/async_taskgroup_is_asyncsequence.swift b/test/Concurrency/Runtime/async_taskgroup_is_asyncsequence.swift index 5ad856a840f90..b5112153de790 100644 --- a/test/Concurrency/Runtime/async_taskgroup_is_asyncsequence.swift +++ b/test/Concurrency/Runtime/async_taskgroup_is_asyncsequence.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple -parse-as-library) | %FileCheck %s --dump-input=always +// RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s --dump-input=always +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_taskgroup_is_empty.swift b/test/Concurrency/Runtime/async_taskgroup_is_empty.swift index 63d426c55d546..4621e0b5db2c6 100644 --- a/test/Concurrency/Runtime/async_taskgroup_is_empty.swift +++ b/test/Concurrency/Runtime/async_taskgroup_is_empty.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple %import-libdispatch -parse-as-library) | %FileCheck %s +// RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple %import-libdispatch -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_taskgroup_next_not_invoked_cancelAll.swift b/test/Concurrency/Runtime/async_taskgroup_next_not_invoked_cancelAll.swift index a6323369c9fd7..99fafc55a45ed 100644 --- a/test/Concurrency/Runtime/async_taskgroup_next_not_invoked_cancelAll.swift +++ b/test/Concurrency/Runtime/async_taskgroup_next_not_invoked_cancelAll.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple %import-libdispatch -parse-as-library) | %FileCheck %s --dump-input=always +// RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple %import-libdispatch -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s --dump-input=always +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_taskgroup_next_not_invoked_without_cancelAll.swift b/test/Concurrency/Runtime/async_taskgroup_next_not_invoked_without_cancelAll.swift index b6375965d06c3..22062f13b0a18 100644 --- a/test/Concurrency/Runtime/async_taskgroup_next_not_invoked_without_cancelAll.swift +++ b/test/Concurrency/Runtime/async_taskgroup_next_not_invoked_without_cancelAll.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple %import-libdispatch -parse-as-library) | %FileCheck %s --dump-input=always +// RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple %import-libdispatch -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s --dump-input=always +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_taskgroup_next_on_completed.swift b/test/Concurrency/Runtime/async_taskgroup_next_on_completed.swift index fcf7206a0654a..f9df0697a7e97 100644 --- a/test/Concurrency/Runtime/async_taskgroup_next_on_completed.swift +++ b/test/Concurrency/Runtime/async_taskgroup_next_on_completed.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple %import-libdispatch -parse-as-library) | %FileCheck %s --dump-input=always +// RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple %import-libdispatch -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s --dump-input=always +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_taskgroup_next_on_pending.swift b/test/Concurrency/Runtime/async_taskgroup_next_on_pending.swift index 18fdb7191dbac..a79899e36bf34 100644 --- a/test/Concurrency/Runtime/async_taskgroup_next_on_pending.swift +++ b/test/Concurrency/Runtime/async_taskgroup_next_on_pending.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking %import-libdispatch -parse-as-library) | %FileCheck %s --dump-input=always +// RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking %import-libdispatch -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s --dump-input=always +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_taskgroup_throw_recover.swift b/test/Concurrency/Runtime/async_taskgroup_throw_recover.swift index a6225ab24a4b9..8c0534c078c3a 100644 --- a/test/Concurrency/Runtime/async_taskgroup_throw_recover.swift +++ b/test/Concurrency/Runtime/async_taskgroup_throw_recover.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple -parse-as-library) | %FileCheck %s +// RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/async_taskgroup_throw_rethrow.swift b/test/Concurrency/Runtime/async_taskgroup_throw_rethrow.swift index 82fad46a9b81d..76f0ca7c0f822 100644 --- a/test/Concurrency/Runtime/async_taskgroup_throw_rethrow.swift +++ b/test/Concurrency/Runtime/async_taskgroup_throw_rethrow.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking -parse-as-library) | %FileCheck %s --dump-input=always +// RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s --dump-input=always +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/basic_future.swift b/test/Concurrency/Runtime/basic_future.swift index 71cef47fc60a1..a48939b8b2157 100644 --- a/test/Concurrency/Runtime/basic_future.swift +++ b/test/Concurrency/Runtime/basic_future.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple %import-libdispatch -parse-as-library) +// RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple %import-libdispatch -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/cancellation_handler.swift b/test/Concurrency/Runtime/cancellation_handler.swift index f21ed50b754b7..aa4534758087f 100644 --- a/test/Concurrency/Runtime/cancellation_handler.swift +++ b/test/Concurrency/Runtime/cancellation_handler.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple %import-libdispatch) +// RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple %import-libdispatch -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: concurrency // REQUIRES: executable_test diff --git a/test/Concurrency/Runtime/cancellation_handler_concurrent.swift b/test/Concurrency/Runtime/cancellation_handler_concurrent.swift index 70615cad0b47c..3579459b2cc4a 100644 --- a/test/Concurrency/Runtime/cancellation_handler_concurrent.swift +++ b/test/Concurrency/Runtime/cancellation_handler_concurrent.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple %import-libdispatch) +// RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple %import-libdispatch -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: concurrency // REQUIRES: executable_test diff --git a/test/Concurrency/Runtime/cancellation_handler_only_once.swift b/test/Concurrency/Runtime/cancellation_handler_only_once.swift index b188b1f0c02b0..d1f825b0d7dfb 100644 --- a/test/Concurrency/Runtime/cancellation_handler_only_once.swift +++ b/test/Concurrency/Runtime/cancellation_handler_only_once.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking -target %target-swift-5.1-abi-triple %import-libdispatch) | %FileCheck %s +// RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking -target %target-swift-5.1-abi-triple %import-libdispatch -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: concurrency // REQUIRES: executable_test diff --git a/test/Concurrency/Runtime/checked_continuation.swift b/test/Concurrency/Runtime/checked_continuation.swift index e2ef84d38bfd9..bdddfc15ee8d5 100644 --- a/test/Concurrency/Runtime/checked_continuation.swift +++ b/test/Concurrency/Runtime/checked_continuation.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple -parse-as-library) +// RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/clock.swift b/test/Concurrency/Runtime/clock.swift index bd97898a3e95e..8f876105bcd8e 100644 --- a/test/Concurrency/Runtime/clock.swift +++ b/test/Concurrency/Runtime/clock.swift @@ -1,5 +1,7 @@ // RUN: %target-typecheck-verify-swift -strict-concurrency=complete -disable-availability-checking -parse-as-library // RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking -parse-as-library) +// RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: concurrency // REQUIRES: executable_test diff --git a/test/Concurrency/Runtime/clocks.swift b/test/Concurrency/Runtime/clocks.swift index 731cda3503d42..45083e7ea610c 100644 --- a/test/Concurrency/Runtime/clocks.swift +++ b/test/Concurrency/Runtime/clocks.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift(%import-libdispatch -parse-as-library) +// RUN: %target-run-simple-swift(%import-libdispatch -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: concurrency // REQUIRES: executable_test diff --git a/test/Concurrency/Runtime/custom_executors.swift b/test/Concurrency/Runtime/custom_executors.swift index 87bc68da3999e..6d3fe695cd54d 100644 --- a/test/Concurrency/Runtime/custom_executors.swift +++ b/test/Concurrency/Runtime/custom_executors.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple %import-libdispatch -parse-as-library) | %FileCheck %s --dump-input=always +// RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple %import-libdispatch -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s --dump-input=always +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: concurrency // REQUIRES: executable_test diff --git a/test/Concurrency/Runtime/custom_executors_complex_equality.swift b/test/Concurrency/Runtime/custom_executors_complex_equality.swift index 78342138f7abf..b07ab1cab8fe1 100644 --- a/test/Concurrency/Runtime/custom_executors_complex_equality.swift +++ b/test/Concurrency/Runtime/custom_executors_complex_equality.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -Xfrontend -enable-experimental-move-only -Xfrontend -disable-availability-checking %import-libdispatch -parse-as-library) | %FileCheck %s +// RUN: %target-run-simple-swift( -Xfrontend -enable-experimental-move-only -Xfrontend -disable-availability-checking %import-libdispatch -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: concurrency // REQUIRES: executable_test diff --git a/test/Concurrency/Runtime/custom_executors_complex_equality_subclass.swift b/test/Concurrency/Runtime/custom_executors_complex_equality_subclass.swift index 1a4b8bb5218fc..a378c10af68db 100644 --- a/test/Concurrency/Runtime/custom_executors_complex_equality_subclass.swift +++ b/test/Concurrency/Runtime/custom_executors_complex_equality_subclass.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -Xfrontend -enable-experimental-move-only -Xfrontend -disable-availability-checking %import-libdispatch -parse-as-library) | %FileCheck %s +// RUN: %target-run-simple-swift( -Xfrontend -enable-experimental-move-only -Xfrontend -disable-availability-checking %import-libdispatch -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: concurrency // REQUIRES: executable_test diff --git a/test/Concurrency/Runtime/custom_executors_default.swift b/test/Concurrency/Runtime/custom_executors_default.swift index 1d4f9bb841aa4..4b41ce16fa549 100644 --- a/test/Concurrency/Runtime/custom_executors_default.swift +++ b/test/Concurrency/Runtime/custom_executors_default.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple %import-libdispatch -parse-as-library) | %FileCheck %s +// RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple %import-libdispatch -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: concurrency // REQUIRES: executable_test diff --git a/test/Concurrency/Runtime/custom_executors_globalActor.swift b/test/Concurrency/Runtime/custom_executors_globalActor.swift index 8342a70799c4e..5fde3591e6bef 100644 --- a/test/Concurrency/Runtime/custom_executors_globalActor.swift +++ b/test/Concurrency/Runtime/custom_executors_globalActor.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( %import-libdispatch -strict-concurrency=complete -parse-as-library) | %FileCheck %s +// RUN: %target-run-simple-swift( %import-libdispatch -strict-concurrency=complete -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: concurrency // REQUIRES: executable_test diff --git a/test/Concurrency/Runtime/custom_executors_moveOnly_job.swift b/test/Concurrency/Runtime/custom_executors_moveOnly_job.swift index 4f4423a27e6ca..5f892f7b45c56 100644 --- a/test/Concurrency/Runtime/custom_executors_moveOnly_job.swift +++ b/test/Concurrency/Runtime/custom_executors_moveOnly_job.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking %import-libdispatch -parse-as-library) | %FileCheck %s +// RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking %import-libdispatch -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: concurrency // REQUIRES: executable_test diff --git a/test/Concurrency/Runtime/custom_executors_priority.swift b/test/Concurrency/Runtime/custom_executors_priority.swift index 99f7fc21d0e03..aa5090f2aeb66 100644 --- a/test/Concurrency/Runtime/custom_executors_priority.swift +++ b/test/Concurrency/Runtime/custom_executors_priority.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking %import-libdispatch -parse-as-library) | %FileCheck %s --dump-input=always +// RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking %import-libdispatch -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s --dump-input=always +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: concurrency // REQUIRES: executable_test diff --git a/test/Concurrency/Runtime/custom_executors_protocol.swift b/test/Concurrency/Runtime/custom_executors_protocol.swift index 0a4d23683110a..c9ebd2f10bbf7 100644 --- a/test/Concurrency/Runtime/custom_executors_protocol.swift +++ b/test/Concurrency/Runtime/custom_executors_protocol.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -Xfrontend -enable-experimental-move-only -Xfrontend -disable-availability-checking %import-libdispatch -parse-as-library) | %FileCheck %s +// RUN: %target-run-simple-swift( -Xfrontend -enable-experimental-move-only -Xfrontend -disable-availability-checking %import-libdispatch -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: concurrency // REQUIRES: executable_test diff --git a/test/Concurrency/Runtime/custom_main_executor.swift b/test/Concurrency/Runtime/custom_main_executor.swift index 08e9b8f7ce64e..cea9b4d04a0e6 100644 --- a/test/Concurrency/Runtime/custom_main_executor.swift +++ b/test/Concurrency/Runtime/custom_main_executor.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift(-Xfrontend -disable-availability-checking -g %import-libdispatch -parse-as-library) | %FileCheck %s +// RUN: %target-run-simple-swift(-Xfrontend -disable-availability-checking -g %import-libdispatch -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: concurrency // REQUIRES: executable_test @@ -70,7 +72,7 @@ final class SimpleTaskExecutor: TaskExecutor, @unchecked Sendable { } } -func myAsyncFunction() async { +@concurrent func myAsyncFunction() async { print("Hello World") } diff --git a/test/Concurrency/Runtime/effectful_properties.swift b/test/Concurrency/Runtime/effectful_properties.swift index 1489261e26ce1..f00e1183cdc25 100644 --- a/test/Concurrency/Runtime/effectful_properties.swift +++ b/test/Concurrency/Runtime/effectful_properties.swift @@ -1,5 +1,12 @@ // RUN: %target-run-simple-swift(-parse-as-library -target %target-swift-5.1-abi-triple) | %FileCheck %s +// Enable this for nonisolated nonsending by default rdar://157226022 is +// fixed. The test will fail otherwise since we hit an error due to inferring +// nonisolated(nonsending) on the non-async property name. + +// XUN: %target-run-simple-swift(-parse-as-library -target %target-swift-5.1-abi-triple -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s +// XEQUIRES: swift_feature_NonisolatedNonsendingByDefault + // REQUIRES: executable_test // REQUIRES: concurrency // UNSUPPORTED: freestanding diff --git a/test/Concurrency/Runtime/exclusivity.swift b/test/Concurrency/Runtime/exclusivity.swift index cca10356dabb3..f217e2db37253 100644 --- a/test/Concurrency/Runtime/exclusivity.swift +++ b/test/Concurrency/Runtime/exclusivity.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift(-target %target-swift-5.1-abi-triple -parse-as-library) +// RUN: %target-run-simple-swift(-target %target-swift-5.1-abi-triple -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/exclusivity_custom_executors.swift b/test/Concurrency/Runtime/exclusivity_custom_executors.swift index 1d452da1edfbb..09f40a10196d5 100644 --- a/test/Concurrency/Runtime/exclusivity_custom_executors.swift +++ b/test/Concurrency/Runtime/exclusivity_custom_executors.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift(-target %target-swift-5.1-abi-triple -parse-as-library) +// RUN: %target-run-simple-swift(-target %target-swift-5.1-abi-triple -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: concurrency // REQUIRES: executable_test diff --git a/test/Concurrency/Runtime/executor_deinit1.swift b/test/Concurrency/Runtime/executor_deinit1.swift index 73e56543429fa..862e7854f1c48 100644 --- a/test/Concurrency/Runtime/executor_deinit1.swift +++ b/test/Concurrency/Runtime/executor_deinit1.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift(-parse-as-library -target %target-swift-5.1-abi-triple %import-libdispatch) | %FileCheck %s +// RUN: %target-run-simple-swift(-parse-as-library -target %target-swift-5.1-abi-triple %import-libdispatch -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/executor_deinit2.swift b/test/Concurrency/Runtime/executor_deinit2.swift index a50bf58887f69..c444e0460d1d0 100644 --- a/test/Concurrency/Runtime/executor_deinit2.swift +++ b/test/Concurrency/Runtime/executor_deinit2.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift(-parse-as-library -target %target-swift-5.1-abi-triple) | %FileCheck %s +// RUN: %target-run-simple-swift(-parse-as-library -target %target-swift-5.1-abi-triple -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/executor_deinit3.swift b/test/Concurrency/Runtime/executor_deinit3.swift index ef638cf957ff6..2e3ab21476057 100644 --- a/test/Concurrency/Runtime/executor_deinit3.swift +++ b/test/Concurrency/Runtime/executor_deinit3.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift(-parse-as-library -target %target-swift-5.1-abi-triple %import-libdispatch) | %FileCheck %s +// RUN: %target-run-simple-swift(-parse-as-library -target %target-swift-5.1-abi-triple %import-libdispatch -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/future_fibonacci.swift b/test/Concurrency/Runtime/future_fibonacci.swift index b62c5316090f6..75a85d3c0910b 100644 --- a/test/Concurrency/Runtime/future_fibonacci.swift +++ b/test/Concurrency/Runtime/future_fibonacci.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple %import-libdispatch -parse-as-library) +// RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple %import-libdispatch -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/isolated_conformance.swift b/test/Concurrency/Runtime/isolated_conformance.swift index c3c4e1e968f78..609bd3a8c2272 100644 --- a/test/Concurrency/Runtime/isolated_conformance.swift +++ b/test/Concurrency/Runtime/isolated_conformance.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift(-target %target-swift-5.1-abi-triple) | %FileCheck %s +// RUN: %target-run-simple-swift(-target %target-swift-5.1-abi-triple -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/isolated_macro_in_nonisolated_nonsending_func.swift b/test/Concurrency/Runtime/isolated_macro_in_nonisolated_nonsending_func.swift index 0365c6df828dd..06789bb3a2971 100644 --- a/test/Concurrency/Runtime/isolated_macro_in_nonisolated_nonsending_func.swift +++ b/test/Concurrency/Runtime/isolated_macro_in_nonisolated_nonsending_func.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking -parse-as-library) | %FileCheck %s --dump-input=always +// RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s --dump-input=always +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: concurrency // REQUIRES: executable_test diff --git a/test/Concurrency/Runtime/mainactor.swift b/test/Concurrency/Runtime/mainactor.swift index f2be405fd3152..3a2ffe6f4936b 100644 --- a/test/Concurrency/Runtime/mainactor.swift +++ b/test/Concurrency/Runtime/mainactor.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift(-parse-as-library -g -target %target-swift-5.1-abi-triple %import-libdispatch) | %FileCheck %s +// RUN: %target-run-simple-swift(-parse-as-library -g -target %target-swift-5.1-abi-triple %import-libdispatch -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/nonisolated_inherits_isolation.swift b/test/Concurrency/Runtime/nonisolated_inherits_isolation.swift index e4b6ec5146d19..90bc2bcaa45ea 100644 --- a/test/Concurrency/Runtime/nonisolated_inherits_isolation.swift +++ b/test/Concurrency/Runtime/nonisolated_inherits_isolation.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -swift-version 6 -g %import-libdispatch -import-objc-header %S/Inputs/RunOnMainActor.h -enable-upcoming-feature NonisolatedNonsendingByDefault ) +// RUN: %target-run-simple-swift( -swift-version 6 -g %import-libdispatch -import-objc-header %S/Inputs/RunOnMainActor.h -enable-upcoming-feature NonisolatedNonsendingByDefault -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/sleep_executor.swift b/test/Concurrency/Runtime/sleep_executor.swift index f4767e5a068b3..46809b5212e39 100644 --- a/test/Concurrency/Runtime/sleep_executor.swift +++ b/test/Concurrency/Runtime/sleep_executor.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift(%import-libdispatch -parse-as-library) +// RUN: %target-run-simple-swift(%import-libdispatch -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: concurrency // REQUIRES: executable_test diff --git a/test/Concurrency/Runtime/task_creation.swift b/test/Concurrency/Runtime/task_creation.swift index 42cf3d773e5a3..b834bc61719cd 100644 --- a/test/Concurrency/Runtime/task_creation.swift +++ b/test/Concurrency/Runtime/task_creation.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple -parse-as-library) +// RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/task_destruction.swift b/test/Concurrency/Runtime/task_destruction.swift index f949727c6b789..20a026e584a57 100644 --- a/test/Concurrency/Runtime/task_destruction.swift +++ b/test/Concurrency/Runtime/task_destruction.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift(-parse-as-library -target %target-swift-5.1-abi-triple) | %FileCheck %s +// RUN: %target-run-simple-swift(-parse-as-library -target %target-swift-5.1-abi-triple -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency // REQUIRES: concurrency_runtime diff --git a/test/Concurrency/Runtime/taskgroup_cancelAll_cancellationHandler.swift b/test/Concurrency/Runtime/taskgroup_cancelAll_cancellationHandler.swift index d242a15908c58..3249c2781f232 100644 --- a/test/Concurrency/Runtime/taskgroup_cancelAll_cancellationHandler.swift +++ b/test/Concurrency/Runtime/taskgroup_cancelAll_cancellationHandler.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple %import-libdispatch -parse-as-library) | %FileCheck %s +// RUN: %target-run-simple-swift( -target %target-swift-5.1-abi-triple %import-libdispatch -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) | %FileCheck %s +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/Runtime/unspecified_is_main_actor.swift b/test/Concurrency/Runtime/unspecified_is_main_actor.swift index 51c3a732079c2..18f389c0b3570 100644 --- a/test/Concurrency/Runtime/unspecified_is_main_actor.swift +++ b/test/Concurrency/Runtime/unspecified_is_main_actor.swift @@ -1,4 +1,6 @@ // RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking -swift-version 6 -g -import-objc-header %S/Inputs/RunOnMainActor.h %import-libdispatch -Xfrontend -default-isolation=MainActor ) +// RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking -swift-version 6 -g -import-objc-header %S/Inputs/RunOnMainActor.h %import-libdispatch -Xfrontend -default-isolation=MainActor -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault) +// REQUIRES: swift_feature_NonisolatedNonsendingByDefault // REQUIRES: executable_test // REQUIRES: concurrency diff --git a/test/Concurrency/attr_execution/attr_execution.swift b/test/Concurrency/attr_execution/attr_execution.swift index be472c673ebfb..c211136e547a9 100644 --- a/test/Concurrency/attr_execution/attr_execution.swift +++ b/test/Concurrency/attr_execution/attr_execution.swift @@ -11,24 +11,24 @@ func concurrentTest() async {} // CHECK-LABEL: // callerTest() // CHECK: // Isolation: caller_isolation_inheriting -// CHECK: sil hidden [ossa] @$s14attr_execution10callerTestyyYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> () { +// CHECK: sil hidden [ossa] @$s14attr_execution10callerTestyyYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> () { nonisolated(nonsending) func callerTest() async {} struct Test { // CHECK-LABEL: // closure #1 in variable initialization expression of Test.x // CHECK: // Isolation: caller_isolation_inheriting - // CHECK: sil private [ossa] @$s14attr_execution4TestV1xyyYaYCcvpfiyyYaYCcfU_ : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> () + // CHECK: sil private [ossa] @$s14attr_execution4TestV1xyyYaYCcvpfiyyYaYCcfU_ : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> () var x: () async -> Void = {} // CHECK-LABEL: // Test.test() // CHECK: // Isolation: caller_isolation_inheriting - // CHECK: sil hidden [ossa] @$s14attr_execution4TestV4testyyYaF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed Test) -> () - // CHECK: bb0([[ISOLATION:%.*]] : @guaranteed $Optional, [[SELF:%.*]] : @guaranteed $Test) + // CHECK: sil hidden [ossa] @$s14attr_execution4TestV4testyyYaF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed Test) -> () + // CHECK: bb0([[ISOLATION:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, [[SELF:%.*]] : @guaranteed $Test) // CHECK: [[X_REF:%.*]] = struct_extract %1, #Test.x // CHECK: [[X_REF_COPY:%.]] = copy_value [[X_REF]] // CHECK: [[BORROWED_X:%.*]] = begin_borrow [[X_REF_COPY]] - // CHECK: apply [[BORROWED_X]]([[ISOLATION]]) : $@async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> () + // CHECK: apply [[BORROWED_X]]([[ISOLATION]]) : $@async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> () // CHECK: } // end sil function '$s14attr_execution4TestV4testyyYaF' func test() async { await x() @@ -36,11 +36,11 @@ struct Test { // CHECK-LABEL: // Test.testParam(fn:) // CHECK: // Isolation: caller_isolation_inheriting - // CHECK: sil hidden [ossa] @$s14attr_execution4TestV9testParam2fnyyyYaYCcSg_tYaF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed Optional<@async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> ()>, @guaranteed Test) -> () - // CHECK: bb0([[ISOLATION:%.*]] : @guaranteed $Optional, [[OPT_FN:%.*]] : @guaranteed $Optional<@async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> ()>, [[SELF:%.*]] : @guaranteed $Test) - // CHECK: bb1([[FN:%.*]] : @owned $@async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> ()) + // CHECK: sil hidden [ossa] @$s14attr_execution4TestV9testParam2fnyyyYaYCcSg_tYaF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed Optional<@async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> ()>, @guaranteed Test) -> () + // CHECK: bb0([[ISOLATION:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, [[OPT_FN:%.*]] : @guaranteed $Optional<@async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> ()>, [[SELF:%.*]] : @guaranteed $Test) + // CHECK: bb1([[FN:%.*]] : @owned $@async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> ()) // CHECK: [[BORROWED_FN:%.*]] = begin_borrow [[FN]] - // CHECK: apply [[BORROWED_FN]]([[ISOLATION]]) : $@async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> () + // CHECK: apply [[BORROWED_FN]]([[ISOLATION]]) : $@async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> () // CHECK: } // end sil function '$s14attr_execution4TestV9testParam2fnyyyYaYCcSg_tYaF' func testParam(fn: (() async -> Void)?) async { await fn?() @@ -49,11 +49,11 @@ struct Test { // CHECK-LABEL: // testLocal() // CHECK: // Isolation: caller_isolation_inheriting -// CHECK: sil hidden [ossa] @$s14attr_execution9testLocalyyYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> () { -// CHECK: bb0([[ISOLATION:%.*]] : @guaranteed $Optional) -// CHECK: bb1([[FN:%.*]] : @owned $@async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> ()) +// CHECK: sil hidden [ossa] @$s14attr_execution9testLocalyyYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> () { +// CHECK: bb0([[ISOLATION:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor) +// CHECK: bb1([[FN:%.*]] : @owned $@async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> ()) // CHECK: [[BORROWED_FN:%.*]] = begin_borrow [[FN]] -// CHECK: apply [[BORROWED_FN]]([[ISOLATION]]) : $@async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> () +// CHECK: apply [[BORROWED_FN]]([[ISOLATION]]) : $@async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> () // CHECK: } // end sil function '$s14attr_execution9testLocalyyYaF' func testLocal() async { let fn: (() async -> Void)? = nil @@ -62,20 +62,20 @@ func testLocal() async { // CHECK-LABEL: // takesClosure(fn:) // CHECK: // Isolation: unspecified -// CHECK: sil hidden [ossa] @$s14attr_execution12takesClosure2fnyyyYaYCXE_tF : $@convention(thin) (@guaranteed @noescape @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> ()) -> () +// CHECK: sil hidden [ossa] @$s14attr_execution12takesClosure2fnyyyYaYCXE_tF : $@convention(thin) (@guaranteed @noescape @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> ()) -> () func takesClosure(fn: () async -> Void) { } // CHECK-LABEL: sil hidden [ossa] @$s14attr_execution11testClosureyyF : $@convention(thin) () -> () -// CHECK: [[CLOSURE:%.*]] = function_ref @$s14attr_execution11testClosureyyFyyYaYCXEfU_ : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> () -// CHECK: [[THUNKED_CLOSURE:%.*]] = thin_to_thick_function %0 to $@noescape @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> () -// CHECK: [[TAKES_CLOSURE:%.*]] = function_ref @$s14attr_execution12takesClosure2fnyyyYaYCXE_tF : $@convention(thin) (@guaranteed @noescape @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> ()) -> () +// CHECK: [[CLOSURE:%.*]] = function_ref @$s14attr_execution11testClosureyyFyyYaYCXEfU_ : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> () +// CHECK: [[THUNKED_CLOSURE:%.*]] = thin_to_thick_function %0 to $@noescape @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> () +// CHECK: [[TAKES_CLOSURE:%.*]] = function_ref @$s14attr_execution12takesClosure2fnyyyYaYCXE_tF : $@convention(thin) (@guaranteed @noescape @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> ()) -> () // CHECK: apply [[TAKES_CLOSURE]]([[THUNKED_CLOSURE]]) // CHECK: } // end sil function '$s14attr_execution11testClosureyyF' // CHECK-LABEL: // closure #1 in testClosure() // CHECK: // Isolation: caller_isolation_inheriting -// CHECK: sil private [ossa] @$s14attr_execution11testClosureyyFyyYaYCXEfU_ : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> () +// CHECK: sil private [ossa] @$s14attr_execution11testClosureyyFyyYaYCXEfU_ : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> () func testClosure() { takesClosure { } @@ -86,8 +86,8 @@ protocol P { func open(_: T) async {} -// CHECK-LABEL: sil hidden [ossa] @$s14attr_execution19testOpenExistential11existentialyAA1P_p_tYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @in_guaranteed any P) -> () -// CHECK: bb0([[ISOLATION:%.*]] : @guaranteed $Optional, [[EXISTENTIAL:%.*]] : $*any P): +// CHECK-LABEL: sil hidden [ossa] @$s14attr_execution19testOpenExistential11existentialyAA1P_p_tYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @in_guaranteed any P) -> () +// CHECK: bb0([[ISOLATION:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, [[EXISTENTIAL:%.*]] : $*any P): // CHECK: [[OPEN_REF:%.*]] = function_ref @$s14attr_execution4openyyxYaAA1PRzlF // CHECK: apply [[OPEN_REF]]<@opened("{{.*}}", any P) Self>([[ISOLATION]], {{.*}}) // CHECK: } // end sil function '$s14attr_execution19testOpenExistential11existentialyAA1P_p_tYaF' diff --git a/test/Concurrency/attr_execution/classes_silgen.swift b/test/Concurrency/attr_execution/classes_silgen.swift index fe82210ff52a9..04be88c8d82a6 100644 --- a/test/Concurrency/attr_execution/classes_silgen.swift +++ b/test/Concurrency/attr_execution/classes_silgen.swift @@ -26,8 +26,8 @@ class AllDefault : SuperKlass { class AllConcurrent : SuperKlass { // CHECK-LABEL: vtable thunk for SuperKlass.callerTest() dispatching to AllConcurrent.callerTest() - // CHECK-NEXT: sil private [thunk] [ossa] @$s21attr_execution_silgen13AllConcurrentC10callerTestyyYaFAA10SuperKlassCADyyYaFTV : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed AllConcurrent) -> () { - // CHECK: bb0([[ACTOR:%.*]] : @guaranteed $Optional, [[PARAM:%.*]] : @guaranteed $AllConcurrent): + // CHECK-NEXT: sil private [thunk] [ossa] @$s21attr_execution_silgen13AllConcurrentC10callerTestyyYaFAA10SuperKlassCADyyYaFTV : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed AllConcurrent) -> () { + // CHECK: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, [[PARAM:%.*]] : @guaranteed $AllConcurrent): // CHECK: [[FUNC:%.*]] = function_ref @$s21attr_execution_silgen13AllConcurrentC10callerTestyyYaF : $@convention(method) @async (@guaranteed AllConcurrent) -> () // CHECK: apply [[FUNC]]([[PARAM]]) // CHECK: hop_to_executor [[ACTOR]] @@ -44,9 +44,10 @@ class AllNonIsolatedUnsafe : SuperKlass { // CHECK-NEXT: sil private [thunk] [ossa] @$s21attr_execution_silgen20AllNonIsolatedUnsafeC14concurrentTestyyYaFAA10SuperKlassCADyyYaFTV : $@convention(method) @async (@guaranteed AllNonIsolatedUnsafe) -> () { // CHECK: bb0([[ARG:%.*]] : @guaranteed // CHECK: [[ACTOR:%.*]] = enum $Optional, #Optional.none!enumelt - // CHECK: hop_to_executor [[ACTOR]] - // CHECK: [[FUNC:%.*]] = function_ref @$s21attr_execution_silgen20AllNonIsolatedUnsafeC14concurrentTestyyYaF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed AllNonIsolatedUnsafe) -> () - // CHECK: apply [[FUNC]]([[ACTOR]], [[ARG]]) + // CHECK: [[ACTOR_CAST:%.*]] = unchecked_value_cast [[ACTOR]] to $Builtin.ImplicitIsolationActor + // CHECK: hop_to_executor [[ACTOR_CAST]] + // CHECK: [[FUNC:%.*]] = function_ref @$s21attr_execution_silgen20AllNonIsolatedUnsafeC14concurrentTestyyYaF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed AllNonIsolatedUnsafe) -> () + // CHECK: apply [[FUNC]]([[ACTOR_CAST]], [[ARG]]) // CHECK: } // end sil function '$s21attr_execution_silgen20AllNonIsolatedUnsafeC14concurrentTestyyYaFAA10SuperKlassCADyyYaFTV' override nonisolated(nonsending) func concurrentTest() async {} @@ -56,9 +57,11 @@ class AllNonIsolatedUnsafe : SuperKlass { // CHECK: [[ACTOR:%.*]] = apply {{%.*}}({{%.*}}) : $@convention(method) (@thick MainActor.Type) -> @owned MainActor // CHECK: [[ACTOR_E:%.*]] = init_existential_ref [[ACTOR]] // CHECK: [[ACTOR_E_OPT:%.*]] = enum $Optional, #Optional.some!enumelt, [[ACTOR_E]] - // CHECK: hop_to_executor [[ACTOR_E_OPT]] - // CHECK: [[FUNC:%.*]] = function_ref @$s21attr_execution_silgen20AllNonIsolatedUnsafeC13mainActorTestyyYaF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed AllNonIsolatedUnsafe) -> () - // CHECK: apply [[FUNC]]([[ACTOR_E_OPT]], [[ARG]]) + // CHECK: [[ACTOR_E_OPT_B:%.*]] = begin_borrow [[ACTOR_E_OPT]] + // CHECK: [[ACTOR_E_OPT_B_CAST:%.*]] = unchecked_value_cast [[ACTOR_E_OPT_B]] to $Builtin.ImplicitIsolationActor + // CHECK: hop_to_executor [[ACTOR_E_OPT_B_CAST]] + // CHECK: [[FUNC:%.*]] = function_ref @$s21attr_execution_silgen20AllNonIsolatedUnsafeC13mainActorTestyyYaF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed AllNonIsolatedUnsafe) -> () + // CHECK: apply [[FUNC]]([[ACTOR_E_OPT_B_CAST]], [[ARG]]) // CHECK: } // end sil function '$s21attr_execution_silgen20AllNonIsolatedUnsafeC13mainActorTestyyYaFAA10SuperKlassCADyyYaFTV' override nonisolated(nonsending) func mainActorTest() async {} } diff --git a/test/Concurrency/attr_execution/conversions_silgen.swift b/test/Concurrency/attr_execution/conversions_silgen.swift index 0ecacaa916f91..fe82e1c63392e 100644 --- a/test/Concurrency/attr_execution/conversions_silgen.swift +++ b/test/Concurrency/attr_execution/conversions_silgen.swift @@ -41,10 +41,10 @@ func globalConcurrentFuncSendableKlass(_ x: SendableKlass) async -> SendableKlas // MARK: Tests // ///////////////// -// CHECK-LABEL: sil [ossa] @$s21attr_execution_silgen33testCallerToConcurrentNonIsolatedyyyyYaYCcYaF : $@convention(thin) @async (@guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> ()) -> () { -// CHECK: bb0([[FUNC:%.*]] : @guaranteed $@async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> ()): +// CHECK-LABEL: sil [ossa] @$s21attr_execution_silgen33testCallerToConcurrentNonIsolatedyyyyYaYCcYaF : $@convention(thin) @async (@guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> ()) -> () { +// CHECK: bb0([[FUNC:%.*]] : @guaranteed $@async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> ()): // CHECK: [[FUNC_COPY:%.*]] = copy_value [[FUNC]] -// CHECK: [[THUNK:%.*]] = function_ref @$sScA_pSgIegHgIL_IegH_TR : $@convention(thin) @async (@guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> ()) -> () +// CHECK: [[THUNK:%.*]] = function_ref @$sBAIegHgIL_IegH_TR : $@convention(thin) @async (@guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> ()) -> () // CHECK: partial_apply [callee_guaranteed] [[THUNK]]([[FUNC_COPY]]) // CHECK: } // end sil function '$s21attr_execution_silgen33testCallerToConcurrentNonIsolatedyyyyYaYCcYaF' public func testCallerToConcurrentNonIsolated(_ x: nonisolated(nonsending) @escaping () async -> ()) async { @@ -55,17 +55,18 @@ public func testCallerToConcurrentNonIsolated(_ x: nonisolated(nonsending) @esca // This thunk is used to convert a caller to a concurrent function. So, we pass in .none as the // isolated parameter. // -// CHECK-LABEL: sil shared [transparent] [serialized] [reabstraction_thunk] [ossa] @$sScA_pSgIegHgIL_IegH_TR : $@convention(thin) @async (@guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> ()) -> () { -// CHECK: bb0([[FUNC:%.*]] : @guaranteed $@async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> ()): +// CHECK-LABEL: sil shared [transparent] [serialized] [reabstraction_thunk] [ossa] @$sBAIegHgIL_IegH_TR : $@convention(thin) @async (@guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> ()) -> () { +// CHECK: bb0([[FUNC:%.*]] : @guaranteed $@async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> ()): // CHECK: [[ENUM:%.*]] = enum $Optional, #Optional.none!enumelt // CHECK: hop_to_executor [[ENUM]] -// CHECK: apply [[FUNC]]([[ENUM]]) -// CHECK: } // end sil function '$sScA_pSgIegHgIL_IegH_TR' +// CHECK: [[CAST:%.*]] = unchecked_value_cast [[ENUM]] to $Builtin.ImplicitIsolationActor +// CHECK: apply [[FUNC]]([[CAST]]) +// CHECK: } // end sil function '$sBAIegHgIL_IegH_TR' -// CHECK-LABEL: sil [ossa] @$s21attr_execution_silgen31testCallerToConcurrentMainActoryyyyYaYCcYaF : $@convention(thin) @async (@guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> ()) -> () { -// CHECK: bb0([[FUNC:%.*]] : @guaranteed $@async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> ()): +// CHECK-LABEL: sil [ossa] @$s21attr_execution_silgen31testCallerToConcurrentMainActoryyyyYaYCcYaF : $@convention(thin) @async (@guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> ()) -> () { +// CHECK: bb0([[FUNC:%.*]] : @guaranteed $@async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> ()): // CHECK: [[FUNC_COPY:%.*]] = copy_value [[FUNC]] -// CHECK: [[THUNK:%.*]] = function_ref @$sScA_pSgIegHgIL_IegH_TR : $@convention(thin) @async (@guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> ()) -> () +// CHECK: [[THUNK:%.*]] = function_ref @$sBAIegHgIL_IegH_TR : $@convention(thin) @async (@guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> ()) -> () // CHECK: partial_apply [callee_guaranteed] [[THUNK]]([[FUNC_COPY]]) // CHECK: } // end sil function '$s21attr_execution_silgen31testCallerToConcurrentMainActoryyyyYaYCcYaF' @MainActor @@ -77,7 +78,7 @@ public func testCallerToConcurrentMainActor(_ x: nonisolated(nonsending) @escapi // CHECK-LABEL: sil [ossa] @$s21attr_execution_silgen33testConcurrentToCallerNonIsolatedyyyyYacYaF : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> () { // CHECK: bb0([[FUNC:%.*]] : @guaranteed $@async @callee_guaranteed () -> ()): // CHECK: [[FUNC_COPY:%.*]] = copy_value [[FUNC]] -// CHECK: [[THUNK:%.*]] = function_ref @$sIegH_ScA_pSgIegHgIL_TR : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed @async @callee_guaranteed () -> ()) -> () +// CHECK: [[THUNK:%.*]] = function_ref @$sIegH_BAIegHgIL_TR : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed @async @callee_guaranteed () -> ()) -> () // CHECK: partial_apply [callee_guaranteed] [[THUNK]]([[FUNC_COPY]]) // CHECK: } // end sil function '$s21attr_execution_silgen33testConcurrentToCallerNonIsolatedyyyyYacYaF' public func testConcurrentToCallerNonIsolated(_ x: @escaping @concurrent () async -> ()) async { @@ -88,16 +89,16 @@ public func testConcurrentToCallerNonIsolated(_ x: @escaping @concurrent () asyn // This thunk has the "surface" of an @caller function, but just ignores the // isolated parameter and calls the concurrent funciton. // -// CHECK-LABEL: sil shared [transparent] [serialized] [reabstraction_thunk] [ossa] @$sIegH_ScA_pSgIegHgIL_TR : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed @async @callee_guaranteed () -> ()) -> () { -// CHECK: bb0([[ACTOR:%.*]] : @guaranteed $Optional, [[FUNC:%.*]] : @guaranteed $@async @callee_guaranteed () -> ()): +// CHECK-LABEL: sil shared [transparent] [serialized] [reabstraction_thunk] [ossa] @$sIegH_BAIegHgIL_TR : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed @async @callee_guaranteed () -> ()) -> () { +// CHECK: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, [[FUNC:%.*]] : @guaranteed $@async @callee_guaranteed () -> ()): // CHECK: apply [[FUNC]] // CHECK: hop_to_executor [[ACTOR]] -// CHECK: } // end sil function '$sIegH_ScA_pSgIegHgIL_TR' +// CHECK: } // end sil function '$sIegH_BAIegHgIL_TR' // CHECK-LABEL: sil [ossa] @$s21attr_execution_silgen42testConcurrentToCallerNonIsolatedMainActoryyyyYacYaF : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> () { // CHECK: bb0([[FUNC:%.*]] : // CHECK: [[FUNC_COPY:%.*]] = copy_value [[FUNC]] -// CHECK: [[THUNK:%.*]] = function_ref @$sIegH_ScA_pSgIegHgIL_TR : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed @async @callee_guaranteed () -> ()) -> () +// CHECK: [[THUNK:%.*]] = function_ref @$sIegH_BAIegHgIL_TR : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed @async @callee_guaranteed () -> ()) -> () // CHECK: partial_apply [callee_guaranteed] [[THUNK]]([[FUNC_COPY]]) // CHECK: } // end sil function '$s21attr_execution_silgen42testConcurrentToCallerNonIsolatedMainActoryyyyYacYaF' @MainActor @@ -132,8 +133,8 @@ public func testConcurrentToConcurrent(_ x: @escaping @concurrent () async -> () await z() } -// CHECK-LABEL: sil [ossa] @$s21attr_execution_silgen012testCallerToE0yyyyYaYCcYaF : $@convention(thin) @async (@guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> ()) -> () { -// CHECK: bb0([[FUNC:%.*]] : @guaranteed $@async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> ()): +// CHECK-LABEL: sil [ossa] @$s21attr_execution_silgen012testCallerToE0yyyyYaYCcYaF : $@convention(thin) @async (@guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> ()) -> () { +// CHECK: bb0([[FUNC:%.*]] : @guaranteed $@async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> ()): // CHECK: [[COPY:%.*]] = copy_value [[FUNC]] // CHECK: [[Y:%.*]] = move_value [lexical] [var_decl] [[COPY]] // CHECK: [[BORROW_Y:%.*]] = begin_borrow [[Y]] @@ -150,8 +151,10 @@ public func testCallerToCaller(_ x: nonisolated(nonsending) @escaping () async - await z() } -// CHECK-LABEL: sil [ossa] @$s21attr_execution_silgen24testCallerLocalVariablesyyyyYaYCcYaF : $@convention(thin) @async (@guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> ()) -> () { -// CHECK: bb0([[PARAM:%.*]] : @guaranteed $@async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> ()): +// CHECK-LABEL: sil [ossa] @$s21attr_execution_silgen24testCallerLocalVariablesyyyyYaYCcYaF : $@convention(thin) @async (@guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> ()) -> () { +// CHECK: bb0([[PARAM:%.*]] : @guaranteed $@async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> ()): +// CHECK: [[ACTOR:%.*]] = enum $Optional, #Optional.none!enumelt +// CHECK: hop_to_executor [[ACTOR]] // CHECK: [[PARAM_COPY:%.*]] = copy_value [[PARAM]] // CHECK: [[Y:%.*]] = move_value [lexical] [var_decl] [[PARAM_COPY]] // CHECK: [[Y_B:%.*]] = begin_borrow [[Y]] @@ -159,9 +162,9 @@ public func testCallerToCaller(_ x: nonisolated(nonsending) @escaping () async - // CHECK: [[Y2:%.*]] = move_value [lexical] [var_decl] [[Y_B_C]] // CHECK: [[Y2_B:%.*]] = begin_borrow [[Y2]] // CHECK: [[Y2_B_C:%.*]] = copy_value [[Y2_B]] -// CHECK: [[ACTOR:%.*]] = enum $Optional, #Optional.none!enumelt +// CHECK: [[ACTOR_CAST:%.*]] = unchecked_value_cast [[ACTOR]] to $Builtin.ImplicitIsolationActor // CHECK: [[Y2_B_C_B:%.*]] = begin_borrow [[Y2_B_C]] -// CHECK: apply [[Y2_B_C_B]]([[ACTOR]]) +// CHECK: apply [[Y2_B_C_B]]([[ACTOR_CAST]]) // CHECK: } // end sil function '$s21attr_execution_silgen24testCallerLocalVariablesyyyyYaYCcYaF' public func testCallerLocalVariables(_ x: nonisolated(nonsending) @escaping () async -> ()) async { let y: nonisolated(nonsending) () async -> () = x @@ -186,15 +189,15 @@ public func testConcurrentLocalVariables(_ x: @escaping @concurrent () async -> await y2() } -// CHECK-LABEL: sil [ossa] @$s21attr_execution_silgen34testCallerConcurrentLocalVariablesyyyyYaYCcYaF : $@convention(thin) @async (@guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> ()) -> () { -// CHECK: bb0([[PARAM:%.*]] : @guaranteed $@async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> ()): +// CHECK-LABEL: sil [ossa] @$s21attr_execution_silgen34testCallerConcurrentLocalVariablesyyyyYaYCcYaF : $@convention(thin) @async (@guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> ()) -> () { +// CHECK: bb0([[PARAM:%.*]] : @guaranteed $@async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> ()): // CHECK: [[PARAM_COPY:%.*]] = copy_value [[PARAM]] -// CHECK: [[THUNK_1:%.*]] = function_ref @$sScA_pSgIegHgIL_IegH_TR : $@convention(thin) @async (@guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> ()) -> () +// CHECK: [[THUNK_1:%.*]] = function_ref @$sBAIegHgIL_IegH_TR : $@convention(thin) @async (@guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> ()) -> () // CHECK: [[PA:%.*]] = partial_apply [callee_guaranteed] [[THUNK_1]]([[PARAM_COPY]]) // CHECK: [[Y:%.*]] = move_value [lexical] [var_decl] [[PA]] // CHECK: [[Y_B:%.*]] = begin_borrow [[Y]] // CHECK: [[Y_B_C:%.*]] = copy_value [[Y_B]] -// CHECK: [[THUNK_2:%.*]] = function_ref @$sIegH_ScA_pSgIegHgIL_TR : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed @async @callee_guaranteed () -> ()) -> () +// CHECK: [[THUNK_2:%.*]] = function_ref @$sIegH_BAIegHgIL_TR : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed @async @callee_guaranteed () -> ()) -> () // CHECK: [[PA_2:%.*]] = partial_apply [callee_guaranteed] [[THUNK_2]]([[Y_B_C]]) // CHECK: } // end sil function '$s21attr_execution_silgen34testCallerConcurrentLocalVariablesyyyyYaYCcYaF' public func testCallerConcurrentLocalVariables(_ x: nonisolated(nonsending) @escaping () async -> ()) async { @@ -206,12 +209,12 @@ public func testCallerConcurrentLocalVariables(_ x: nonisolated(nonsending) @esc // CHECK-LABEL: sil [ossa] @$s21attr_execution_silgen34testConcurrentCallerLocalVariablesyyyyYacYaF : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> () { // CHECK: bb0([[PARAM:%.*]] : @guaranteed $@async @callee_guaranteed () -> ()): // CHECK: [[PARAM_C:%.*]] = copy_value [[PARAM]] -// CHECK: [[THUNK_1:%.*]] = function_ref @$sIegH_ScA_pSgIegHgIL_TR : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed @async @callee_guaranteed () -> ()) -> () +// CHECK: [[THUNK_1:%.*]] = function_ref @$sIegH_BAIegHgIL_TR : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed @async @callee_guaranteed () -> ()) -> () // CHECK: [[PA:%.*]] = partial_apply [callee_guaranteed] [[THUNK_1]]([[PARAM_C]]) // CHECK: [[Y:%.*]] = move_value [lexical] [var_decl] [[PA]] // CHECK: [[Y_B:%.*]] = begin_borrow [[Y]] // CHECK: [[Y_B_C:%.*]] = copy_value [[Y_B]] -// CHECK: [[THUNK_2:%.*]] = function_ref @$sScA_pSgIegHgIL_IegH_TR : $@convention(thin) @async (@guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> ()) -> () +// CHECK: [[THUNK_2:%.*]] = function_ref @$sBAIegHgIL_IegH_TR : $@convention(thin) @async (@guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> ()) -> () // CHECK: [[PA_2:%.*]] = partial_apply [callee_guaranteed] [[THUNK_2]]([[Y_B_C]]) // CHECK: } // end sil function '$s21attr_execution_silgen34testConcurrentCallerLocalVariablesyyyyYacYaF' public func testConcurrentCallerLocalVariables(_ x: @escaping @concurrent () async -> ()) async { @@ -220,13 +223,13 @@ public func testConcurrentCallerLocalVariables(_ x: @escaping @concurrent () asy await y2() } -// CHECK-LABEL: sil hidden [ossa] @$s21attr_execution_silgen22globalActorConversionsyyyyYac_yyYaYCctYaF : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> (), @guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> ()) -> () { -// CHECK: bb0([[X:%.*]] : @guaranteed $@async @callee_guaranteed () -> (), [[Y:%.*]] : @guaranteed $@async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> ()): -// CHECK: [[GLOBAL_CALLER_FUNC:%.*]] = function_ref @$s21attr_execution_silgen16globalCallerFuncyyYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> () -// FIVE: [[TTFI:%.*]] = thin_to_thick_function [[GLOBAL_CALLER_FUNC]] to $@async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> () -// FIVE: [[THUNK:%.*]] = function_ref @$sScA_pSgIegHgIL_IegH_TRScMTU : $@convention(thin) @async (@guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> ()) -> () +// CHECK-LABEL: sil hidden [ossa] @$s21attr_execution_silgen22globalActorConversionsyyyyYac_yyYaYCctYaF : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> (), @guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> ()) -> () { +// CHECK: bb0([[X:%.*]] : @guaranteed $@async @callee_guaranteed () -> (), [[Y:%.*]] : @guaranteed $@async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> ()): +// CHECK: [[GLOBAL_CALLER_FUNC:%.*]] = function_ref @$s21attr_execution_silgen16globalCallerFuncyyYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> () +// FIVE: [[TTFI:%.*]] = thin_to_thick_function [[GLOBAL_CALLER_FUNC]] to $@async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> () +// FIVE: [[THUNK:%.*]] = function_ref @$sBAIegHgIL_IegH_TRScMTU : $@convention(thin) @async (@guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> ()) -> () // FIVE: [[PA:%.*]] = partial_apply [callee_guaranteed] [[THUNK]]([[TTFI]]) : -// SIX: [[THUNK:%.*]] = function_ref @$sScA_pSgIetHgIL_IeghH_TRScMTU : $@convention(thin) @Sendable @async (@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> ()) -> () +// SIX: [[THUNK:%.*]] = function_ref @$sBAIetHgIL_IeghH_TRScMTU : $@convention(thin) @Sendable @async (@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> ()) -> () // SIX: [[PA:%.*]] = partial_apply [callee_guaranteed] [[THUNK]]([[GLOBAL_CALLER_FUNC]]) : // CHECK: [[V1:%.*]] = move_value [lexical] [var_decl] [[PA]] // CHECK: [[V1_B:%.*]] = begin_borrow [[V1]] @@ -253,7 +256,7 @@ public func testConcurrentCallerLocalVariables(_ x: @escaping @concurrent () asy // FIVE: apply [[V3_B_C_B]]() // FIVE: [[Y_C:%.*]] = copy_value [[Y]] -// FIVE: [[THUNK:%.*]] = function_ref @$sScA_pSgIegHgIL_IegH_TRScMTU : $@convention(thin) @async (@guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> ()) -> () +// FIVE: [[THUNK:%.*]] = function_ref @$sBAIegHgIL_IegH_TRScMTU : $@convention(thin) @async (@guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> ()) -> () // FIVE: [[PA:%.*]] = partial_apply [callee_guaranteed] [[THUNK]]([[Y_C]]) // FIVE: [[V4:%.*]] = move_value [lexical] [var_decl] [[PA]] // FIVE: [[V4_B:%.*]] = begin_borrow [[V4]] @@ -263,14 +266,16 @@ public func testConcurrentCallerLocalVariables(_ x: @escaping @concurrent () asy // CHECK: } // end sil function '$s21attr_execution_silgen22globalActorConversionsyyyyYac_yyYaYCctYaF' -// SIX-LABEL: sil shared [transparent] [serialized] [reabstraction_thunk] [ossa] @$sScA_pSgIetHgIL_IeghH_TRScMTU : $@convention(thin) @Sendable @async (@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> ()) -> () { +// SIX-LABEL: sil shared [transparent] [serialized] [reabstraction_thunk] [ossa] @$sBAIetHgIL_IeghH_TRScMTU : $@convention(thin) @Sendable @async (@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> ()) -> () { // SIX: bb0([[FUNC:%.*]] : $@convention(thin) @async (@sil_isolated // SIX: [[ACTOR:%.*]] = apply {{%.*}}({{%.*}}) : $@convention(method) (@thick MainActor.Type) -> @owned MainActor // SIX: [[E:%.*]] = init_existential_ref [[ACTOR]] : $MainActor : $MainActor, $any Actor // SIX: [[E_OPT:%.*]] = enum $Optional, #Optional.some!enumelt, [[E]] // SIX: hop_to_executor [[E_OPT]] -// SIX: apply [[FUNC]]([[E_OPT]]) : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> () -// SIX: } // end sil function '$sScA_pSgIetHgIL_IeghH_TRScMTU' +// SIX: [[E_OPT_B:%.*]] = begin_borrow [[E_OPT]] +// SIX: [[E_OPT_B_CAST:%.*]] = unchecked_value_cast [[E_OPT_B]] to $Builtin.ImplicitIsolationActor +// SIX: apply [[FUNC]]([[E_OPT_B_CAST]]) : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> () +// SIX: } // end sil function '$sBAIetHgIL_IeghH_TRScMTU' func globalActorConversions(_ x: @escaping @concurrent () async -> (), _ y: nonisolated(nonsending) @escaping () async -> ()) async { @@ -289,13 +294,13 @@ func globalActorConversions(_ x: @escaping @concurrent () async -> (), #endif } -// CHECK-LABEL: sil hidden [ossa] @$s21attr_execution_silgen23globalActorConversions2yyyAA13SendableKlassCYac_yADYaYCctYaF : $@convention(thin) @async (@guaranteed @async @callee_guaranteed (@guaranteed SendableKlass) -> (), @guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed SendableKlass) -> ()) -> () { -// CHECK: bb0([[X:%.*]] : @guaranteed $@async @callee_guaranteed (@guaranteed SendableKlass) -> (), [[Y:%.*]] : @guaranteed $@async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed SendableKlass) -> ()): -// CHECK: [[GLOBAL_CALLER_FUNC:%.*]] = function_ref @$s21attr_execution_silgen29globalCallerFuncSendableKlassyyAA0gH0CYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed SendableKlass) -> () -// FIVE: [[TTFI:%.*]] = thin_to_thick_function [[GLOBAL_CALLER_FUNC]] to $@async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed SendableKlass) -> () -// FIVE: [[THUNK:%.*]] = function_ref @$sScA_pSg21attr_execution_silgen13SendableKlassCIegHgILg_ADIegHg_TRScMTU : $@convention(thin) @async (@guaranteed SendableKlass, @guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed SendableKlass) -> ()) -> () +// CHECK-LABEL: sil hidden [ossa] @$s21attr_execution_silgen23globalActorConversions2yyyAA13SendableKlassCYac_yADYaYCctYaF : $@convention(thin) @async (@guaranteed @async @callee_guaranteed (@guaranteed SendableKlass) -> (), @guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed SendableKlass) -> ()) -> () { +// CHECK: bb0([[X:%.*]] : @guaranteed $@async @callee_guaranteed (@guaranteed SendableKlass) -> (), [[Y:%.*]] : @guaranteed $@async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed SendableKlass) -> ()): +// CHECK: [[GLOBAL_CALLER_FUNC:%.*]] = function_ref @$s21attr_execution_silgen29globalCallerFuncSendableKlassyyAA0gH0CYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed SendableKlass) -> () +// FIVE: [[TTFI:%.*]] = thin_to_thick_function [[GLOBAL_CALLER_FUNC]] to $@async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed SendableKlass) -> () +// FIVE: [[THUNK:%.*]] = function_ref @$sBA21attr_execution_silgen13SendableKlassCIegHgILg_ACIegHg_TRScMTU : $@convention(thin) @async (@guaranteed SendableKlass, @guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed SendableKlass) -> ()) -> () // FIVE: [[PA:%.*]] = partial_apply [callee_guaranteed] [[THUNK]]([[TTFI]]) : -// SIX: [[THUNK:%.*]] = function_ref @$sScA_pSg21attr_execution_silgen13SendableKlassCIetHgILg_ADIeghHg_TRScMTU : $@convention(thin) @Sendable @async (@guaranteed SendableKlass, @convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed SendableKlass) -> ()) -> () +// SIX: [[THUNK:%.*]] = function_ref @$sBA21attr_execution_silgen13SendableKlassCIetHgILg_ACIeghHg_TRScMTU : $@convention(thin) @Sendable @async (@guaranteed SendableKlass, @convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed SendableKlass) -> ()) -> () // SIX: [[PA:%.*]] = partial_apply [callee_guaranteed] [[THUNK]]([[GLOBAL_CALLER_FUNC]]) : // CHECK: [[V1:%.*]] = move_value [lexical] [var_decl] [[PA]] // CHECK: [[V1_B:%.*]] = begin_borrow [[V1]] @@ -322,7 +327,7 @@ func globalActorConversions(_ x: @escaping @concurrent () async -> (), // FIVE: apply [[V3_B_C_B]]({{%.*}}) // FIVE: [[Y_C:%.*]] = copy_value [[Y]] -// FIVE: [[THUNK:%.*]] = function_ref @$sScA_pSg21attr_execution_silgen13SendableKlassCIegHgILg_ADIegHg_TRScMTU : $@convention(thin) @async (@guaranteed SendableKlass, @guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed SendableKlass) -> ()) -> () +// FIVE: [[THUNK:%.*]] = function_ref @$sBA21attr_execution_silgen13SendableKlassCIegHgILg_ACIegHg_TRScMTU : $@convention(thin) @async (@guaranteed SendableKlass, @guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed SendableKlass) -> ()) -> () // FIVE: [[PA:%.*]] = partial_apply [callee_guaranteed] [[THUNK]]([[Y_C]]) // FIVE: [[V4:%.*]] = move_value [lexical] [var_decl] [[PA]] // FIVE: [[V4_B:%.*]] = begin_borrow [[V4]] @@ -332,30 +337,35 @@ func globalActorConversions(_ x: @escaping @concurrent () async -> (), // CHECK: } // end sil function '$s21attr_execution_silgen23globalActorConversions2yyyAA13SendableKlassCYac_yADYaYCctYaF' -// FIVE-LABEL: sil shared [transparent] [serialized] [reabstraction_thunk] [ossa] @$sScA_pSg21attr_execution_silgen13SendableKlassCIegHgILg_ADIegHg_TRScMTU : $@convention(thin) @async (@guaranteed SendableKlass, @guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed SendableKlass) -> ()) -> () { +// FIVE-LABEL: sil shared [transparent] [serialized] [reabstraction_thunk] [ossa] @$sBA21attr_execution_silgen13SendableKlassCIegHgILg_ACIegHg_TRScMTU : $@convention(thin) @async (@guaranteed SendableKlass, @guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed SendableKlass) -> ()) -> () { // FIVE: bb0([[ARG:%.*]] : @guaranteed $SendableKlass, [[FUNC:%.*]] : @guaranteed // FIVE: [[ACTOR:%.*]] = apply {{%.*}}({{%.*}}) : $@convention(method) (@thick MainActor.Type) -> @owned MainActor // FIVE: [[E:%.*]] = init_existential_ref [[ACTOR]] : $MainActor : $MainActor, $any Actor // FIVE: [[E_OPT:%.*]] = enum $Optional, #Optional.some!enumelt, [[E]] // FIVE: hop_to_executor [[E_OPT]] -// FIVE: apply [[FUNC]]([[E_OPT]], [[ARG]]) -// FIVE: } // end sil function '$sScA_pSg21attr_execution_silgen13SendableKlassCIegHgILg_ADIegHg_TRScMTU +// FIVE: [[E_OPT_B:%.*]] = begin_borrow [[E_OPT]] +// FIVE: [[E_OPT_B_CAST:%.*]] = unchecked_value_cast [[E_OPT_B]] to $Builtin.ImplicitIsolationActor +// FIVE: apply [[FUNC]]([[E_OPT_B_CAST]], [[ARG]]) +// FIVE: } // end sil function '$sBA21attr_execution_silgen13SendableKlassCIegHgILg_ACIegHg_TRScMTU' -// SIX-LABEL: sil shared [transparent] [serialized] [reabstraction_thunk] [ossa] @$sScA_pSg21attr_execution_silgen13SendableKlassCIetHgILg_ADIeghHg_TRScMTU : $@convention(thin) @Sendable @async (@guaranteed SendableKlass, @convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed SendableKlass) -> ()) -> () { -// SIX: bb0([[ARG:%.*]] : @guaranteed $SendableKlass, [[FUNC:%.*]] : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed SendableKlass) -> ()): +// SIX-LABEL: sil shared [transparent] [serialized] [reabstraction_thunk] [ossa] @$sBA21attr_execution_silgen13SendableKlassCIetHgILg_ACIeghHg_TRScMTU : $@convention(thin) @Sendable @async (@guaranteed SendableKlass, @convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed SendableKlass) -> ()) -> () { +// SIX: bb0([[ARG:%.*]] : @guaranteed $SendableKlass, [[FUNC:%.*]] : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed SendableKlass) -> ()): // SIX: [[ACTOR:%.*]] = apply {{%.*}}({{%.*}}) : $@convention(method) (@thick MainActor.Type) -> @owned MainActor // SIX: [[E:%.*]] = init_existential_ref [[ACTOR]] : $MainActor : $MainActor, $any Actor // SIX: [[E_OPT:%.*]] = enum $Optional, #Optional.some!enumelt, [[E]] // SIX: hop_to_executor [[E_OPT]] -// SIX: apply [[FUNC]]([[E_OPT]], [[ARG]]) -// SIX: // end sil function '$sScA_pSg21attr_execution_silgen13SendableKlassCIetHgILg_ADIeghHg_TRScMTU' +// SIX: [[E_OPT_B:%.*]] = begin_borrow [[E_OPT]] +// SIX: [[E_OPT_B_CAST:%.*]] = unchecked_value_cast [[E_OPT_B]] to $Builtin.ImplicitIsolationActor +// SIX: apply [[FUNC]]([[E_OPT_B_CAST]], [[ARG]]) +// SIX: } // end sil function '$sBA21attr_execution_silgen13SendableKlassCIetHgILg_ACIeghHg_TRScMTU' -// CHECK-LABEL: sil shared [transparent] [serialized] [reabstraction_thunk] [ossa] @$sScA_pSg21attr_execution_silgen13SendableKlassCIegHgILg_ADIegHg_TR : $@convention(thin) @async (@guaranteed SendableKlass, @guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed SendableKlass) -> ()) -> () { +// CHECK-LABEL: sil shared [transparent] [serialized] [reabstraction_thunk] [ossa] @$sBA21attr_execution_silgen13SendableKlassCIegHgILg_ACIegHg_TR : $@convention(thin) @async (@guaranteed SendableKlass, @guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed SendableKlass) -> ()) -> () { // CHECK: bb0([[ARG:%.*]] : @guaranteed $SendableKlass, [[FUNC:%.*]] : @guaranteed // CHECK: [[ACTOR:%.*]] = enum $Optional, #Optional.none!enumelt // CHECK: hop_to_executor [[ACTOR]] -// CHECK: apply [[FUNC]]([[ACTOR]], [[ARG]]) -// CHECK: } // end sil function '$sScA_pSg21attr_execution_silgen13SendableKlassCIegHgILg_ADIegHg_TR' +// CHECK: [[ACTOR_CAST:%.*]] = unchecked_value_cast [[ACTOR]] to $Builtin.ImplicitIsolationActor +// CHECK: apply [[FUNC]]([[ACTOR_CAST]], [[ARG]]) +// CHECK: } // end sil function '$sBA21attr_execution_silgen13SendableKlassCIegHgILg_ACIegHg_TR' func globalActorConversions2(_ x: @escaping @concurrent (SendableKlass) async -> (), _ y: nonisolated(nonsending) @escaping (SendableKlass) async -> ()) async { let v1: @MainActor (SendableKlass) async -> Void = globalCallerFuncSendableKlass @@ -372,13 +382,13 @@ func globalActorConversions2(_ x: @escaping @concurrent (SendableKlass) async -> await v5(SendableKlass()) } -// CHECK-LABEL: sil hidden [ossa] @$s21attr_execution_silgen23globalActorConversions3yyAA13SendableKlassCADYac_A2DYaYCctYaF : $@convention(thin) @async (@guaranteed @async @callee_guaranteed (@guaranteed SendableKlass) -> @owned SendableKlass, @guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed SendableKlass) -> @owned SendableKlass) -> () { -// CHECK: bb0([[X:%.*]] : @guaranteed $@async @callee_guaranteed (@guaranteed SendableKlass) -> @owned SendableKlass, [[Y:%.*]] : @guaranteed $@async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed SendableKlass) -> @owned SendableKlass): -// CHECK: [[GLOBAL_CALLER_FUNC:%.*]] = function_ref @$s21attr_execution_silgen29globalCallerFuncSendableKlassyAA0gH0CADYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed SendableKlass) -> @owned SendableKlass -// FIVE: [[TTFI:%.*]] = thin_to_thick_function [[GLOBAL_CALLER_FUNC]] to $@async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed SendableKlass) -> @owned SendableKlass -// FIVE: [[THUNK:%.*]] = function_ref @$sScA_pSg21attr_execution_silgen13SendableKlassCADIegHgILgo_A2DIegHgo_TRScMTU : $@convention(thin) @async (@guaranteed SendableKlass, @guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed SendableKlass) -> @owned SendableKlass) -> @owned SendableKlass +// CHECK-LABEL: sil hidden [ossa] @$s21attr_execution_silgen23globalActorConversions3yyAA13SendableKlassCADYac_A2DYaYCctYaF : $@convention(thin) @async (@guaranteed @async @callee_guaranteed (@guaranteed SendableKlass) -> @owned SendableKlass, @guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed SendableKlass) -> @owned SendableKlass) -> () { +// CHECK: bb0([[X:%.*]] : @guaranteed $@async @callee_guaranteed (@guaranteed SendableKlass) -> @owned SendableKlass, [[Y:%.*]] : @guaranteed $@async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed SendableKlass) -> @owned SendableKlass): +// CHECK: [[GLOBAL_CALLER_FUNC:%.*]] = function_ref @$s21attr_execution_silgen29globalCallerFuncSendableKlassyAA0gH0CADYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed SendableKlass) -> @owned SendableKlass +// FIVE: [[TTFI:%.*]] = thin_to_thick_function [[GLOBAL_CALLER_FUNC]] to $@async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed SendableKlass) -> @owned SendableKlass +// FIVE: [[THUNK:%.*]] = function_ref @$sBA21attr_execution_silgen13SendableKlassCACIegHgILgo_A2CIegHgo_TRScMTU : $@convention(thin) @async (@guaranteed SendableKlass, @guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed SendableKlass) -> @owned SendableKlass) -> @owned SendableKlass // FIVE: [[PA:%.*]] = partial_apply [callee_guaranteed] [[THUNK]]([[TTFI]]) -// SIX: [[THUNK:%.*]] = function_ref @$sScA_pSg21attr_execution_silgen13SendableKlassCADIetHgILgo_A2DIeghHgo_TRScMTU : $@convention(thin) @Sendable @async (@guaranteed SendableKlass, @convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed SendableKlass) -> @owned SendableKlass) -> @owned SendableKlass +// SIX: [[THUNK:%.*]] = function_ref @$sBA21attr_execution_silgen13SendableKlassCACIetHgILgo_A2CIeghHgo_TRScMTU : $@convention(thin) @Sendable @async (@guaranteed SendableKlass, @convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed SendableKlass) -> @owned SendableKlass) -> @owned SendableKlass // SIX: [[PA:%.*]] = partial_apply [callee_guaranteed] [[THUNK]]([[GLOBAL_CALLER_FUNC]]) // CHECK: [[V1:%.*]] = move_value [lexical] [var_decl] [[PA]] // CHECK: [[V1_B:%.*]] = begin_borrow [[V1]] @@ -404,7 +414,7 @@ func globalActorConversions2(_ x: @escaping @concurrent (SendableKlass) async -> // FIVE: apply [[V3_B_C_B]]({{%.*}}) // FIVE: [[Y_C:%.*]] = copy_value [[Y]] -// FIVE: [[THUNK:%.*]] = function_ref @$sScA_pSg21attr_execution_silgen13SendableKlassCADIegHgILgo_A2DIegHgo_TRScMTU : $@convention(thin) @async (@guaranteed SendableKlass, @guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed SendableKlass) -> @owned SendableKlass) -> @owned SendableKlass +// FIVE: [[THUNK:%.*]] = function_ref @$sBA21attr_execution_silgen13SendableKlassCACIegHgILgo_A2CIegHgo_TRScMTU : $@convention(thin) @async (@guaranteed SendableKlass, @guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed SendableKlass) -> @owned SendableKlass) -> @owned SendableKlass // FIVE: [[PA:%.*]] = partial_apply [callee_guaranteed] [[THUNK]]([[Y_C]]) // FIVE: [[V4:%.*]] = move_value [lexical] [var_decl] [[PA]] // FIVE: [[V4_B:%.*]] = begin_borrow [[V4]] @@ -413,34 +423,38 @@ func globalActorConversions2(_ x: @escaping @concurrent (SendableKlass) async -> // FIVE: apply [[V4_B_C_B]]({{%.*}}) // CHECK: [[Y_C:%.*]] = copy_value [[Y]] -// CHECK: [[THUNK:%.*]] = function_ref @$sScA_pSg21attr_execution_silgen13SendableKlassCADIegHgILgo_A2DIegHgo_TR : $@convention(thin) @async (@guaranteed SendableKlass, @guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed SendableKlass) -> @owned SendableKlass) -> @owned SendableKlass +// CHECK: [[THUNK:%.*]] = function_ref @$sBA21attr_execution_silgen13SendableKlassCACIegHgILgo_A2CIegHgo_TR : $@convention(thin) @async (@guaranteed SendableKlass, @guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed SendableKlass) -> @owned SendableKlass) -> @owned SendableKlass // CHECK: [[PA:%.*]] = partial_apply [callee_guaranteed] [[THUNK]]([[Y_C]]) // CHECK: [[V5:%.*]] = move_value [lexical] [var_decl] [[PA]] // CHECK: } // end sil function '$s21attr_execution_silgen23globalActorConversions3yyAA13SendableKlassCADYac_A2DYaYCctYaF' -// FIVE-LABEL: sil shared [transparent] [serialized] [reabstraction_thunk] [ossa] @$sScA_pSg21attr_execution_silgen13SendableKlassCADIegHgILgo_A2DIegHgo_TRScMTU : $@convention(thin) @async (@guaranteed SendableKlass, @guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed SendableKlass) -> @owned SendableKlass) -> @owned SendableKlass { +// FIVE-LABEL: sil shared [transparent] [serialized] [reabstraction_thunk] [ossa] @$sBA21attr_execution_silgen13SendableKlassCACIegHgILgo_A2CIegHgo_TRScMTU : $@convention(thin) @async (@guaranteed SendableKlass, @guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed SendableKlass) -> @owned SendableKlass) -> @owned SendableKlass { // FIVE: bb0([[ARG:%.*]] : @guaranteed $SendableKlass, [[FUNC:%.*]] : @guaranteed // FIVE: [[ACTOR:%.*]] = apply {{%.*}}({{%.*}}) : $@convention(method) (@thick MainActor.Type) -> @owned MainActor // FIVE: [[E:%.*]] = init_existential_ref [[ACTOR]] : $MainActor : $MainActor, $any Actor // FIVE: [[E_OPT:%.*]] = enum $Optional, #Optional.some!enumelt, [[E]] // FIVE: hop_to_executor [[E_OPT]] -// FIVE: apply [[FUNC]]([[E_OPT]], [[ARG]]) -// FIVE: } // end sil function '$sScA_pSg21attr_execution_silgen13SendableKlassCADIegHgILgo_A2DIegHgo_TRScMTU' +// FIVE: [[E_OPT_B:%.*]] = begin_borrow [[E_OPT]] +// FIVE: [[E_OPT_B_CAST:%.*]] = unchecked_value_cast [[E_OPT_B]] to $Builtin.ImplicitIsolationActor +// FIVE: apply [[FUNC]]([[E_OPT_B_CAST]], [[ARG]]) +// FIVE: } // end sil function '$sBA21attr_execution_silgen13SendableKlassCACIegHgILgo_A2CIegHgo_TRScMTU' -// SIX-LABEL: sil shared [transparent] [serialized] [reabstraction_thunk] [ossa] @$sScA_pSg21attr_execution_silgen13SendableKlassCADIetHgILgo_A2DIeghHgo_TRScMTU : $@convention(thin) @Sendable @async (@guaranteed SendableKlass, @convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed SendableKlass) -> @owned SendableKlass) -> @owned SendableKlass { -// SIX: bb0([[ARG:%.*]] : @guaranteed $SendableKlass, [[FUNC:%.*]] : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed SendableKlass) -> @owned SendableKlass): +// SIX-LABEL: sil shared [transparent] [serialized] [reabstraction_thunk] [ossa] @$sBA21attr_execution_silgen13SendableKlassCACIetHgILgo_A2CIeghHgo_TRScMTU : $@convention(thin) @Sendable @async (@guaranteed SendableKlass, @convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed SendableKlass) -> @owned SendableKlass) -> @owned SendableKlass { +// SIX: bb0([[ARG:%.*]] : @guaranteed $SendableKlass, [[FUNC:%.*]] : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed SendableKlass) -> @owned SendableKlass): // SIX: [[ACTOR:%.*]] = apply {{%.*}}({{%.*}}) : $@convention(method) (@thick MainActor.Type) -> @owned MainActor // SIX: [[E:%.*]] = init_existential_ref [[ACTOR]] : $MainActor : $MainActor, $any Actor // SIX: [[E_OPT:%.*]] = enum $Optional, #Optional.some!enumelt, [[E]] // SIX: hop_to_executor [[E_OPT]] -// SIX: apply [[FUNC]]([[E_OPT]], [[ARG]]) -// SIX: } // end sil function '$sScA_pSg21attr_execution_silgen13SendableKlassCADIetHgILgo_A2DIeghHgo_TRScMTU' +// SIX: [[E_OPT_B:%.*]] = begin_borrow [[E_OPT]] +// SIX: [[E_OPT_B_CAST:%.*]] = unchecked_value_cast [[E_OPT_B]] to $Builtin.ImplicitIsolationActor +// SIX: apply [[FUNC]]([[E_OPT_B_CAST]], [[ARG]]) +// SIX: } // end sil function '$sBA21attr_execution_silgen13SendableKlassCACIetHgILgo_A2CIeghHgo_TRScMTU' -// CHECK-LABEL: sil shared [transparent] [serialized] [reabstraction_thunk] [ossa] @$sScA_pSg21attr_execution_silgen13SendableKlassCADIegHgILgo_A2DIegHgo_TR : $@convention(thin) @async (@guaranteed SendableKlass, @guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed SendableKlass) -> @owned SendableKlass) -> @owned SendableKlass { +// CHECK-LABEL: sil shared [transparent] [serialized] [reabstraction_thunk] [ossa] @$sBA21attr_execution_silgen13SendableKlassCACIegHgILgo_A2CIegHgo_TR : $@convention(thin) @async (@guaranteed SendableKlass, @guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed SendableKlass) -> @owned SendableKlass) -> @owned SendableKlass { // CHECK: bb0([[ARG:%.*]] : @guaranteed $SendableKlass, [[FUNC:%.*]] : @guarantee // CHECK: [[ACTOR:%.*]] = enum $Optional, #Optional.none!enumelt // CHECK: hop_to_executor [[ACTOR]] -// CHECK: } // end sil function '$sScA_pSg21attr_execution_silgen13SendableKlassCADIegHgILgo_A2DIegHgo_TR' +// CHECK: } // end sil function '$sBA21attr_execution_silgen13SendableKlassCACIegHgILgo_A2CIegHgo_TR' func globalActorConversions3(_ x: @escaping @concurrent (SendableKlass) async -> SendableKlass, _ y: nonisolated(nonsending) @escaping (SendableKlass) async -> SendableKlass) async { let v1: @MainActor (SendableKlass) async -> SendableKlass = globalCallerFuncSendableKlass @@ -461,11 +475,11 @@ func globalActorConversions3(_ x: @escaping @concurrent (SendableKlass) async -> // CHECK: bb0([[X:%.*]] : @guaranteed $@Sendable @callee_guaranteed (@guaranteed NonSendableKlass) -> (), [[Y:%.*]] : @guaranteed $@Sendable @callee_guaranteed (@guaranteed SendableKlass) -> ()): // CHECK: [[X_C:%.*]] = copy_value [[X]] -// CHECK: [[THUNK:%.*]] = function_ref @$s21attr_execution_silgen16NonSendableKlassCIeghg_ScA_pSgACIegHgILg_TR : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed NonSendableKlass, @guaranteed @Sendable @callee_guaranteed (@guaranteed NonSendableKlass) -> ()) -> () +// CHECK: [[THUNK:%.*]] = function_ref @$s21attr_execution_silgen16NonSendableKlassCIeghg_BAACIegHgILg_TR : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed NonSendableKlass, @guaranteed @Sendable @callee_guaranteed (@guaranteed NonSendableKlass) -> ()) -> () // CHECK: [[PAI:%.*]] = partial_apply [callee_guaranteed] [[THUNK]]([[X_C]]) // CHECK: [[Y_C:%.*]] = copy_value [[Y]] -// CHECK: [[THUNK:%.*]] = function_ref @$s21attr_execution_silgen13SendableKlassCIeghg_ScA_pSgACIegHgILg_TRScMTU : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed SendableKlass, @guaranteed @Sendable @callee_guaranteed (@guaranteed SendableKlass) -> ()) -> () +// CHECK: [[THUNK:%.*]] = function_ref @$s21attr_execution_silgen13SendableKlassCIeghg_BAACIegHgILg_TRScMTU : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed SendableKlass, @guaranteed @Sendable @callee_guaranteed (@guaranteed SendableKlass) -> ()) -> () // CHECK: [[PAI:%.*]] = partial_apply [callee_guaranteed] [[THUNK]]([[Y_C]]) // CHECK: [[Y_C:%.*]] = copy_value [[Y]] @@ -474,20 +488,20 @@ func globalActorConversions3(_ x: @escaping @concurrent (SendableKlass) async -> // CHECK: } // end sil function '$s21attr_execution_silgen26conversionsFromSyncToAsyncyyyAA16NonSendableKlassCYbc_yAA0jK0CYbScMYcctYaF' -// CHECK-LABEL: sil shared [transparent] [serialized] [reabstraction_thunk] [ossa] @$s21attr_execution_silgen16NonSendableKlassCIeghg_ScA_pSgACIegHgILg_TR : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed NonSendableKlass, @guaranteed @Sendable @callee_guaranteed (@guaranteed NonSendableKlass) -> ()) -> () { -// CHECK: bb0([[ACTOR:%.*]] : @guaranteed $Optional +// CHECK-LABEL: sil shared [transparent] [serialized] [reabstraction_thunk] [ossa] @$s21attr_execution_silgen16NonSendableKlassCIeghg_BAACIegHgILg_TR : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed NonSendableKlass, @guaranteed @Sendable @callee_guaranteed (@guaranteed NonSendableKlass) -> ()) -> () { +// CHECK: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor // CHECK: apply {{%.*}}({{%.*}}) : $@Sendable @callee_guaranteed (@guaranteed NonSendableKlass) -> () // CHECK: hop_to_executor [[ACTOR]] -// CHECK: } // end sil function '$s21attr_execution_silgen16NonSendableKlassCIeghg_ScA_pSgACIegHgILg_TR' +// CHECK: } // end sil function '$s21attr_execution_silgen16NonSendableKlassCIeghg_BAACIegHgILg_TR' -// CHECK-LABEL: sil shared [transparent] [serialized] [reabstraction_thunk] [ossa] @$s21attr_execution_silgen13SendableKlassCIeghg_ScA_pSgACIegHgILg_TRScMTU : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed SendableKlass, @guaranteed @Sendable @callee_guaranteed (@guaranteed SendableKlass) -> ()) -> () { -// CHECK: bb0([[ACTOR:%.*]] : @guaranteed $Optional, [[ARG:%.*]] : @guaranteed $SendableKlass, [[FUNC:%.*]] : @guaranteed $@Sendable @callee_guaranteed +// CHECK-LABEL: sil shared [transparent] [serialized] [reabstraction_thunk] [ossa] @$s21attr_execution_silgen13SendableKlassCIeghg_BAACIegHgILg_TRScMTU : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed SendableKlass, @guaranteed @Sendable @callee_guaranteed (@guaranteed SendableKlass) -> ()) -> () { +// CHECK: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, [[ARG:%.*]] : @guaranteed $SendableKlass, [[FUNC:%.*]] : @guaranteed $@Sendable @callee_guaranteed // CHECK: [[MAIN_ACTOR:%.*]] = apply {{%.*}}({{%.*}}) : $@convention(method) (@thick MainActor.Type) -> @owned MainActor // CHECK: [[MAIN_ACTOR_B:%.*]] = begin_borrow [[MAIN_ACTOR]] // CHECK: hop_to_executor [[MAIN_ACTOR_B]] // CHECK: apply [[FUNC]]([[ARG]]) // CHECK: hop_to_executor [[ACTOR]] -// CHECK: } // end sil function '$s21attr_execution_silgen13SendableKlassCIeghg_ScA_pSgACIegHgILg_TRScMTU' +// CHECK: } // end sil function '$s21attr_execution_silgen13SendableKlassCIeghg_BAACIegHgILg_TRScMTU' // CHECK-LABEL: sil shared [transparent] [serialized] [reabstraction_thunk] [ossa] @$s21attr_execution_silgen13SendableKlassCIeghg_ACIegHg_TRScMTU : $@convention(thin) @async (@guaranteed SendableKlass, @guaranteed @Sendable @callee_guaranteed (@guaranteed SendableKlass) -> ()) -> () { // CHECK: bb0([[ARG:%.*]] : @guaranteed $SendableKlass, [[FUNC:%.*]] : @guaranteed $@Sendable @callee_guaranteed (@guaranteed SendableKlass) -> ()): @@ -506,47 +520,48 @@ func conversionsFromSyncToAsync(_ x: @escaping @Sendable (NonSendableKlass) -> V } func testThatClosuresAssumeIsolation(fn: inout nonisolated(nonsending) (Int) async -> Void) { - // CHECK-LABEL: sil private [ossa] @$s21attr_execution_silgen31testThatClosuresAssumeIsolation2fnyySiYaYCcz_tFyyYaYCcfU_ : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> () { - // CHECK: bb0([[EXECUTOR:%.*]] : @guaranteed $Optional): + // CHECK-LABEL: sil private [ossa] @$s21attr_execution_silgen31testThatClosuresAssumeIsolation2fnyySiYaYCcz_tFyyYaYCcfU_ : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> () { + // CHECK: bb0([[EXECUTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor): // CHECK: hop_to_executor [[EXECUTOR]] let _: nonisolated(nonsending) () async -> Void = { - 42 + _ = 42 } func testParam(_: nonisolated(nonsending) () async throws -> Void) {} - // CHECK-LABEL: sil private [ossa] @$s21attr_execution_silgen31testThatClosuresAssumeIsolation2fnyySiYaYCcz_tFyyYaYCXEfU0_ : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> @error any Error { - // CHECK: bb0([[EXECUTOR:%.*]] : @guaranteed $Optional): + // CHECK-LABEL: sil private [ossa] @$s21attr_execution_silgen31testThatClosuresAssumeIsolation2fnyySiYaYCcz_tFyyYaYCXEfU0_ : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> @error any Error { + // CHECK: bb0([[EXECUTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor): // CHECK: hop_to_executor [[EXECUTOR]] // CHECK: } // end sil function '$s21attr_execution_silgen31testThatClosuresAssumeIsolation2fnyySiYaYCcz_tFyyYaYCXEfU0_' - testParam { 42 } + testParam { _ = 42 } // CHECK-LABEL: sil private [ossa] @$s21attr_execution_silgen31testThatClosuresAssumeIsolation2fnyySiYaYCcz_tFyyYaXEfU1_ : $@convention(thin) @async () -> () - // CHECK: [[GENERIC_EXECUTOR:%.*]] = enum $Optional, #Optional.none!enumelt + // CHECK: [[GENERIC_EXECUTOR:%.*]] = enum $Optional, #Optional.none!enumelt // CHECK: hop_to_executor [[GENERIC_EXECUTOR]] - testParam { @concurrent in 42 } + // CHECK: } // end sil function '$s21attr_execution_silgen31testThatClosuresAssumeIsolation2fnyySiYaYCcz_tFyyYaXEfU1_' + testParam { @concurrent in _ = 42 } - // CHECK-LABEL: sil shared [transparent] [serialized] [reabstraction_thunk] [ossa] @$sIgH_ScA_pSgs5Error_pIegHgILzo_TR : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed @noescape @async @callee_guaranteed () -> ()) -> @error any Error { - // CHECK: bb0([[ACTOR:%.*]] : @guaranteed $Optional, [[FUNC:%.*]] : @guaranteed $@noescape @async @callee_guaranteed () -> ()): + // CHECK-LABEL: sil shared [transparent] [serialized] [reabstraction_thunk] [ossa] @$sIgH_BAs5Error_pIegHgILzo_TR : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed @noescape @async @callee_guaranteed () -> ()) -> @error any Error { + // CHECK: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, [[FUNC:%.*]] : @guaranteed $@noescape @async @callee_guaranteed () -> ()): // CHECK: apply [[FUNC]]() // CHECK: hop_to_executor [[ACTOR]] - // CHECK: } // end sil function '$sIgH_ScA_pSgs5Error_pIegHgILzo_TR' + // CHECK: } // end sil function '$sIgH_BAs5Error_pIegHgILzo_TR' - // CHECK-LABEL: sil private [ossa] @$s21attr_execution_silgen31testThatClosuresAssumeIsolation2fnyySiYaYCcz_tFySiYaYCcfU2_ : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, Int) -> () { - // CHECK: bb0([[EXECUTOR:%.*]] : @guaranteed $Optional, %1 : $Int): + // CHECK-LABEL: sil private [ossa] @$s21attr_execution_silgen31testThatClosuresAssumeIsolation2fnyySiYaYCcz_tFySiYaYCcfU2_ : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, Int) -> () { + // CHECK: bb0([[EXECUTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, %1 : $Int): // CHECK: hop_to_executor [[EXECUTOR]] fn = { _ in } // CHECK-LABEL: sil private [ossa] @$s21attr_execution_silgen31testThatClosuresAssumeIsolation2fnyySiYaYCcz_tFySiYacfU3_ : $@convention(thin) @async (Int) -> () - // CHECK: [[GENERIC_EXECUTOR:%.*]] = enum $Optional, #Optional.none!enumelt + // CHECK: [[GENERIC_EXECUTOR:%.*]] = enum $Optional, #Optional.none!enumelt // CHECK: hop_to_executor [[GENERIC_EXECUTOR]] // CHECK: } // end sil function '$s21attr_execution_silgen31testThatClosuresAssumeIsolation2fnyySiYaYCcz_tFySiYacfU3_' - // CHECK-LABEL: sil shared [transparent] [serialized] [reabstraction_thunk] [ossa] @$sSiIegHy_ScA_pSgSiIegHgILy_TR : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, Int, @guaranteed @async @callee_guaranteed (Int) -> ()) -> () { - // CHECK: bb0([[ACTOR:%.*]] : @guaranteed $Optional, [[ARG:%.*]] : $Int, [[FUNC:%.*]] : @guaranteed $@async @callee_guaranteed (Int) -> ()): + // CHECK-LABEL: sil shared [transparent] [serialized] [reabstraction_thunk] [ossa] @$sSiIegHy_BASiIegHgILy_TR : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, Int, @guaranteed @async @callee_guaranteed (Int) -> ()) -> () { + // CHECK: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, [[ARG:%.*]] : $Int, [[FUNC:%.*]] : @guaranteed $@async @callee_guaranteed (Int) -> ()): // CHECK: apply [[FUNC]]([[ARG]]) // CHECK: hop_to_executor [[ACTOR]] - // CHECK: } // end sil function '$sSiIegHy_ScA_pSgSiIegHgILy_TR' + // CHECK: } // end sil function '$sSiIegHy_BASiIegHgILy_TR' fn = { @concurrent _ in } } @@ -556,8 +571,8 @@ func testNoIsolationTransfer() { // CHECK-LABEL: sil private [ossa] @$s21attr_execution_silgen23testNoIsolationTransferyyF0D7ErasureL_yyyyYaYAcF : $@convention(thin) (@guaranteed @isolated(any) @async @callee_guaranteed () -> ()) -> () func testErasure(@_inheritActorContext _: @escaping @isolated(any) () async -> Void) {} - // CHECK-LABEL: sil private [ossa] @$s21attr_execution_silgen23testNoIsolationTransferyyFyyYacfU_ : $@convention(thin) @async (@guaranteed Optional) -> () - // CHECK: [[GENERIC_EXECUTOR:%.*]] = enum $Optional, #Optional.none!enumelt + // CHECK-LABEL: sil private [ossa] @$s21attr_execution_silgen23testNoIsolationTransferyyFyyYacfU_ : $@convention(thin) @async (@guaranteed Optional) -> () { + // CHECK: [[GENERIC_EXECUTOR:%.*]] = enum $Optional, #Optional.none!enumelt // CHECK: hop_to_executor [[GENERIC_EXECUTOR]] testErasure { @concurrent in } } @@ -566,7 +581,7 @@ func testClosuresDontAssumeGlobalActorWithMarkedAsConcurrent() { func test(_ fn: @MainActor () async -> Void) {} // CHECK-LABEL: sil private [ossa] @$s21attr_execution_silgen55testClosuresDontAssumeGlobalActorWithMarkedAsConcurrentyyFyyYaYbXEfU_ - // CHECK: [[GENERIC_EXECUTOR:%.*]] = enum $Optional, #Optional.none!enumelt + // CHECK: [[GENERIC_EXECUTOR:%.*]] = enum $Optional, #Optional.none!enumelt // CHECK-NEXT: hop_to_executor [[GENERIC_EXECUTOR]] // CHECK: } // end sil function '$s21attr_execution_silgen55testClosuresDontAssumeGlobalActorWithMarkedAsConcurrentyyFyyYaYbXEfU_' test { @Sendable @concurrent in @@ -591,15 +606,16 @@ func testConvertToThrowing(isolation: isolated (any Actor)? = #isolation) async // CHECK-NEXT: hop_to_executor [[ACTOR_BORROW]] // CHECK: [[CLOSURE:%.*]] = function_ref @$s21attr_execution_silgen21testConvertToThrowing9isolationyScA_pSgYi_tYaFyyYaYCXEfU_ : // CHECK-NEXT: [[CLOSURE_VALUE:%.*]] = thin_to_thick_function [[CLOSURE]] to + // CHECK-NEXT: [[ACTOR_BORROW_CAST:%.*]] = unchecked_value_cast [[ACTOR_BORROW]] // CHECK-NEXT: // function_ref // CHECK-NEXT: [[FN:%.*]] = function_ref - // CHECK-NEXT: try_apply [[FN]]<()>({{%.*}}, {{%.*}}, [[CLOSURE_VALUE]]) {{.*}}, normal bb1, error bb2 + // CHECK-NEXT: try_apply [[FN]]<()>({{%.*}}, [[ACTOR_BORROW_CAST]], [[CLOSURE_VALUE]]) {{.*}}, normal bb1, error bb2 // CHECK: bb1( // This hop is unnecessary because nonisolated(nonsending) should // preserve isolation on return. // CHECK-NEXT: hop_to_executor [[ACTOR_BORROW]] - // CHECK-LABEL: sil private [ossa] @$s21attr_execution_silgen21testConvertToThrowing9isolationyScA_pSgYi_tYaFyyYaYCXEfU_ : $@convention(thin) @async @substituted <τ_0_0> (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> (@out τ_0_0, @error any Error) for <()> + // CHECK-LABEL: sil private [ossa] @$s21attr_execution_silgen21testConvertToThrowing9isolationyScA_pSgYi_tYaFyyYaYCXEfU_ : $@convention(thin) @async @substituted <τ_0_0> (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> (@out τ_0_0, @error any Error) for <()> // CHECK: bb0( // CHECK-NEXT: debug_value // This hop is unnecessary because nonisolated(nonsending) should diff --git a/test/Concurrency/attr_execution/initializer.swift b/test/Concurrency/attr_execution/initializer.swift index 274492c95d453..4c80b57f319f5 100644 --- a/test/Concurrency/attr_execution/initializer.swift +++ b/test/Concurrency/attr_execution/initializer.swift @@ -7,8 +7,8 @@ // include type checker errors so we can test the SIL part of the pipeline. Put type checker errors into // async_initializer.swift. -// CHECK-LABEL: sil hidden [ossa] @$s11initializer1fyyYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> () { -// CHECK: bb0([[ACTOR:%.*]] : @guaranteed $Optional): +// CHECK-LABEL: sil hidden [ossa] @$s11initializer1fyyYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> () { +// CHECK: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor): // CHECK: hop_to_executor [[ACTOR]] // CHECK: } // end sil function '$s11initializer1fyyYaF' func f() async {} @@ -17,15 +17,15 @@ func g() {} class Fruit { // Fruit.__allocating_init() // Isolation: caller_isolation_inheriting - // CHECK-LABEL: sil hidden [exact_self_class] [ossa] @$s11initializer5FruitCACyYacfC : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @thick Fruit.Type) -> @owned Fruit { - // CHECK: bb0([[ACTOR:%.*]] : @guaranteed $Optional + // CHECK-LABEL: sil hidden [exact_self_class] [ossa] @$s11initializer5FruitCACyYacfC : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @thick Fruit.Type) -> @owned Fruit { + // CHECK: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor // CHECK: hop_to_executor [[ACTOR]] // CHECK: } // end sil function '$s11initializer5FruitCACyYacfC' // Fruit.init() // Isolation: caller_isolation_inheriting - // CHECK-LABEL: sil hidden [ossa] @$s11initializer5FruitCACyYacfc : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @owned Fruit) -> @owned Fruit { - // CHECK: bb0([[ARG:%.*]] : @guaranteed $Optional, + // CHECK-LABEL: sil hidden [ossa] @$s11initializer5FruitCACyYacfc : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @owned Fruit) -> @owned Fruit { + // CHECK: bb0([[ARG:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, // CHECK: hop_to_executor [[ARG]] // CHECK: } // end sil function '$s11initializer5FruitCACyYacfc' init() async {} @@ -60,15 +60,15 @@ class Banana: Fruit { // Banana.__allocating_init() // Isolation: caller_isolation_inheriting - // CHECK-LABEL: sil hidden [exact_self_class] [ossa] @$s11initializer6BananaCACyYacfC : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @thick Banana.Type) -> @owned Banana { - // CHECK: bb0([[ACTOR:%.*]] : @guaranteed $Optional, + // CHECK-LABEL: sil hidden [exact_self_class] [ossa] @$s11initializer6BananaCACyYacfC : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @thick Banana.Type) -> @owned Banana { + // CHECK: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, // CHECK: hop_to_executor [[ACTOR]] // CHECK: } // end sil function '$s11initializer6BananaCACyYacfC' // Banana.init() // Isolation: caller_isolation_inheriting - // CHECK-LABEL: sil hidden [ossa] @$s11initializer6BananaCACyYacfc : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @owned Banana) -> @owned Banana { - // CHECK: bb0([[ACTOR:%.*]] : @guaranteed $Optional, + // CHECK-LABEL: sil hidden [ossa] @$s11initializer6BananaCACyYacfc : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @owned Banana) -> @owned Banana { + // CHECK: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, // CHECK: hop_to_executor [[ACTOR]] // CHECK: } // end sil function '$s11initializer6BananaCACyYacfc' override init() async { @@ -80,17 +80,17 @@ class MyType { // MyType.__allocating_init(_:) // Isolation: caller_isolation_inheriting // - // CHECK-LABEL: sil hidden [exact_self_class] [ossa] @$s11initializer6MyTypeCyACyyYaYCXEYacfC : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed @noescape @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> (), @thick MyType.Type) -> @owned MyType { - // CHECK: bb0([[ACTOR:%.*]] : @guaranteed $Optional, [[ARG:%.*]] : @guaranteed $@noescape @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> () + // CHECK-LABEL: sil hidden [exact_self_class] [ossa] @$s11initializer6MyTypeCyACyyYaYCXEYacfC : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed @noescape @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> (), @thick MyType.Type) -> @owned MyType { + // CHECK: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, [[ARG:%.*]] : @guaranteed $@noescape @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> () // CHECK: hop_to_executor [[ACTOR]] - // CHECK: [[FUNC:%.*]] = function_ref @$s11initializer6MyTypeCyACyyYaYCXEYacfc : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed @noescape @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> (), @owned MyType) -> @owned MyType + // CHECK: [[FUNC:%.*]] = function_ref @$s11initializer6MyTypeCyACyyYaYCXEYacfc : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed @noescape @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> (), @owned MyType) -> @owned MyType // CHECK: apply [[FUNC]]([[ACTOR]], [[ARG]], {{%.*}}) : // CHECK: } // end sil function '$s11initializer6MyTypeCyACyyYaYCXEYacfC' // MyType.init(_:) // Isolation: caller_isolation_inheriting - // CHECK-LABEL: sil hidden [ossa] @$s11initializer6MyTypeCyACyyYaYCXEYacfc : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed @noescape @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> (), @owned MyType) -> @owned MyType { - // CHECK: bb0([[ACTOR:%.*]] : @guaranteed $Optional, [[ARG:%.*]] : @guaranteed $@noescape @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> (), [[SELF:%.*]] : @owned $MyType): + // CHECK-LABEL: sil hidden [ossa] @$s11initializer6MyTypeCyACyyYaYCXEYacfc : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed @noescape @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> (), @owned MyType) -> @owned MyType { + // CHECK: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, [[ARG:%.*]] : @guaranteed $@noescape @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> (), [[SELF:%.*]] : @owned $MyType): // CHECK: hop_to_executor [[ACTOR]] // CHECK: [[ARG_C:%.*]] = copy_value [[ARG]] // CHECK: [[ARG_B:%.*]] = begin_borrow [[ARG_C]] @@ -102,10 +102,10 @@ class MyType { } } -// CHECK-LABEL: sil hidden [ossa] @$s11initializer4beepyyYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> () { -// CHECK: bb0([[ACTOR:%.*]] : @guaranteed $Optional): +// CHECK-LABEL: sil hidden [ossa] @$s11initializer4beepyyYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> () { +// CHECK: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor): // CHECK: hop_to_executor [[ACTOR]] -// CHECK: [[FUNC:%.*]] = function_ref @$s11initializer6MyTypeCyACyyYaYCXEYacfC : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed @noescape @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> (), @thick MyType.Type) -> @owned MyType +// CHECK: [[FUNC:%.*]] = function_ref @$s11initializer6MyTypeCyACyyYaYCXEYacfC : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed @noescape @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> (), @thick MyType.Type) -> @owned MyType // CHECK: apply [[FUNC]]([[ACTOR]], {{%.*}}, {{%.*}}) // CHECK: hop_to_executor [[ACTOR]] // CHECK: hop_to_executor [[ACTOR]] @@ -116,9 +116,9 @@ func beep() async { } // thunk for @escaping @callee_guaranteed () -> () -// CHECK-LABEL: sil shared [transparent] [serialized] [reabstraction_thunk] [ossa] @$sIeg_ScA_pSgIegHgIL_TR : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed @callee_guaranteed () -> ()) -> () { +// CHECK-LABEL: sil shared [transparent] [serialized] [reabstraction_thunk] [ossa] @$sIeg_BAIegHgIL_TR : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed @callee_guaranteed () -> ()) -> () { // CHECK: hop_to_executor -// CHECK: } // end sil function '$sIeg_ScA_pSgIegHgIL_TR' +// CHECK: } // end sil function '$sIeg_BAIegHgIL_TR' actor A { // CHECK-LABEL: sil hidden [ossa] @$s11initializer1ACACyYacfc : $@convention(method) @async (@sil_isolated @owned A) -> @owned A { @@ -140,8 +140,8 @@ protocol AsyncDefaultConstructable { struct Location { var x : Int var y : Int - // CHECK-LABEL: sil hidden [ossa] @$s11initializer8LocationVACyYacfC : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @thin Location.Type) -> Location { - // CHECK: bb0([[ACTOR:%.*]] : @guaranteed $Optional, + // CHECK-LABEL: sil hidden [ossa] @$s11initializer8LocationVACyYacfC : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @thin Location.Type) -> Location { + // CHECK: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, // CHECK: hop_to_executor [[ACTOR]] // CHECK: } // end sil function '$s11initializer8LocationVACyYacfC' init() async { @@ -152,22 +152,22 @@ struct Location { extension Location: AsyncDefaultConstructable {} -// CHECK-LABEL: sil private [transparent] [thunk] [ossa] @$s11initializer8LocationVAA25AsyncDefaultConstructableA2aDPxyYacfCTW : $@convention(witness_method: AsyncDefaultConstructable) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @thick Location.Type) -> @out Location { -// CHECK: bb0([[INDIRECT_RESULT:%.*]] : $*Location, [[ACTOR:%.*]] : @guaranteed $Optional, -// CHECK: [[FUNC:%.*]] = function_ref @$s11initializer8LocationVACyYacfC : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @thin Location.Type) -> Location +// CHECK-LABEL: sil private [transparent] [thunk] [ossa] @$s11initializer8LocationVAA25AsyncDefaultConstructableA2aDPxyYacfCTW : $@convention(witness_method: AsyncDefaultConstructable) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @thick Location.Type) -> @out Location { +// CHECK: bb0([[INDIRECT_RESULT:%.*]] : $*Location, [[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, +// CHECK: [[FUNC:%.*]] = function_ref @$s11initializer8LocationVACyYacfC : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @thin Location.Type) -> Location // CHECK: apply [[FUNC]]([[ACTOR]], // CHECK: hop_to_executor [[ACTOR]] // CHECK: } // end sil function '$s11initializer8LocationVAA25AsyncDefaultConstructableA2aDPxyYacfCTW' -// CHECK-LABEL: sil hidden [exact_self_class] [ossa] @$s11initializer12ExplicitTestCACyYaKcfC : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @thick ExplicitTest.Type) -> (@owned ExplicitTest, @error any Error) { -// CHECK: bb0([[ACTOR:%.*]] : @guaranteed $Optional, +// CHECK-LABEL: sil hidden [exact_self_class] [ossa] @$s11initializer12ExplicitTestCACyYaKcfC : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @thick ExplicitTest.Type) -> (@owned ExplicitTest, @error any Error) { +// CHECK: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, // CHECK: hop_to_executor [[ACTOR]] -// CHECK: [[FUNC:%.*]] = function_ref @$s11initializer12ExplicitTestCACyYaKcfc : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @owned ExplicitTest) -> (@owned ExplicitTest, @error any Error) +// CHECK: [[FUNC:%.*]] = function_ref @$s11initializer12ExplicitTestCACyYaKcfc : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @owned ExplicitTest) -> (@owned ExplicitTest, @error any Error) // CHECK: try_apply [[FUNC]]([[ACTOR]], {{%.*}}) // CHECK: } // end sil function '$s11initializer12ExplicitTestCACyYaKcfC' -// CHECK-LABEL: sil hidden [ossa] @$s11initializer12ExplicitTestCACyYaKcfc : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @owned ExplicitTest) -> (@owned ExplicitTest, @error any Error) { -// CHECK: bb0([[ACTOR:%.*]] : @guaranteed $Optional, +// CHECK-LABEL: sil hidden [ossa] @$s11initializer12ExplicitTestCACyYaKcfc : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @owned ExplicitTest) -> (@owned ExplicitTest, @error any Error) { +// CHECK: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, // CHECK: hop_to_executor [[ACTOR]] // CHECK: } // end sil function '$s11initializer12ExplicitTestCACyYaKcfc' class ExplicitTest { diff --git a/test/Concurrency/attr_execution/nonisolated_cross_module_with_flag_enabled.swift b/test/Concurrency/attr_execution/nonisolated_cross_module_with_flag_enabled.swift index a9420fb751ed4..ded5502120339 100644 --- a/test/Concurrency/attr_execution/nonisolated_cross_module_with_flag_enabled.swift +++ b/test/Concurrency/attr_execution/nonisolated_cross_module_with_flag_enabled.swift @@ -34,8 +34,9 @@ import A // CHECK: bb0([[SELF:%.*]] : $Test): // CHECK: [[MAIN_ACTOR_EXISTENTIAL:%.*]] = init_existential_ref %4 : $MainActor : $MainActor, $any Actor // CHECK: [[ANY_ACTOR:%.*]] = enum $Optional, #Optional.some!enumelt, [[MAIN_ACTOR_EXISTENTIAL]] -// CHECK: [[TEST_METHOD:%.*]] = function_ref @$s1A4TestC4testyyYaF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed Test) -> () -// CHECK: apply [[TEST_METHOD]]([[ANY_ACTOR]], [[SELF]]) +// CHECK: [[ANY_ACTOR_CAST:%.*]] = unchecked_bitwise_cast [[ANY_ACTOR]] to $Builtin.ImplicitIsolationActor +// CHECK: [[TEST_METHOD:%.*]] = function_ref @$s1A4TestC4testyyYaF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed Test) -> () +// CHECK: apply [[TEST_METHOD]]([[ANY_ACTOR_CAST]], [[SELF]]) // CHECK: } // end sil function '$s6Client4test1ty1A4TestC_tYaF' @MainActor func test(t: Test) async { diff --git a/test/Concurrency/attr_execution/protocols_silgen.swift b/test/Concurrency/attr_execution/protocols_silgen.swift index e5c2dd440e751..7602429f37a12 100644 --- a/test/Concurrency/attr_execution/protocols_silgen.swift +++ b/test/Concurrency/attr_execution/protocols_silgen.swift @@ -19,10 +19,10 @@ protocol Q { } struct AllDefault : P { - // CHECK-LABEL: sil private [transparent] [thunk] [ossa] @$s21attr_execution_silgen10AllDefaultVAA1PA2aDP10callerTestyyYaFTW : $@convention(witness_method: P) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @in_guaranteed AllDefault) -> () { - // CHECK: bb0([[ACTOR:%.*]] : @guaranteed $Optional, [[SELF:%.*]] : $*AllDefault): + // CHECK-LABEL: sil private [transparent] [thunk] [ossa] @$s21attr_execution_silgen10AllDefaultVAA1PA2aDP10callerTestyyYaFTW : $@convention(witness_method: P) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @in_guaranteed AllDefault) -> () { + // CHECK: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, [[SELF:%.*]] : $*AllDefault): // CHECK: [[LOAD:%.*]] = load [trivial] [[SELF]] - // CHECK: [[FUNC:%.*]] = function_ref @$s21attr_execution_silgen10AllDefaultV10callerTestyyYaF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, AllDefault) -> () + // CHECK: [[FUNC:%.*]] = function_ref @$s21attr_execution_silgen10AllDefaultV10callerTestyyYaF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, AllDefault) -> () // CHECK: apply [[FUNC]]([[ACTOR]], [[LOAD]]) // CHECK: hop_to_executor [[ACTOR]] // CHECK: } // end sil function '$s21attr_execution_silgen10AllDefaultVAA1PA2aDP10callerTestyyYaFTW' @@ -46,10 +46,10 @@ struct AllDefault : P { } struct AllCaller : P { - // CHECK-LABEL: sil private [transparent] [thunk] [ossa] @$s21attr_execution_silgen9AllCallerVAA1PA2aDP10callerTestyyYaFTW : $@convention(witness_method: P) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @in_guaranteed AllCaller) -> () { - // CHECK: bb0([[ACTOR:%.*]] : @guaranteed $Optional, [[SELF:%.*]] : $*AllCaller): + // CHECK-LABEL: sil private [transparent] [thunk] [ossa] @$s21attr_execution_silgen9AllCallerVAA1PA2aDP10callerTestyyYaFTW : $@convention(witness_method: P) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @in_guaranteed AllCaller) -> () { + // CHECK: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, [[SELF:%.*]] : $*AllCaller): // CHECK: [[LOAD:%.*]] = load [trivial] [[SELF]] - // CHECK: [[FUNC:%.*]] = function_ref @$s21attr_execution_silgen9AllCallerV10callerTestyyYaF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, AllCaller) -> () + // CHECK: [[FUNC:%.*]] = function_ref @$s21attr_execution_silgen9AllCallerV10callerTestyyYaF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, AllCaller) -> () // CHECK: apply [[FUNC]]([[ACTOR]], [[LOAD]]) // CHECK: hop_to_executor [[ACTOR]] // CHECK: } // end sil function '$s21attr_execution_silgen9AllCallerVAA1PA2aDP10callerTestyyYaFTW' @@ -58,29 +58,32 @@ struct AllCaller : P { // CHECK-LABEL: sil private [transparent] [thunk] [ossa] @$s21attr_execution_silgen9AllCallerVAA1PA2aDP14concurrentTestyyYaFTW : $@convention(witness_method: P) @async (@in_guaranteed AllCaller) -> () { // CHECK: bb0([[SELF:%.*]] : $*AllCaller): // CHECK: [[LOAD:%.*]] = load [trivial] [[SELF]] - // CHECK: [[FUNC:%.*]] = function_ref @$s21attr_execution_silgen9AllCallerV14concurrentTestyyYaF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, AllCaller) -> () + // CHECK: [[FUNC:%.*]] = function_ref @$s21attr_execution_silgen9AllCallerV14concurrentTestyyYaF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, AllCaller) -> () // CHECK: [[NIL:%.*]] = enum $Optional, #Optional.none!enumelt - // CHECK: hop_to_executor [[NIL]] - // CHECK: apply [[FUNC]]([[NIL]], [[LOAD]]) + // CHECK: [[NIL_CAST:%.*]] = unchecked_value_cast [[NIL]] to $Builtin.ImplicitIsolationActor + // CHECK: hop_to_executor [[NIL_CAST]] + // CHECK: apply [[FUNC]]([[NIL_CAST]], [[LOAD]]) // CHECK: } // end sil function '$s21attr_execution_silgen9AllCallerVAA1PA2aDP14concurrentTestyyYaFTW' nonisolated(nonsending) func concurrentTest() async {} // CHECK-LABEL: sil private [transparent] [thunk] [ossa] @$s21attr_execution_silgen9AllCallerVAA1PA2aDP13mainActorTestyyYaFTW : $@convention(witness_method: P) @async (@in_guaranteed AllCaller) -> () { // CHECK: bb0([[SELF:%.*]] : $*AllCaller): // CHECK: [[LOAD:%.*]] = load [trivial] [[SELF]] - // CHECK: [[FUNC:%.*]] = function_ref @$s21attr_execution_silgen9AllCallerV13mainActorTestyyYaF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, AllCaller) -> () + // CHECK: [[FUNC:%.*]] = function_ref @$s21attr_execution_silgen9AllCallerV13mainActorTestyyYaF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, AllCaller) -> () // CHECK: [[MAIN_ACTOR:%.*]] = apply {{%.*}}({{%.*}}) : $@convention(method) (@thick MainActor.Type) -> @owned MainActor // CHECK: [[EXIS_MAIN_ACTOR:%.*]] = init_existential_ref [[MAIN_ACTOR]] // CHECK: [[OPT_MAIN_ACTOR:%.*]] = enum $Optional, #Optional.some!enumelt, [[EXIS_MAIN_ACTOR]] - // CHECK: hop_to_executor [[OPT_MAIN_ACTOR]] - // CHECK: apply [[FUNC]]([[OPT_MAIN_ACTOR]], [[LOAD]]) + // CHECK: [[OPT_MAIN_ACTOR_B:%.*]] = begin_borrow [[OPT_MAIN_ACTOR]] + // CHECK: [[OPT_MAIN_ACTOR_B_CAST:%.*]] = unchecked_value_cast [[OPT_MAIN_ACTOR_B]] to $Builtin.ImplicitIsolationActor + // CHECK: hop_to_executor [[OPT_MAIN_ACTOR_B_CAST]] + // CHECK: apply [[FUNC]]([[OPT_MAIN_ACTOR_B_CAST]], [[LOAD]]) // CHECK: } // end sil function '$s21attr_execution_silgen9AllCallerVAA1PA2aDP13mainActorTestyyYaFTW' nonisolated(nonsending) func mainActorTest() async {} } struct AllConcurrent : P { - // CHECK-LABEL: sil private [transparent] [thunk] [ossa] @$s21attr_execution_silgen13AllConcurrentVAA1PA2aDP10callerTestyyYaFTW : $@convention(witness_method: P) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @in_guaranteed AllConcurrent) -> () { - // CHECK: bb0([[ACTOR]] : @guaranteed $Optional, [[SELF:%.*]] : + // CHECK-LABEL: sil private [transparent] [thunk] [ossa] @$s21attr_execution_silgen13AllConcurrentVAA1PA2aDP10callerTestyyYaFTW : $@convention(witness_method: P) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @in_guaranteed AllConcurrent) -> () { + // CHECK: bb0([[ACTOR]] : @guaranteed $Builtin.ImplicitIsolationActor, [[SELF:%.*]] : // CHECK: [[LOAD:%.*]] = load [trivial] [[SELF]] // CHECK: [[FUNC:%.*]] = function_ref @$s21attr_execution_silgen13AllConcurrentV10callerTestyyYaF : $@convention(method) @async (AllConcurrent) -> () // CHECK: apply [[FUNC]]([[LOAD]]) @@ -106,8 +109,8 @@ struct AllConcurrent : P { } struct AllMainActor : P { - // CHECK-LABEL: sil private [transparent] [thunk] [ossa] @$s21attr_execution_silgen12AllMainActorVAA1PA2aDP10callerTestyyYaFTW : $@convention(witness_method: P) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @in_guaranteed AllMainActor) -> () { - // CHECK: bb0([[ACTOR:%.*]] : @guaranteed $Optional, [[SELF:%.*]] : + // CHECK-LABEL: sil private [transparent] [thunk] [ossa] @$s21attr_execution_silgen12AllMainActorVAA1PA2aDP10callerTestyyYaFTW : $@convention(witness_method: P) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @in_guaranteed AllMainActor) -> () { + // CHECK: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, [[SELF:%.*]] : // CHECK: [[LOAD:%.*]] = load [trivial] [[SELF]] // CHECK: [[FUNC:%.*]] = function_ref @$s21attr_execution_silgen12AllMainActorV10callerTestyyYaF : $@convention(method) @async (AllMainActor) -> () // CHECK: apply [[FUNC]]([[LOAD]]) @@ -142,8 +145,8 @@ struct TestWitnessWithStorage: Q { // CHECK-LABEL: sil hidden [ossa] @$s21attr_execution_silgen22TestWitnessWithStorageV02fnD0yyF : $@convention(method) (@guaranteed TestWitnessWithStorage) -> () func fnTest() {} - // CHECK-LABEL: sil private [transparent] [thunk] [ossa] @$s21attr_execution_silgen22TestWitnessWithStorageVAA1QA2aDP4testSSvgTW : $@convention(witness_method: Q) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @in_guaranteed TestWitnessWithStorage) -> (@owned String, @error any Error) - // CHECK: bb0([[ISOLATION:%.*]] : @guaranteed $Optional, [[SELF:%.*]] : $*TestWitnessWithStorage): + // CHECK-LABEL: sil private [transparent] [thunk] [ossa] @$s21attr_execution_silgen22TestWitnessWithStorageVAA1QA2aDP4testSSvgTW : $@convention(witness_method: Q) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @in_guaranteed TestWitnessWithStorage) -> (@owned String, @error any Error) + // CHECK: bb0([[ISOLATION:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, [[SELF:%.*]] : $*TestWitnessWithStorage): // CHECK-NEXT: [[BORROWED_SELF:%.*]] = load_borrow [[SELF]] // CHECK: [[WITNESS:%.*]] = function_ref @$s21attr_execution_silgen22TestWitnessWithStorageV4testSSvg : $@convention(method) (@guaranteed TestWitnessWithStorage) -> @owned String // CHECK-NEXT: [[RESULT:%.*]] = apply [[WITNESS]]([[BORROWED_SELF]]) : $@convention(method) (@guaranteed TestWitnessWithStorage) -> @owned String @@ -152,8 +155,8 @@ struct TestWitnessWithStorage: Q { // CHECK-NEXT: return [[RESULT]] // CHECK-NEXT: } // end sil function '$s21attr_execution_silgen22TestWitnessWithStorageVAA1QA2aDP4testSSvgTW' - // CHECK: sil private [transparent] [thunk] [ossa] @$s21attr_execution_silgen22TestWitnessWithStorageVAA1QA2aDP02fnD0yyYaFTW : $@convention(witness_method: Q) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @in_guaranteed TestWitnessWithStorage) -> () - // CHECK: bb0([[ISOLATION:%.*]] : @guaranteed $Optional, [[SELF:%.*]] : $*TestWitnessWithStorage): + // CHECK: sil private [transparent] [thunk] [ossa] @$s21attr_execution_silgen22TestWitnessWithStorageVAA1QA2aDP02fnD0yyYaFTW : $@convention(witness_method: Q) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @in_guaranteed TestWitnessWithStorage) -> () + // CHECK: bb0([[ISOLATION:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, [[SELF:%.*]] : $*TestWitnessWithStorage): // CHECK-NEXT: [[BORROWED_SELF]] = load_borrow [[SELF]] // CHECK: [[WITNESS:%.*]] = function_ref @$s21attr_execution_silgen22TestWitnessWithStorageV02fnD0yyF : $@convention(method) (@guaranteed TestWitnessWithStorage) -> () // CHECK-NEXT: {{.*}} = apply [[WITNESS]]([[BORROWED_SELF]]) : $@convention(method) (@guaranteed TestWitnessWithStorage) -> () @@ -168,8 +171,8 @@ struct TestSyncWitness: Q { // CHECK-LABEL: sil hidden [ossa] @$s21attr_execution_silgen15TestSyncWitnessV4testSSvg : $@convention(method) (TestSyncWitness) -> @owned String var test: String { "" } - // CHECK-LABEL: sil private [transparent] [thunk] [ossa] @$s21attr_execution_silgen15TestSyncWitnessVAA1QA2aDP4testSSvgTW : $@convention(witness_method: Q) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @in_guaranteed TestSyncWitness) -> (@owned String, @error any Error) - // CHECK: bb0([[ISOLATION:%.*]] : @guaranteed $Optional, [[SELF:%.*]] : $*TestSyncWitness): + // CHECK-LABEL: sil private [transparent] [thunk] [ossa] @$s21attr_execution_silgen15TestSyncWitnessVAA1QA2aDP4testSSvgTW : $@convention(witness_method: Q) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @in_guaranteed TestSyncWitness) -> (@owned String, @error any Error) + // CHECK: bb0([[ISOLATION:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, [[SELF:%.*]] : $*TestSyncWitness): // CHECK-NEXT: [[BORROWED_SELF:%.*]] = load [trivial] [[SELF]] // CHECK: [[WITNESS:%.*]] = function_ref @$s21attr_execution_silgen15TestSyncWitnessV4testSSvg : $@convention(method) (TestSyncWitness) -> @owned String // CHECK-NEXT: [[RESULT:%.*]] = apply [[WITNESS]]([[BORROWED_SELF]]) : $@convention(method) (TestSyncWitness) -> @owned String diff --git a/test/Concurrency/attr_execution/witnesses.swift b/test/Concurrency/attr_execution/witnesses.swift index 6b649f09ed8b8..1b5659cc20f9b 100644 --- a/test/Concurrency/attr_execution/witnesses.swift +++ b/test/Concurrency/attr_execution/witnesses.swift @@ -25,14 +25,18 @@ struct S: P { // CHECK-NEXT: [[MAIN_ACTOR_COPY:%.*]] = copy_value [[BORROWED_MAIN_ACTOR]] // CHECK-NEXT: [[ERASED_TO_ACTOR:%.*]] = init_existential_ref [[MAIN_ACTOR_COPY]] : $MainActor : $MainActor, $any Actor // CHECK-NEXT: [[CONTEXT_ISOLATION:%.*]] = enum $Optional, #Optional.some!enumelt, [[ERASED_TO_ACTOR]] -// CHECK-NEXT: [[PROP_WITNESS:%.*]] = witness_method $T, #P.prop!getter : (Self) -> () async -> String : $@convention(witness_method: P) @async <τ_0_0 where τ_0_0 : P> (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @in_guaranteed τ_0_0) -> @owned String -// CHECK-NEXT: {{.*}} = apply [[PROP_WITNESS]]([[CONTEXT_ISOLATION]], %0) : $@convention(witness_method: P) @async <τ_0_0 where τ_0_0 : P> (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @in_guaranteed τ_0_0) -> @owned String +// CHECK-NEXT: [[CONTEXT_ISOLATION_B:%.*]] = begin_borrow [[CONTEXT_ISOLATION]] +// CHECK-NEXT: [[CONTEXT_ISOLATION_B_CAST:%.*]] = unchecked_value_cast [[CONTEXT_ISOLATION_B]] to $Builtin.ImplicitIsolationActor +// CHECK-NEXT: [[PROP_WITNESS:%.*]] = witness_method $T, #P.prop!getter : (Self) -> () async -> String : $@convention(witness_method: P) @async <τ_0_0 where τ_0_0 : P> (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @in_guaranteed τ_0_0) -> @owned String +// CHECK-NEXT: {{.*}} = apply [[PROP_WITNESS]]([[CONTEXT_ISOLATION_B_CAST]], %0) : $@convention(witness_method: P) @async <τ_0_0 where τ_0_0 : P> (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @in_guaranteed τ_0_0) -> @owned String // CHECK: hop_to_executor [[BORROWED_MAIN_ACTOR]] // CHECK: [[MAIN_ACTOR_COPY:%.*]] = copy_value [[BORROWED_MAIN_ACTOR]] // CHECK-NEXT: [[ERASED_TO_ACTOR:%.*]] = init_existential_ref [[MAIN_ACTOR_COPY]] : $MainActor : $MainActor, $any Actor // CHECK-NEXT: [[CONTEXT_ISOLATION:%.*]] = enum $Optional, #Optional.some!enumelt, [[ERASED_TO_ACTOR]] -// CHECK-NEXT: [[FN_WITNESS:%.*]] = witness_method $T, #P.fn : (Self) -> () async -> () : $@convention(witness_method: P) @async <τ_0_0 where τ_0_0 : P> (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @in_guaranteed τ_0_0) -> () -// CHECK-NEXT: {{.*}} = apply [[FN_WITNESS]]([[CONTEXT_ISOLATION]], %0) : $@convention(witness_method: P) @async <τ_0_0 where τ_0_0 : P> (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @in_guaranteed τ_0_0) -> () +// CHECK-NEXT: [[CONTEXT_ISOLATION_B:%.*]] = begin_borrow [[CONTEXT_ISOLATION]] +// CHECK-NEXT: [[CONTEXT_ISOLATION_B_CAST:%.*]] = unchecked_value_cast [[CONTEXT_ISOLATION_B]] to $Builtin.ImplicitIsolationActor +// CHECK-NEXT: [[FN_WITNESS:%.*]] = witness_method $T, #P.fn : (Self) -> () async -> () : $@convention(witness_method: P) @async <τ_0_0 where τ_0_0 : P> (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @in_guaranteed τ_0_0) -> () +// CHECK-NEXT: {{.*}} = apply [[FN_WITNESS]]([[CONTEXT_ISOLATION_B_CAST]], %0) : $@convention(witness_method: P) @async <τ_0_0 where τ_0_0 : P> (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @in_guaranteed τ_0_0) -> () // CHECK: } // end sil function '$s9witnesses21testMainActorDispatch1tyx_tYaAA1PRzlF' @MainActor func testMainActorDispatch(t: T) async { @@ -41,15 +45,15 @@ func testMainActorDispatch(t: T) async { } // CHECK-LABEL: sil hidden [ossa] @$s9witnesses19testGenericExecutor1tyx_tYaAA1PRzlF : $@convention(thin) @async (@in_guaranteed T) -> () -// CHECK: [[CONTEXT_ISOLATION:%.*]] = enum $Optional, #Optional.none!enumelt +// CHECK: [[CONTEXT_ISOLATION:%.*]] = enum $Optional, #Optional.none!enumelt // CHECK-NEXT: hop_to_executor [[CONTEXT_ISOLATION]] -// CHECK-NEXT: [[ISOLATION_ERASED_TO_ACTOR:%.*]] = enum $Optional, #Optional.none!enumelt -// CHECK-NEXT: [[PROP_WITNESS:%.*]] = witness_method $T, #P.prop!getter : (Self) -> () async -> String : $@convention(witness_method: P) @async <τ_0_0 where τ_0_0 : P> (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @in_guaranteed τ_0_0) -> @owned String -// CHECK-NEXT: {{.*}} = apply [[PROP_WITNESS]]([[ISOLATION_ERASED_TO_ACTOR]], %0) : $@convention(witness_method: P) @async <τ_0_0 where τ_0_0 : P> (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @in_guaranteed τ_0_0) -> @owned String +// CHECK-NEXT: [[CONTEXT_ISOLATION_CAST:%.*]] = unchecked_value_cast [[CONTEXT_ISOLATION]] to $Builtin.ImplicitIsolationActor +// CHECK-NEXT: [[PROP_WITNESS:%.*]] = witness_method $T, #P.prop!getter : (Self) -> () async -> String : $@convention(witness_method: P) @async <τ_0_0 where τ_0_0 : P> (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @in_guaranteed τ_0_0) -> @owned String +// CHECK-NEXT: {{.*}} = apply [[PROP_WITNESS]]([[CONTEXT_ISOLATION_CAST]], %0) : $@convention(witness_method: P) @async <τ_0_0 where τ_0_0 : P> (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @in_guaranteed τ_0_0) -> @owned String // CHECK-NEXT: hop_to_executor [[CONTEXT_ISOLATION]] -// CHECK: [[ISOLATION_ERASED_TO_ACTOR:%.*]] = enum $Optional, #Optional.none!enumelt -// CHECK-NEXT: [[FN_WITNESS:%.*]] = witness_method $T, #P.fn : (Self) -> () async -> () : $@convention(witness_method: P) @async <τ_0_0 where τ_0_0 : P> (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @in_guaranteed τ_0_0) -> () -// CHECK-NEXT: {{.*}} = apply [[FN_WITNESS]]([[ISOLATION_ERASED_TO_ACTOR]], %0) : $@convention(witness_method: P) @async <τ_0_0 where τ_0_0 : P> (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @in_guaranteed τ_0_0) -> () +// CHECK: [[CONTEXT_ISOLATION_CAST:%.*]] = unchecked_value_cast [[CONTEXT_ISOLATION]] to $Builtin.ImplicitIsolationActor +// CHECK-NEXT: [[FN_WITNESS:%.*]] = witness_method $T, #P.fn : (Self) -> () async -> () : $@convention(witness_method: P) @async <τ_0_0 where τ_0_0 : P> (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @in_guaranteed τ_0_0) -> () +// CHECK-NEXT: {{.*}} = apply [[FN_WITNESS]]([[CONTEXT_ISOLATION_CAST]], %0) : $@convention(witness_method: P) @async <τ_0_0 where τ_0_0 : P> (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @in_guaranteed τ_0_0) -> () // CHECK: } // end sil function '$s9witnesses19testGenericExecutor1tyx_tYaAA1PRzlF' func testGenericExecutor(t: T) async { _ = await t.prop @@ -63,14 +67,18 @@ actor Test { // CHECK-NEXT: [[ACTOR_COPY:%.*]] = copy_value [[ACTOR]] // CHECK-NEXT: [[ERASED_TO_ACTOR:%.*]] = init_existential_ref [[ACTOR_COPY]] : $Test : $Test, $any Actor // CHECK-NEXT: [[CONTEXT_ISOLATION:%.*]] = enum $Optional, #Optional.some!enumelt, [[ERASED_TO_ACTOR]] - // CHECK-NEXT: [[PROP_WITNESS:%.*]] = witness_method $T, #P.prop!getter : (Self) -> () async -> String : $@convention(witness_method: P) @async <τ_0_0 where τ_0_0 : P> (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @in_guaranteed τ_0_0) -> @owned String - // CHECK-NEXT: {{.*}} = apply [[PROP_WITNESS]]([[CONTEXT_ISOLATION]], %0) : $@convention(witness_method: P) @async <τ_0_0 where τ_0_0 : P> (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @in_guaranteed τ_0_0) -> @owned String + // CHECK-NEXT: [[CONTEXT_ISOLATION_B:%.*]] = begin_borrow [[CONTEXT_ISOLATION]] + // CHECK-NEXT: [[CONTEXT_ISOLATION_B_CAST:%.*]] = unchecked_value_cast [[CONTEXT_ISOLATION_B]] to $Builtin.ImplicitIsolationActor + // CHECK-NEXT: [[PROP_WITNESS:%.*]] = witness_method $T, #P.prop!getter : (Self) -> () async -> String : $@convention(witness_method: P) @async <τ_0_0 where τ_0_0 : P> (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @in_guaranteed τ_0_0) -> @owned String + // CHECK-NEXT: {{.*}} = apply [[PROP_WITNESS]]([[CONTEXT_ISOLATION_B_CAST]], %0) : $@convention(witness_method: P) @async <τ_0_0 where τ_0_0 : P> (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @in_guaranteed τ_0_0) -> @owned String // CHECK: hop_to_executor [[ACTOR]] // CHECK: [[ACTOR_COPY:%.*]] = copy_value [[ACTOR]] // CHECK-NEXT: [[ERASED_TO_ACTOR:%.*]] = init_existential_ref [[ACTOR_COPY]] : $Test : $Test, $any Actor // CHECK-NEXT: [[CONTEXT_ISOLATION:%.*]] = enum $Optional, #Optional.some!enumelt, [[ERASED_TO_ACTOR]] - // CHECK-NEXT: [[FN_WITNESS:%.*]] = witness_method $T, #P.fn : (Self) -> () async -> () : $@convention(witness_method: P) @async <τ_0_0 where τ_0_0 : P> (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @in_guaranteed τ_0_0) -> () - // CHECK-NEXT: {{.*}} = apply [[FN_WITNESS]]([[CONTEXT_ISOLATION]], %0) : $@convention(witness_method: P) @async <τ_0_0 where τ_0_0 : P> (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @in_guaranteed τ_0_0) -> () + // CHECK-NEXT: [[CONTEXT_ISOLATION_B:%.*]] = begin_borrow [[CONTEXT_ISOLATION]] + // CHECK-NEXT: [[CONTEXT_ISOLATION_B_CAST:%.*]] = unchecked_value_cast [[CONTEXT_ISOLATION_B]] to $Builtin.ImplicitIsolationActor + // CHECK-NEXT: [[FN_WITNESS:%.*]] = witness_method $T, #P.fn : (Self) -> () async -> () : $@convention(witness_method: P) @async <τ_0_0 where τ_0_0 : P> (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @in_guaranteed τ_0_0) -> () + // CHECK-NEXT: {{.*}} = apply [[FN_WITNESS]]([[CONTEXT_ISOLATION_B_CAST]], %0) : $@convention(witness_method: P) @async <τ_0_0 where τ_0_0 : P> (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @in_guaranteed τ_0_0) -> () // CHECK: } // end sil function '$s9witnesses4TestC4test1tyx_tYaAA1PRzlF' func test(t: T) async { _ = await t.prop @@ -86,14 +94,18 @@ actor Test { // CHECK-NEXT: [[MAIN_ACTOR_COPY:%.*]] = copy_value [[BORROWED_MAIN_ACTOR]] // CHECK-NEXT: [[ERASED_TO_ACTOR:%.*]] = init_existential_ref [[MAIN_ACTOR_COPY]] : $MainActor : $MainActor, $any Actor // CHECK-NEXT: [[CONTEXT_ISOLATION:%.*]] = enum $Optional, #Optional.some!enumelt, [[ERASED_TO_ACTOR]] -// CHECK: [[PROP_REF:%.*]] = function_ref @$s9witnesses1SV4propSSvg : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, S) -> @owned String -// CHECK-NEXT: {{.*}} = apply [[PROP_REF]]([[CONTEXT_ISOLATION]], %0) : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, S) -> @owned String +// CHECK-NEXT: [[CONTEXT_ISOLATION_B:%.*]] = begin_borrow [[CONTEXT_ISOLATION]] +// CHECK-NEXT: [[CONTEXT_ISOLATION_B_CAST:%.*]] = unchecked_value_cast [[CONTEXT_ISOLATION_B]] to $Builtin.ImplicitIsolationActor +// CHECK: [[PROP_REF:%.*]] = function_ref @$s9witnesses1SV4propSSvg : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, S) -> @owned String +// CHECK-NEXT: {{.*}} = apply [[PROP_REF]]([[CONTEXT_ISOLATION_B_CAST]], %0) : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, S) -> @owned String // CHECK: hop_to_executor [[BORROWED_MAIN_ACTOR]] // CHECK: [[MAIN_ACTOR_COPY:%.*]] = copy_value [[BORROWED_MAIN_ACTOR]] // CHECK-NEXT: [[ERASED_TO_ACTOR:%.*]] = init_existential_ref [[MAIN_ACTOR_COPY]] : $MainActor : $MainActor, $any Actor // CHECK-NEXT: [[CONTEXT_ISOLATION:%.*]] = enum $Optional, #Optional.some!enumelt, [[ERASED_TO_ACTOR]] -// CHECK: [[FN_REF:%.*]] = function_ref @$s9witnesses1SV2fnyyYaF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, S) -> () -// CHECK-NEXT: {{.*}} = apply [[FN_REF]]([[CONTEXT_ISOLATION]], %0) : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, S) -> () +// CHECK-NEXT: [[CONTEXT_ISOLATION_B:%.*]] = begin_borrow [[CONTEXT_ISOLATION]] +// CHECK-NEXT: [[CONTEXT_ISOLATION_B_CAST:%.*]] = unchecked_value_cast [[CONTEXT_ISOLATION_B]] to $Builtin.ImplicitIsolationActor +// CHECK: [[FN_REF:%.*]] = function_ref @$s9witnesses1SV2fnyyYaF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, S) -> () +// CHECK-NEXT: {{.*}} = apply [[FN_REF]]([[CONTEXT_ISOLATION_B_CAST]], %0) : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, S) -> () // CHECK: } // end sil function '$s9witnesses14testDirectCall1syAA1SV_tYaF' @MainActor func testDirectCall(s: S) async { diff --git a/test/Concurrency/cross_module_let_sil.swift b/test/Concurrency/cross_module_let_sil.swift index 216d1939a8db9..22cf8b4a6af47 100644 --- a/test/Concurrency/cross_module_let_sil.swift +++ b/test/Concurrency/cross_module_let_sil.swift @@ -7,12 +7,12 @@ import OtherActors // CHECK-LABEL: sil hidden [ossa] @$s4test6check1ySi11OtherActors0C11ModuleActorCYaF : $@convention(thin) @async (@guaranteed OtherModuleActor) -> Int { // CHECK: bb0([[SELF:%[0-9]+]] : @guaranteed $OtherModuleActor): -// CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none -// CHECK-NEXT: hop_to_executor [[GENERIC_EXEC]] : $Optional +// CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none +// CHECK-NEXT: hop_to_executor [[GENERIC_EXEC]] : $Optional // CHECK: [[REF:%[0-9]+]] = ref_element_addr [[SELF]] : $OtherModuleActor, #OtherModuleActor.a // CHECK: hop_to_executor [[SELF]] : $OtherModuleActor // CHECK-NEXT: load [trivial] [[REF]] -// CHECK-NEXT: hop_to_executor [[GENERIC_EXEC]] : $Optional +// CHECK-NEXT: hop_to_executor [[GENERIC_EXEC]] // CHECK: } // end sil function '$s4test6check1ySi11OtherActors0C11ModuleActorCYaF' func check1(_ actor: OtherModuleActor) async -> Int { return await actor.a @@ -24,23 +24,23 @@ func check2(_ actor: isolated OtherModuleActor) -> Int { // CHECK-LABEL: sil hidden [ossa] @$s4test6check3ySi11OtherActors0C11ModuleActorCYaF : $@convention(thin) @async (@guaranteed OtherModuleActor) -> Int { // CHECK: bb0([[SELF:%[0-9]+]] : @guaranteed $OtherModuleActor): -// CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none -// CHECK-NEXT: hop_to_executor [[GENERIC_EXEC]] : $Optional +// CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none +// CHECK-NEXT: hop_to_executor [[GENERIC_EXEC]] func check3(_ actor: OtherModuleActor) async -> Int { return actor.b } // CHECK-LABEL: sil hidden [ossa] @$s4test6check4y11OtherActors17SomeSendableClassCSgAC0C11ModuleActorCSgYaF : $@convention(thin) @async (@guaranteed Optional) -> @owned Optional { // CHECK: bb0({{%[0-9]+}} : @guaranteed $Optional): -// CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none -// CHECK-NEXT: hop_to_executor [[GENERIC_EXEC]] : $Optional +// CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none +// CHECK-NEXT: hop_to_executor [[GENERIC_EXEC]] // CHECK: switch_enum {{%[0-9]+}} : $Optional, case #Optional.some!enumelt: [[SOME:bb[0-9]+]], case #Optional.none!enumelt: {{bb[0-9]+}} // CHECK: [[SOME]]({{%[0-9]+}} : @owned $OtherModuleActor): // CHECK: [[REF:%[0-9]+]] = ref_element_addr {{%[0-9]+}} : $OtherModuleActor, #OtherModuleActor.d // CHECK: hop_to_executor {{%[0-9]+}} : $OtherModuleActor // CHECK-NEXT: load [copy] [[REF]] -// CHECK: hop_to_executor [[GENERIC_EXEC]] : $Optional +// CHECK: hop_to_executor [[GENERIC_EXEC]] // CHECK: } // end sil function '$s4test6check4y11OtherActors17SomeSendableClassCSgAC0C11ModuleActorCSgYaF' func check4(_ actor: OtherModuleActor?) async -> SomeSendableClass? { return await actor?.d diff --git a/test/Concurrency/isolated_default_argument_eval.swift b/test/Concurrency/isolated_default_argument_eval.swift index fa7debb221549..2d2e1d0c7b870 100644 --- a/test/Concurrency/isolated_default_argument_eval.swift +++ b/test/Concurrency/isolated_default_argument_eval.swift @@ -27,11 +27,11 @@ func mainActorMultiDefaultArg(x: Int = requiresMainActor(), // CHECK-LABEL: sil hidden [ossa] @$s30isolated_default_argument_eval22nonisolatedAsyncCalleryyYaF func nonisolatedAsyncCaller() async { - // CHECK: hop_to_executor {{.*}} : $Optional + // CHECK: hop_to_executor {{.*}} // CHECK: hop_to_executor {{.*}} : $MainActor // CHECK: [[GET_VALUE:%[0-9]+]] = function_ref @$s30isolated_default_argument_eval19mainActorDefaultArg5valueS2i_tFfA_ // CHECK-NEXT: apply [[GET_VALUE]]() - // CHECK: hop_to_executor {{.*}} : $Optional + // CHECK: hop_to_executor {{.*}} await mainActorDefaultArg() // CHECK: hop_to_executor {{.*}} : $MainActor @@ -46,7 +46,7 @@ func nonisolatedAsyncCaller() async { // CHECK-NOT: hop_to_executor // CHECK: [[GET_Z:%[0-9]+]] = function_ref @$s30isolated_default_argument_eval24mainActorMultiDefaultArg1x1y5tuple1zySi_S2i_SitSitFfA2_ // CHECK-NEXT: apply [[GET_Z]]() - // CHECK: hop_to_executor {{.*}} : $Optional + // CHECK: hop_to_executor {{.*}} await mainActorMultiDefaultArg() } @@ -57,7 +57,7 @@ var argValue: Int { 0 } // CHECK-LABEL: sil hidden [ossa] @$s30isolated_default_argument_eval20passInoutWithDefaultyyYaF func passInoutWithDefault() async { - // CHECK: hop_to_executor {{.*}} : $Optional + // CHECK: hop_to_executor {{.*}} var x = 0 @@ -69,7 +69,7 @@ func passInoutWithDefault() async { // CHECK-NEXT: [[Z:%[0-9]+]] = apply [[GET_Z]]() // CHECK: [[FN:%[0-9]+]] = function_ref @$s30isolated_default_argument_eval0A15DefaultInoutMix1x1y1zySiz_S2itF : $@convention(thin) (@inout Int, Int, Int) -> () // CHECK: apply [[FN]]([[INOUT_X]], [[ARG_VALUE]], [[Z]]) - // CHECK: hop_to_executor {{.*}} : $Optional + // CHECK: hop_to_executor {{.*}} await isolatedDefaultInoutMix(x: &x, y: argValue) } diff --git a/test/Concurrency/isolated_nonsending_isolation_macro_ir.swift b/test/Concurrency/isolated_nonsending_isolation_macro_ir.swift new file mode 100644 index 0000000000000..e6a4823188043 --- /dev/null +++ b/test/Concurrency/isolated_nonsending_isolation_macro_ir.swift @@ -0,0 +1,108 @@ +// RUN: %target-swift-frontend -parse-as-library -emit-ir -disable-llvm-merge-functions-pass %s | %FileCheck --check-prefix=NO-TBI %s +// RUN: %target-swift-frontend -parse-as-library -Xllvm -aarch64-use-tbi -emit-ir -disable-llvm-merge-functions-pass %s | %FileCheck --check-prefix=TBI %s + +// This test makes sure that we can properly fold the mask for the witness table +// when we have a #isolation. + +// REQUIRES: concurrency +// REQUIRES: CODEGENERATOR=AArch64 +// REQUIRES: PTRSIZE=64 +// REQUIRES: OS=macosx || OS=ios +// REQUIRES: CPU=arm64 + +@inline(never) +func useActor(iso: (any Actor)?) { + print(iso!.unownedExecutor) +} + +@inline(never) +func implicitParam(_ x: (any Actor)? = #isolation) { + print(x!.unownedExecutor) +} + +// #isolation via direct usage +// +// TBI: define swifttailcc void @"$s38isolated_nonsending_isolation_macro_ir46nonisolatedNonsendingUsePoundIsolationDirectlyyyYaF"(ptr swiftasync %0, ptr %1, ptr [[PTR:%.*]]) +// TBI: [[ALLOCA_1:%.*]] = alloca %swift.implicit_isolated_actor_type +// TBI: [[ALLOCA_2:%.*]] = alloca <{ i64, i64 }> +// TBI: [[ALLOCA_1_WITNESS_POINTER:%.*]] = getelementptr inbounds %swift.implicit_isolated_actor_type, ptr [[ALLOCA_1]], i32 0, i32 1 +// TBI: store ptr [[PTR]], ptr [[ALLOCA_1_WITNESS_POINTER]] +// TBI: [[ALLOCA_1_WITNESS_POINTER:%.*]] = getelementptr inbounds <{ i64, i64 }>, ptr [[ALLOCA_1]], i32 0, i32 1 +// TBI: [[RELOAD_PTR:%.*]] = load i64, ptr [[ALLOCA_1_WITNESS_POINTER]] +// TBI: [[MASKED_PTR:%.*]] = and i64 [[RELOAD_PTR]], -3458764513820540929 +// TBI: [[ALLOCA_2_WITNESS_POINTER:%.*]] = getelementptr inbounds <{ i64, i64 }>, ptr [[ALLOCA_2]], i32 0, i32 1 +// TBI: store i64 [[MASKED_PTR]], ptr [[ALLOCA_2_WITNESS_POINTER]] +// TBI: [[ALLOCA_2_WITNESS_POINTER:%.*]] = getelementptr inbounds { i64, i64 }, ptr [[ALLOCA_2]], i32 0, i32 1 +// TBI: [[RELOAD_MASKED_PTR:%.*]] = load i64, ptr [[ALLOCA_2_WITNESS_POINTER]] +// TBI: call swiftcc void @"$s38isolated_nonsending_isolation_macro_ir8useActor3isoyScA_pSg_tF"(i64 {{%.*}}, i64 [[RELOAD_MASKED_PTR]]) + +// NO-TBI: define swifttailcc void @"$s38isolated_nonsending_isolation_macro_ir46nonisolatedNonsendingUsePoundIsolationDirectlyyyYaF"(ptr swiftasync %0, ptr %1, ptr [[PTR:%.*]]) +// NO-TBI: [[ALLOCA_1:%.*]] = alloca %swift.implicit_isolated_actor_type +// NO-TBI: [[ALLOCA_2:%.*]] = alloca <{ i64, i64 }> +// NO-TBI: [[ALLOCA_1_WITNESS_POINTER:%.*]] = getelementptr inbounds %swift.implicit_isolated_actor_type, ptr [[ALLOCA_1]], i32 0, i32 1 +// NO-TBI: store ptr [[PTR]], ptr [[ALLOCA_1_WITNESS_POINTER]] +// NO-TBI: [[ALLOCA_1_WITNESS_POINTER:%.*]] = getelementptr inbounds <{ i64, i64 }>, ptr [[ALLOCA_1]], i32 0, i32 1 +// NO-TBI: [[RELOAD_PTR:%.*]] = load i64, ptr [[ALLOCA_1_WITNESS_POINTER]] +// NO-TBI: [[MASKED_PTR:%.*]] = and i64 [[RELOAD_PTR]], -4 +// NO-TBI: [[ALLOCA_2_WITNESS_POINTER:%.*]] = getelementptr inbounds <{ i64, i64 }>, ptr [[ALLOCA_2]], i32 0, i32 1 +// NO-TBI: store i64 [[MASKED_PTR]], ptr [[ALLOCA_2_WITNESS_POINTER]] +// NO-TBI: [[ALLOCA_2_WITNESS_POINTER:%.*]] = getelementptr inbounds { i64, i64 }, ptr [[ALLOCA_2]], i32 0, i32 1 +// NO-TBI: [[RELOAD_MASKED_PTR:%.*]] = load i64, ptr [[ALLOCA_2_WITNESS_POINTER]] +// NO-TBI: call swiftcc void @"$s38isolated_nonsending_isolation_macro_ir8useActor3isoyScA_pSg_tF"(i64 {{%.*}}, i64 [[RELOAD_MASKED_PTR]]) +public nonisolated(nonsending) func nonisolatedNonsendingUsePoundIsolationDirectly() async { + let iso = #isolation + useActor(iso: iso) +} + +// #isolation via default arg +// +// TBI: define swifttailcc void @"$s38isolated_nonsending_isolation_macro_ir45nonisolatedNonsendingPoundIsolationDefaultArgyyYaF"(ptr swiftasync {{%.*}}, ptr {{%.*}}, ptr [[PTR:%.*]]) +// TBI: [[ALLOCA_1:%.*]] = alloca %swift.implicit_isolated_actor_type +// TBI: [[ALLOCA_2:%.*]] = alloca <{ i64, i64 }> +// TBI: [[ALLOCA_1_WITNESS_POINTER:%.*]] = getelementptr inbounds %swift.implicit_isolated_actor_type, ptr [[ALLOCA_1]], i32 0, i32 1 +// TBI: store ptr [[PTR]], ptr [[ALLOCA_1_WITNESS_POINTER]] +// TBI: [[ALLOCA_1_WITNESS_POINTER:%.*]] = getelementptr inbounds <{ i64, i64 }>, ptr [[ALLOCA_1]], i32 0, i32 1 +// TBI: [[RELOAD_PTR:%.*]] = load i64, ptr [[ALLOCA_1_WITNESS_POINTER]] +// TBI: [[MASKED_PTR:%.*]] = and i64 [[RELOAD_PTR]], -3458764513820540929 +// TBI: [[ALLOCA_2_WITNESS_POINTER:%.*]] = getelementptr inbounds <{ i64, i64 }>, ptr [[ALLOCA_2]], i32 0, i32 1 +// TBI: store i64 [[MASKED_PTR]], ptr [[ALLOCA_2_WITNESS_POINTER]] +// TBI: [[ALLOCA_2_WITNESS_POINTER:%.*]] = getelementptr inbounds { i64, i64 }, ptr [[ALLOCA_2]], i32 0, i32 1 +// TBI: [[RELOAD_MASKED_PTR:%.*]] = load i64, ptr [[ALLOCA_2_WITNESS_POINTER]] +// TBI: call swiftcc void @"$s38isolated_nonsending_isolation_macro_ir13implicitParamyyScA_pSgF"(i64 {{%.*}}, i64 [[RELOAD_MASKED_PTR]]) + +// NO-TBI: define swifttailcc void @"$s38isolated_nonsending_isolation_macro_ir45nonisolatedNonsendingPoundIsolationDefaultArgyyYaF"(ptr swiftasync {{%.*}}, ptr {{%.*}}, ptr [[PTR:%.*]]) +// NO-TBI: [[ALLOCA_1:%.*]] = alloca %swift.implicit_isolated_actor_type +// NO-TBI: [[ALLOCA_2:%.*]] = alloca <{ i64, i64 }> +// NO-TBI: [[ALLOCA_1_WITNESS_POINTER:%.*]] = getelementptr inbounds %swift.implicit_isolated_actor_type, ptr [[ALLOCA_1]], i32 0, i32 1 +// NO-TBI: store ptr [[PTR]], ptr [[ALLOCA_1_WITNESS_POINTER]] +// NO-TBI: [[ALLOCA_1_WITNESS_POINTER:%.*]] = getelementptr inbounds <{ i64, i64 }>, ptr [[ALLOCA_1]], i32 0, i32 1 +// NO-TBI: [[RELOAD_PTR:%.*]] = load i64, ptr [[ALLOCA_1_WITNESS_POINTER]] +// NO-TBI: [[MASKED_PTR:%.*]] = and i64 [[RELOAD_PTR]], -4 +// NO-TBI: [[ALLOCA_2_WITNESS_POINTER:%.*]] = getelementptr inbounds <{ i64, i64 }>, ptr [[ALLOCA_2]], i32 0, i32 1 +// NO-TBI: store i64 [[MASKED_PTR]], ptr [[ALLOCA_2_WITNESS_POINTER]] +// NO-TBI: [[ALLOCA_2_WITNESS_POINTER:%.*]] = getelementptr inbounds { i64, i64 }, ptr [[ALLOCA_2]], i32 0, i32 1 +// NO-TBI: [[RELOAD_MASKED_PTR:%.*]] = load i64, ptr [[ALLOCA_2_WITNESS_POINTER]] +// NO-TBI: call swiftcc void @"$s38isolated_nonsending_isolation_macro_ir13implicitParamyyScA_pSgF"(i64 {{%.*}}, i64 [[RELOAD_MASKED_PTR]]) +public nonisolated(nonsending) func nonisolatedNonsendingPoundIsolationDefaultArg() async { + implicitParam() +} + +@inline(never) +public nonisolated(nonsending) func calleeFunction() async { +} + +// TBI: define swifttailcc void @"$s38isolated_nonsending_isolation_macro_ir14callerFunctionyyYaF"(ptr swiftasync %0, ptr %1, ptr [[PTR:%.*]]) +// TBI: [[PTR_INT:%.*]] = ptrtoint ptr [[PTR]] to i64 +// TBI: [[MASKED_PTR_INT:%.*]] = and i64 [[PTR_INT]], -3458764513820540929 +// TBI: [[MASKED_PTR:%.*]] = inttoptr i64 [[MASKED_PTR_INT]] to ptr +// TBI: musttail call swifttailcc void @"$s38isolated_nonsending_isolation_macro_ir14calleeFunctionyyYaF"(ptr swiftasync {{%.*}}, ptr {{%.*}}, ptr [[MASKED_PTR]]) + +// NO-TBI: define swifttailcc void @"$s38isolated_nonsending_isolation_macro_ir14callerFunctionyyYaF"(ptr swiftasync {{%.*}}, ptr {{%.*}}, ptr [[PTR:%.*]]) +// NO-TBI: [[PTR_INT:%.*]] = ptrtoint ptr [[PTR]] to i64 +// NO-TBI: [[MASKED_PTR_INT:%.*]] = and i64 [[PTR_INT]], -4 +// NO-TBI: [[MASKED_PTR:%.*]] = inttoptr i64 [[MASKED_PTR_INT]] to ptr +// NO-TBI: musttail call swifttailcc void @"$s38isolated_nonsending_isolation_macro_ir14calleeFunctionyyYaF"(ptr swiftasync {{%.*}}, ptr {{%.*}}, ptr [[MASKED_PTR]]) +@inline(never) +public nonisolated(nonsending) func callerFunction() async { + await calleeFunction() +} diff --git a/test/Concurrency/isolated_nonsending_isolation_macro_sil.swift b/test/Concurrency/isolated_nonsending_isolation_macro_sil.swift index eea5b80be8ad1..8bd93a7f65aa4 100644 --- a/test/Concurrency/isolated_nonsending_isolation_macro_sil.swift +++ b/test/Concurrency/isolated_nonsending_isolation_macro_sil.swift @@ -1,21 +1,86 @@ -// RUN: %target-swift-frontend -parse-as-library -emit-sil %s | %FileCheck %s +// RUN: %target-swift-frontend -parse-as-library -emit-silgen -Xllvm -aarch64-use-tbi %s | %FileCheck -check-prefix=CHECK -check-prefix=TBI %s +// RUN: %target-swift-frontend -parse-as-library -emit-silgen %s | %FileCheck -check-prefix=CHECK -check-prefix=TAG %s // REQUIRES: concurrency +// REQUIRES: CODEGENERATOR=AArch64 +// REQUIRES: PTRSIZE=64 +// REQUIRES: OS=macosx || OS=ios +// REQUIRES: CPU=arm64 +// REQUIRES: asserts -nonisolated(nonsending) func nonisolatedNonsending() async { +func useActor(iso: (any Actor)?) {} +func implicitParam(_ x: (any Actor)? = #isolation) {} + +// CHECK-LABEL: sil hidden [ossa] @$s39isolated_nonsending_isolation_macro_sil46nonisolatedNonsendingUsePoundIsolationDirectlyyyYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> () { +// CHECK: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor): +// +// #isolation without default arg +// CHECK: hop_to_executor [[ACTOR]] +// CHECK: [[CAST_TUPLE:%.*]] = unchecked_value_cast [[ACTOR]] to $(Builtin.Word, Builtin.Word) +// CHECK: ([[POINTER:%.*]], [[WITNESS:%.*]]) = destructure_tuple [[CAST_TUPLE]] + +// MASK = (0x3 << (((sizeof(Word) - 1) << 3) + 4)) ^ -1 +// TBI: [[INT_NEG:%.*]] = integer_literal $Builtin.Word, -1 +// TBI: [[WORD_SIZE:%.*]] = builtin "sizeof"( +// TBI: [[INT_ONE:%.*]] = integer_literal $Builtin.Word, 1 +// TBI: [[INT_THREE:%.*]] = integer_literal $Builtin.Word, 3 +// TBI: [[INT_FOUR:%.*]] = integer_literal $Builtin.Word, 4 +// TBI: [[INT_THREE_2:%.*]] = integer_literal $Builtin.Word, 3 +// TBI: [[WORD_MINUS_ONE:%.*]] = builtin "sub_Word"([[WORD_SIZE]], [[INT_ONE]]) +// TBI: [[INNER_SHIFT:%.*]] = builtin "shl_Word"([[WORD_MINUS_ONE]], [[INT_THREE]]) +// TBI: [[INNER_SHIFT_ADD:%.*]] = builtin "add_Word"([[INNER_SHIFT]], [[INT_FOUR]]) +// TBI: [[OUTER_SHIFT:%.*]] = builtin "shl_Word"([[INT_THREE_2]], [[INNER_SHIFT_ADD]]) +// TBI: [[MASK:%.*]] = builtin "xor_Word"([[OUTER_SHIFT]], [[INT_NEG]]) + +// TAG: [[MASK:%.*]] = integer_literal $Builtin.Word, -4 + +// CHECK: [[MASKED_WITNESS:%.*]] = builtin "and_Word"([[WITNESS]], [[MASK]]) +// CHECK: [[REFORMED_TUPLE:%.*]] = tuple ([[POINTER]], [[MASKED_WITNESS]]) +// CHECK: [[CAST_BACK:%.*]] = unchecked_value_cast [[REFORMED_TUPLE]] to $Optional +// CHECK: [[MARK_DEP:%.*]] = mark_dependence [nonescaping] [[CAST_BACK]] on [[ACTOR]] +// CHECK: [[ISO:%.*]] = move_value [lexical] [var_decl] [[MARK_DEP]] +// CHECK: debug_value [[ISO]], let, name "iso" +// CHECK: [[ISO_B:%.*]] = begin_borrow [[ISO]] +// CHECK: [[FUNC:%.*]] = function_ref @$s39isolated_nonsending_isolation_macro_sil8useActor3isoyScA_pSg_tF : $@convention(thin) (@guaranteed Optional) -> () +// CHECK: apply [[FUNC]]([[ISO_B]]) : $@convention(thin) (@guaranteed Optional) -> () +// CHECK: end_borrow [[ISO_B]] +// CHECK: destroy_value [[ISO]] +// CHECK: } // end sil function '$s39isolated_nonsending_isolation_macro_sil46nonisolatedNonsendingUsePoundIsolationDirectlyyyYaF' + +nonisolated(nonsending) func nonisolatedNonsendingUsePoundIsolationDirectly() async { let iso = #isolation - take(iso: iso) + useActor(iso: iso) } -func take(iso: (any Actor)?) {} - -// CHECK-LABEL: // nonisolatedNonsending() -// CHECK-NEXT: // Isolation: caller_isolation_inheriting -// CHECK-NEXT: sil hidden @$s39isolated_nonsending_isolation_macro_sil21nonisolatedNonsendingyyYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> () { -// CHECK: bb0([[ACTOR:%.*]] : $Optional): -// CHECK: retain_value [[ACTOR]] -// CHECK: debug_value [[ACTOR]], let, name "iso" -// CHECK: [[FUNC:%.*]] = function_ref @$s39isolated_nonsending_isolation_macro_sil4take3isoyScA_pSg_tF : $@convention(thin) (@guaranteed Optional) -> () -// CHECK: apply [[FUNC]]([[ACTOR]]) : $@convention(thin) (@guaranteed Optional) -> () -// CHECK: release_value [[ACTOR]] -// CHECK: } // end sil function '$s39isolated_nonsending_isolation_macro_sil21nonisolatedNonsendingyyYaF' +// #isolation via default arg +// +// CHECK-LABEL: sil hidden [ossa] @$s39isolated_nonsending_isolation_macro_sil45nonisolatedNonsendingPoundIsolationDefaultArgyyYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> () { +// CHECK: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor): +// CHECK: [[CAST_PTR:%.*]] = unchecked_value_cast [[ACTOR]] to $(Builtin.Word, Builtin.Word) +// CHECK: ([[POINTER:%.*]], [[WITNESS:%.*]]) = destructure_tuple [[CAST_PTR]] + +// MASK = (1 << (((sizeof(Word) - 1) << 3) + 4)) ^ -1 +// TBI: [[INT_NEG:%.*]] = integer_literal $Builtin.Word, -1 +// TBI: [[WORD_SIZE:%.*]] = builtin "sizeof"( +// TBI: [[INT_ONE:%.*]] = integer_literal $Builtin.Word, 1 +// TBI: [[INT_THREE:%.*]] = integer_literal $Builtin.Word, 3 +// TBI: [[INT_FOUR:%.*]] = integer_literal $Builtin.Word, 4 +// TBI: [[INT_THREE_2:%.*]] = integer_literal $Builtin.Word, 3 +// TBI: [[WORD_MINUS_ONE:%.*]] = builtin "sub_Word"([[WORD_SIZE]], [[INT_ONE]]) +// TBI: [[INNER_SHIFT:%.*]] = builtin "shl_Word"([[WORD_MINUS_ONE]], [[INT_THREE]]) +// TBI: [[INNER_SHIFT_ADD:%.*]] = builtin "add_Word"([[INNER_SHIFT]], [[INT_FOUR]]) +// TBI: [[OUTER_SHIFT:%.*]] = builtin "shl_Word"([[INT_THREE_2]], [[INNER_SHIFT_ADD]]) +// TBI: [[MASK:%.*]] = builtin "xor_Word"([[OUTER_SHIFT]], [[INT_NEG]]) + +// TAG: [[MASK:%.*]] = integer_literal $Builtin.Word, -4 + +// CHECK: [[MASKED_WITNESS:%.*]] = builtin "and_Word"([[WITNESS]], [[MASK]]) +// CHECK: [[REFORMED_TUPLE:%.*]] = tuple ([[POINTER]], [[MASKED_WITNESS]]) +// CHECK: [[CAST_BACK:%.*]] = unchecked_value_cast [[REFORMED_TUPLE]] to $Optional +// CHECK: [[MARK_DEP:%.*]] = mark_dependence [nonescaping] [[CAST_BACK]] on [[ACTOR]] +// CHECK: [[FUNC:%.*]] = function_ref @$s39isolated_nonsending_isolation_macro_sil13implicitParamyyScA_pSgF : $@convention(thin) (@guaranteed Optional) -> () +// CHECK: apply [[FUNC]]([[MARK_DEP]]) : $@convention(thin) (@guaranteed Optional) -> () +// CHECK: } // end sil function '$s39isolated_nonsending_isolation_macro_sil45nonisolatedNonsendingPoundIsolationDefaultArgyyYaF' +nonisolated(nonsending) func nonisolatedNonsendingPoundIsolationDefaultArg() async { + implicitParam() +} diff --git a/test/Concurrency/nonisolated_nonsending.swift b/test/Concurrency/nonisolated_nonsending.swift index 869349eead497..8cf6b88526ae0 100644 --- a/test/Concurrency/nonisolated_nonsending.swift +++ b/test/Concurrency/nonisolated_nonsending.swift @@ -21,11 +21,11 @@ func testPartialApplication(p: [any P]) async { _ = p.map { $0.f } } // CHECK-LABEL: sil private @$s22nonisolated_nonsending22testPartialApplication1pySayAA1P_pG_tYaFyyYaYbYCcAaD_pXEfU_ : -// CHECK: function_ref @$sScA_pSgIeghHgIL_AAytIeghHgILr_TR : +// CHECK: function_ref @$sBAIeghHgIL_BAytIeghHgILr_TR : // Reabstraction thunk from caller-isolated () -> () to caller-isolated () -> T -// CHECK-LABEL: sil shared [transparent] [reabstraction_thunk] @$sScA_pSgIeghHgIL_AAytIeghHgILr_TR : -// CHECK: bb0(%0 : $*(), %1 : $Optional, %2 : $@Sendable @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> ()): +// CHECK-LABEL: sil shared [transparent] [reabstraction_thunk] @$sBAIeghHgIL_BAytIeghHgILr_TR : $@convention(thin) @Sendable @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed @Sendable @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> ()) -> @out () { +// CHECK: bb0(%0 : $*(), %1 : $Builtin.ImplicitIsolationActor, %2 : $@Sendable @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> ()): // CHECK-NEXT: apply %2(%1) : func takesGenericAsyncFunction(_ fn: nonisolated(nonsending) (T) async -> Void) {} @@ -38,11 +38,11 @@ func testReabstractionPreservingCallerIsolation(fn: nonisolated(nonsending) (Int takesGenericAsyncFunction(fn) } // CHECK-LABEL: sil hidden @$s22nonisolated_nonsending42testReabstractionPreservingCallerIsolation2fnyySiYaYCXE_tF : -// CHECK: bb0(%0 : $@noescape @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, Int) -> ()): -// CHECK: [[THUNK:%.*]] = function_ref @$sScA_pSgSiIgHgILy_AASiIegHgILn_TR : +// CHECK: bb0(%0 : $@noescape @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, Int) -> ()): +// CHECK: [[THUNK:%.*]] = function_ref @$sBASiIgHgILy_BASiIegHgILn_TR : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @in_guaranteed Int, @guaranteed @noescape @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, Int) -> ()) -> () -// CHECK-LABEL: sil shared [transparent] [reabstraction_thunk] @$sScA_pSgSiIgHgILy_AASiIegHgILn_TR : -// CHECK: bb0(%0 : $Optional, %1 : $*Int, %2 : $@noescape @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, Int) -> ()): +// CHECK-LABEL: sil shared [transparent] [reabstraction_thunk] @$sBASiIgHgILy_BASiIegHgILn_TR : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @in_guaranteed Int, @guaranteed @noescape @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, Int) -> ()) -> () { +// CHECK: bb0(%0 : $Builtin.ImplicitIsolationActor, %1 : $*Int, %2 : $@noescape @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, Int) -> ()): // CHECK-NEXT: %3 = load %1 // CHECK-NEXT: apply %2(%0, %3) diff --git a/test/Concurrency/nonisolated_nonsending_optimize_hoptoexecutor.swift b/test/Concurrency/nonisolated_nonsending_optimize_hoptoexecutor.swift index 83e001e3e8774..964de753c0fbd 100644 --- a/test/Concurrency/nonisolated_nonsending_optimize_hoptoexecutor.swift +++ b/test/Concurrency/nonisolated_nonsending_optimize_hoptoexecutor.swift @@ -2,12 +2,12 @@ // REQUIRES: concurrency -// CHECK-LABEL: sil hidden [noinline] @$s4testAAyyYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> () { +// CHECK-LABEL: sil hidden [noinline] @$s4testAAyyYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> () { // CHECK: } // end sil function '$s4testAAyyYaF' @inline(never) nonisolated(nonsending) func test() async {} -// CHECK-LABEL: sil hidden [noinline] @$s4test5test2yyYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> () { +// CHECK-LABEL: sil hidden [noinline] @$s4test5test2yyYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> () { // CHECK: } // end sil function '$s4test5test2yyYaF' @inline(never) nonisolated(nonsending) func test2() async { @@ -20,8 +20,8 @@ func test3() async { // CHECK-LABEL: sil @$s4test6calleryyYaF : $@convention(thin) @async () -> () { // CHECK: hop_to_executor -// CHECK: function_ref @$s4testAAyyYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> () -// CHECK: function_ref @$s4test5test2yyYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> () +// CHECK: function_ref @$s4testAAyyYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> () +// CHECK: function_ref @$s4test5test2yyYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> () // CHECK: } // end sil function '$s4test6calleryyYaF' public func caller() async { await test() diff --git a/test/Demangle/Inputs/manglings.txt b/test/Demangle/Inputs/manglings.txt index 65593d300a26d..035078ab8c764 100644 --- a/test/Demangle/Inputs/manglings.txt +++ b/test/Demangle/Inputs/manglings.txt @@ -500,3 +500,6 @@ _$s15raw_identifiers10FontWeightO009_100_FpEpdyyFZ ---> static raw_identifiers.F $s7Library1BC1iSivxTwd ---> default override of Library.B.i.modify2 : Swift.Int $s7Library1BC1iSivxTwdTwc ---> coro function pointer to default override of Library.B.i.modify2 : Swift.Int $s3use1xAA3OfPVy3lib1GVyAA1fQryFQOyQo_GAjE1PAAxAeKHD1_AIHO_HCg_Gvp ---> use.x : use.OfP some>>.0>> +$sBAIgHgIL_BAIegHgIL_TR ---> {T:} reabstraction thunk helper from @callee_guaranteed @async (@guaranteed Builtin.ImplicitIsolationActor) -> () to @escaping @callee_guaranteed @async (@guaranteed Builtin.ImplicitIsolationActor) -> () +$sBAD ---> Builtin.ImplicitIsolationActor +$sIeg_BAIegHgIL_TR ---> {T:} reabstraction thunk helper from @escaping @callee_guaranteed () -> () to @escaping @callee_guaranteed @async (@guaranteed Builtin.ImplicitIsolationActor) -> () diff --git a/test/Demangle/Inputs/simplified-manglings.txt b/test/Demangle/Inputs/simplified-manglings.txt index 40904c876e100..83d2c0f204151 100644 --- a/test/Demangle/Inputs/simplified-manglings.txt +++ b/test/Demangle/Inputs/simplified-manglings.txt @@ -214,3 +214,4 @@ _TTSf2do___TTSf2s_d___TFVs17_LegacyStringCoreCfVs13_StringBufferS_ ---> speciali _TTSf2dos___TTSf2s_d___TFVs17_LegacyStringCoreCfVs13_StringBufferS_ ---> specialized _LegacyStringCore.init(_:) _$s4main1fSiyYaFTQ0_ ---> f() _$s4main1fSiyYaFTY0_ ---> f() +_$sBAIgHgIL_BAIegHgIL_TR ---> thunk for @callee_guaranteed @async (@guaranteed Builtin.ImplicitIsolationActor) -> () diff --git a/test/IRGen/typed_throws_abi.swift b/test/IRGen/typed_throws_abi.swift index 78cad66d967b0..1637e2841d70b 100644 --- a/test/IRGen/typed_throws_abi.swift +++ b/test/IRGen/typed_throws_abi.swift @@ -3107,7 +3107,7 @@ func callNonMatching_f1(_ b: Bool) -> (Int, Float, Bool, Float) { // CHECK: [[SUCCESS]]: // CHECK: call i1 (ptr, i1, ...) @llvm.coro.end.async(ptr {{%.*}}, i1 false, ptr @"$s16typed_throws_abi20nonMatching_f0_asyncySf_SftSbYaAA7OneWordVYKF{{.*}}", ptr {{%.*}}, ptr {{%.*}}, float 1.000000e+00, float 2.000000e+00, i64 undef, ptr null) // CHECK: unreachable -// CHECK: 18: +// CHECK: [[ERROR]]: // CHECK: [[ERROR_X:%.*]] = call swiftcc i64 @"$s16typed_throws_abi7OneWordVACycfC"() // CHECK: [[ERROR_RET:%.*]] = insertvalue { float, float, i64 } undef, i64 [[ERROR_X]], 2 // CHECK: [[ERROR_RET0:%.*]] = extractvalue { float, float, i64 } [[ERROR_RET]], 0 diff --git a/test/SILGen/async_builtins.swift b/test/SILGen/async_builtins.swift index b7358581eea0b..702a71e32f996 100644 --- a/test/SILGen/async_builtins.swift +++ b/test/SILGen/async_builtins.swift @@ -2,6 +2,7 @@ // REQUIRES: concurrency import Swift +import _Concurrency public struct X { // CHECK-LABEL: sil hidden [ossa] @$s4test1XV14getCurrentTaskBoyYaF diff --git a/test/SILGen/async_initializer.swift b/test/SILGen/async_initializer.swift index 56b96e9ee70ed..8e73dc4f9571e 100644 --- a/test/SILGen/async_initializer.swift +++ b/test/SILGen/async_initializer.swift @@ -50,13 +50,13 @@ protocol Person { struct MyStruct { // NI-DAG: sil hidden [ossa] @$s12initializers8MyStructVACyYacfC : $@convention(method) @async (@thin MyStruct.Type) -> MyStruct - // NI-NS-DAG: sil hidden [ossa] @$s12initializers8MyStructVACyYacfC : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @thin MyStruct.Type) -> MyStruct { + // NI-NS-DAG: sil hidden [ossa] @$s12initializers8MyStructVACyYacfC : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @thin MyStruct.Type) -> MyStruct { init() async {} } enum MyEnum { // NI-DAG: sil hidden [ossa] @$s12initializers6MyEnumOACyYacfC : $@convention(method) @async (@thin MyEnum.Type) -> MyEnum - // NI-NS-DAG: sil hidden [ossa] @$s12initializers6MyEnumOACyYacfC : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @thin MyEnum.Type) -> MyEnum { + // NI-NS-DAG: sil hidden [ossa] @$s12initializers6MyEnumOACyYacfC : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @thin MyEnum.Type) -> MyEnum { init() async {} } @@ -64,7 +64,7 @@ actor MyActor { // CHECK-DAG: sil hidden [ossa] @$s12initializers7MyActorCACyYacfc : $@convention(method) @async (@sil_isolated @owned MyActor) -> @owned MyActor // CHECK: bb0(%0 : @owned $MyActor): // In the prologue, hop to the generic executor. - // CHECK-NEXT: [[NIL_EXECUTOR:%.*]] = enum $Optional, #Optional.none + // CHECK-NEXT: [[NIL_EXECUTOR:%.*]] = enum $Optional, #Optional.none // CHECK-NEXT: hop_to_executor [[NIL_EXECUTOR]] : // Later, when we return from an async call, hop to the // correct flow-sensitive value. @@ -73,9 +73,12 @@ actor MyActor { // NI-NEXT: apply [[FN]] // // NI-NS: [[ISOLATION_1:%.*]] = builtin "flowSensitiveSelfIsolation"({{%.*}}) + // NI-NS-NEXT: [[ISOLATION_1_B:%.*]] = begin_borrow [[ISOLATION_1]] + // NI-NS-NEXT: [[ISOLATION_1_B_CAST:%.*]] = unchecked_value_cast [[ISOLATION_1_B]] : $Optional to $Builtin.ImplicitIsolationActor // NI-NS-NEXT: // function_ref // NI-NS-NEXT: [[FN:%.*]] = function_ref @$s12initializers8MyStructVACyYacfC : - // NI-NS-NEXT: apply [[FN]]([[ISOLATION_1]] + // NI-NS-NEXT: apply [[FN]]([[ISOLATION_1_B_CAST]] + // NI-NS-NEXT: end_borrow [[ISOLATION_1_B]] // NI-NS-NEXT: destroy_value [[ISOLATION_1]] // CHECK-NEXT: [[ISOLATION_2:%.*]] = builtin "flowSensitiveSelfIsolation"({{%.*}}) // CHECK-NEXT: hop_to_executor [[ISOLATION_2]] @@ -86,32 +89,32 @@ actor MyActor { } class EarthPerson : Person { - // NI-NS-LABEL: sil hidden [exact_self_class] [ossa] @$s12initializers11EarthPersonCACyYacfC : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @thick EarthPerson.Type) -> @owned EarthPerson { - // NI-NS: bb0([[ACTOR:%.*]] : @guaranteed $Optional, + // NI-NS-LABEL: sil hidden [exact_self_class] [ossa] @$s12initializers11EarthPersonCACyYacfC : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @thick EarthPerson.Type) -> @owned EarthPerson { + // NI-NS: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, // NI-NS: hop_to_executor [[ACTOR]] // NI-NS: apply {{%.*}}([[ACTOR]], {{%.*}}) // NI-NS: } // end sil function '$s12initializers11EarthPersonCACyYacfC' // NI-DAG: sil hidden [ossa] @$s12initializers11EarthPersonCACyYacfc : $@convention(method) @async (@owned EarthPerson) -> @owned EarthPerson - // NI-NS-DAG: sil hidden [ossa] @$s12initializers11EarthPersonCACyYacfc : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @owned EarthPerson) -> @owned EarthPerson { + // NI-NS-DAG: sil hidden [ossa] @$s12initializers11EarthPersonCACyYacfc : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @owned EarthPerson) -> @owned EarthPerson { required init() async {} // NI-DAG: sil hidden [ossa] @$s12initializers11EarthPersonC4nameACSS_tYacfc : $@convention(method) @async (@owned String, @owned EarthPerson) -> @owned EarthPerson - // NI-NS-DAG: sil hidden [ossa] @$s12initializers11EarthPersonC4nameACSS_tYacfc : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @owned String, @owned EarthPerson) -> @owned EarthPerson { + // NI-NS-DAG: sil hidden [ossa] @$s12initializers11EarthPersonC4nameACSS_tYacfc : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @owned String, @owned EarthPerson) -> @owned EarthPerson { init(name: String) async {} // NI-DAG: sil private [transparent] [thunk] [ossa] @$s12initializers11EarthPersonCAA0C0A2aDPxyYacfCTW : $@convention( - // NI-NS-DAG: sil private [transparent] [thunk] [ossa] @$s12initializers11EarthPersonCAA0C0A2aDPxyYacfCTW : $@convention(witness_method: Person) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @thick EarthPerson.Type) -> @out EarthPerson { + // NI-NS-DAG: sil private [transparent] [thunk] [ossa] @$s12initializers11EarthPersonCAA0C0A2aDPxyYacfCTW : $@convention(witness_method: Person) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @thick EarthPerson.Type) -> @out EarthPerson { } class NorthAmericaPerson : EarthPerson { // NI-DAG: sil hidden [ossa] @$s12initializers18NorthAmericaPersonCACyYacfc : $@convention(method) @async (@owned NorthAmericaPerson) -> @owned NorthAmericaPerson - // NI-NS-DAG: sil hidden [ossa] @$s12initializers18NorthAmericaPersonCACyYacfc : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @owned NorthAmericaPerson) -> @owned NorthAmericaPerson { + // NI-NS-DAG: sil hidden [ossa] @$s12initializers18NorthAmericaPersonCACyYacfc : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @owned NorthAmericaPerson) -> @owned NorthAmericaPerson { required init() async { await super.init() } // NI-DAG: sil hidden [ossa] @$s12initializers18NorthAmericaPersonC4nameACSS_tYacfc : $@convention(method) @async (@owned String, @owned NorthAmericaPerson) -> @owned NorthAmericaPerson - // NI-NS-DAG: sil hidden [ossa] @$s12initializers18NorthAmericaPersonC4nameACSS_tYacfc : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @owned String, @owned NorthAmericaPerson) -> @owned NorthAmericaPerson { + // NI-NS-DAG: sil hidden [ossa] @$s12initializers18NorthAmericaPersonC4nameACSS_tYacfc : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @owned String, @owned NorthAmericaPerson) -> @owned NorthAmericaPerson { override init(name: String) async { await super.init(name: name) } } @@ -126,7 +129,8 @@ class Cat { // CHECK: hop_to_executor {{%[0-9]+}} : $MainActor // CHECK: {{%[0-9]+}} = function_ref @$s12initializers11someAsyncFnyyYaF : // NI: {{%[0-9]+}} = apply {{%[0-9]+}}() : $@convention(thin) @async () -> () - // NI-NS: {{%[0-9]+}} = apply {{%[0-9]+}}({{%.*}}) : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> () + // NI-NS: {{%[0-9]+}} = apply {{%[0-9]+}}({{%.*}}) : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> () + // NI-NS-NEXT: end_borrow // NI-NS-NEXT: destroy_value {{%.*}} // CHECK-NEXT: hop_to_executor {{%[0-9]+}} : $MainActor // CHECK: } // end sil function '$s12initializers3CatCACyYacfc' @@ -142,7 +146,8 @@ struct Dog { // CHECK: hop_to_executor {{%[0-9]+}} : $MainActor // CHECK: {{%[0-9]+}} = function_ref @$s12initializers11someAsyncFnyyYaF // NI: {{%[0-9]+}} = apply {{%[0-9]+}}() : $@convention(thin) @async () -> () - // NI-NS: {{%[0-9]+}} = apply {{%[0-9]+}}({{%.*}}) : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> () + // NI-NS: {{%[0-9]+}} = apply {{%[0-9]+}}({{%.*}}) : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> () + // NI-NS-NEXT: end_borrow // NI-NS-NEXT: destroy_value {{%.*}} // CHECK-NEXT: hop_to_executor {{%[0-9]+}} : $MainActor // CHECK: } // end sil function '$s12initializers3DogVACyYacfC' @@ -169,16 +174,16 @@ enum Birb { } // NI-LABEL: sil hidden [ossa] @$s12initializers7makeCatyyYaF : $@convention(thin) @async () -> () { -// NI: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none -// NI-NEXT: hop_to_executor [[GENERIC_EXEC]] : $Optional +// NI: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none +// NI-NEXT: hop_to_executor [[GENERIC_EXEC]] : $Optional // NI: hop_to_executor [[BORROWED_EXECUTOR:%[0-9]+]] // NI: end_borrow [[BORROWED_EXECUTOR]] // NI-NEXT: {{%[0-9]+}} = apply {{%[0-9]+}}({{%[0-9]+}}, {{%[0-9]+}}) : $@convention(method) (@owned String, @thick Cat.Type) -> @owned Cat -// NI: hop_to_executor [[GENERIC_EXEC]] : $Optional +// NI: hop_to_executor [[GENERIC_EXEC]] : $Optional // NI: } // end sil function '$s12initializers7makeCatyyYaF' -// NI-NS-LABEL: sil hidden [ossa] @$s12initializers7makeCatyyYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> () { -// NI-NS: bb0([[ACTOR:%.*]] : @guaranteed $Optional): +// NI-NS-LABEL: sil hidden [ossa] @$s12initializers7makeCatyyYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> () { +// NI-NS: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor): // NI-NS: hop_to_executor [[ACTOR]] // NI-NS: [[INIT:%.*]] = function_ref @$s12initializers3CatC4nameACSS_tcfC : $@convention(method) (@owned String, @thick Cat.Type) -> @owned Cat // NI-NS: [[MAIN_ACTOR:%.*]] = apply {{%.*}}({{%.*}}) : $@convention(method) (@thick MainActor.Type) -> @owned MainActor @@ -192,16 +197,16 @@ func makeCat() async { } // NI-LABEL: sil hidden [ossa] @$s12initializers7makeDogyyYaF : $@convention(thin) @async () -> () { -// NI: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none -// NI-NEXT: hop_to_executor [[GENERIC_EXEC]] : $Optional +// NI: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none +// NI-NEXT: hop_to_executor [[GENERIC_EXEC]] : $Optional // NI: hop_to_executor [[BORROWED_EXEC:%.*]] : // NI-NEXT: end_borrow [[BORROWED_EXEC]] // NI-NEXT: {{%[0-9]+}} = apply {{%[0-9]+}}({{%[0-9]+}}, {{%[0-9]+}}) : $@convention(method) (@owned String, @thin Dog.Type) -> Dog -// NI: hop_to_executor [[GENERIC_EXEC]] : $Optional +// NI: hop_to_executor [[GENERIC_EXEC]] : $Optional // NI: } // end sil function '$s12initializers7makeDogyyYaF' -// NI-NS-LABEL: sil hidden [ossa] @$s12initializers7makeDogyyYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> () { -// NI-NS: bb0([[ACTOR:%.*]] : @guaranteed $Optional): +// NI-NS-LABEL: sil hidden [ossa] @$s12initializers7makeDogyyYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> () { +// NI-NS: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor): // NI-NS: hop_to_executor [[ACTOR]] // NI-NS: hop_to_executor [[BORROWED_EXEC:%.*]] : // NI-NS-NEXT: end_borrow [[BORROWED_EXEC]] @@ -213,16 +218,16 @@ func makeDog() async { } // NI-LABEL: sil hidden [ossa] @$s12initializers8makeBirbyyYaF : $@convention(thin) @async () -> () { -// NI: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none -// NI-NEXT: hop_to_executor [[GENERIC_EXEC]] : $Optional +// NI: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none +// NI-NEXT: hop_to_executor [[GENERIC_EXEC]] : $Optional // NI: hop_to_executor [[BORROWED_EXEC:%.*]] : $MainActor // NI-NEXT: end_borrow [[BORROWED_EXEC]] // NI-NEXT: {{%[0-9]+}} = apply {{%[0-9]+}}({{%[0-9]+}}, {{%[0-9]+}}) : $@convention(method) (@owned String, @thin Birb.Type) -> Birb -// NI: hop_to_executor [[GENERIC_EXEC]] : $Optional +// NI: hop_to_executor [[GENERIC_EXEC]] : $Optional // NI: } // end sil function '$s12initializers8makeBirbyyYaF' -// NI-NS-LABEL: sil hidden [ossa] @$s12initializers8makeBirbyyYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> () { -// NI-NS: bb0([[ACTOR:%.*]] : @guaranteed $Optional): +// NI-NS-LABEL: sil hidden [ossa] @$s12initializers8makeBirbyyYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> () { +// NI-NS: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor): // NI-NS-NEXT: hop_to_executor [[ACTOR]] // NI-NS: hop_to_executor [[BORROWED_EXEC:%.*]] : $MainActor // NI-NS-NEXT: end_borrow [[BORROWED_EXEC]] @@ -238,7 +243,7 @@ actor SomeActor { // CHECK-LABEL: sil hidden [ossa] @$s12initializers9SomeActorCACyYacfc : $@convention(method) @async (@sil_isolated @owned SomeActor) -> @owned SomeActor { // CHECK: bb0(%0 : - // CHECK-NEXT: [[NIL_EXECUTOR:%.*]] = enum $Optional, #Optional.none + // CHECK-NEXT: [[NIL_EXECUTOR:%.*]] = enum $Optional, #Optional.none // CHECK-NEXT: hop_to_executor [[NIL_EXECUTOR]] init() async {} @@ -260,14 +265,14 @@ func makeActor() async -> SomeActor { } // NI-LABEL: sil hidden [ossa] @$s12initializers20makeActorFromGenericAA04SomeC0CyYaF : $@convention(thin) @async () -> @owned SomeActor { -// NI: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none -// NI-NEXT: hop_to_executor [[GENERIC_EXEC]] : $Optional +// NI: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none +// NI-NEXT: hop_to_executor [[GENERIC_EXEC]] : $Optional // NI: apply -// NI-NEXT: hop_to_executor [[GENERIC_EXEC]] : $Optional +// NI-NEXT: hop_to_executor [[GENERIC_EXEC]] : $Optional // NI: } // end sil function '$s12initializers20makeActorFromGenericAA04SomeC0CyYaF' -// NI-NS-LABEL: sil hidden [ossa] @$s12initializers20makeActorFromGenericAA04SomeC0CyYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> @owned SomeActor { -// NI-NS: bb0([[ACTOR:%.*]] : @guaranteed $Optional): +// NI-NS-LABEL: sil hidden [ossa] @$s12initializers20makeActorFromGenericAA04SomeC0CyYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> @owned SomeActor { +// NI-NS: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor): // NI-NS: hop_to_executor [[ACTOR]] // NI-NS: apply {{%.*}}({{%.*}}) // NI-NS-NEXT: hop_to_executor [[ACTOR]] @@ -277,14 +282,14 @@ func makeActorFromGeneric() async -> SomeActor { } // NI-LABEL: sil hidden [ossa] @$s12initializers26callActorMethodFromGeneric1ayAA04SomeC0C_tYaF : -// NI: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none -// NI-NEXT: hop_to_executor [[GENERIC_EXEC]] : $Optional +// NI: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none +// NI-NEXT: hop_to_executor [[GENERIC_EXEC]] : $Optional // NI: apply -// NI-NEXT: hop_to_executor [[GENERIC_EXEC]] : $Optional +// NI-NEXT: hop_to_executor [[GENERIC_EXEC]] : $Optional // NI: } // end sil function '$s12initializers26callActorMethodFromGeneric1ayAA04SomeC0C_tYaF' -// NI-NS-LABEL: sil hidden [ossa] @$s12initializers26callActorMethodFromGeneric1ayAA04SomeC0C_tYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed SomeActor) -> () { -// NI-NS: bb0([[ACTOR:%.*]] : @guaranteed $Optional, [[ARG:%.*]] : @guaranteed $SomeActor): +// NI-NS-LABEL: sil hidden [ossa] @$s12initializers26callActorMethodFromGeneric1ayAA04SomeC0C_tYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed SomeActor) -> () { +// NI-NS: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, [[ARG:%.*]] : @guaranteed $SomeActor): // NI-NS: hop_to_executor [[ACTOR]] // NI-NS: [[FUNC:%.*]] = class_method [[ARG]] // NI-NS: apply [[FUNC]]([[ARG]]) @@ -295,29 +300,29 @@ func callActorMethodFromGeneric(a: SomeActor) async { } // NI-LABEL: sil hidden {{.*}} @$s12initializers15makeActorInTaskyyYaF : $@convention(thin) @async () -> () { -// NI: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none -// NI-NEXT: hop_to_executor [[GENERIC_EXEC]] : $Optional +// NI: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none +// NI-NEXT: hop_to_executor [[GENERIC_EXEC]] : $Optional // NI: apply // NI: } // end sil function '$s12initializers15makeActorInTaskyyYaF' -// NI-NS-LABEL: sil hidden{{.*}} [ossa] @$s12initializers15makeActorInTaskyyYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> () { -// NI-NS: bb0([[ACTOR:%.*]] : @guaranteed $Optional): +// NI-NS-LABEL: sil hidden{{.*}} [ossa] @$s12initializers15makeActorInTaskyyYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> () { +// NI-NS: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor): // NI-NS: hop_to_executor [[ACTOR]] // NI-NS: apply // NI-NS: } // end sil function '$s12initializers15makeActorInTaskyyYaF' // NI-LABEL: sil private [ossa] @$s12initializers15makeActorInTaskyyYaFAA04SomeC0CyYacfU_ : $@convention(thin) @async @substituted <τ_0_0> (@guaranteed Optional) -> @out τ_0_0 for { -// NI: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none -// NI-NEXT: hop_to_executor [[GENERIC_EXEC]] : $Optional +// NI: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none +// NI-NEXT: hop_to_executor [[GENERIC_EXEC]] : $Optional // NI: apply -// NI-NEXT: hop_to_executor [[GENERIC_EXEC]] : $Optional +// NI-NEXT: hop_to_executor [[GENERIC_EXEC]] : $Optional // NI: } // end sil function '$s12initializers15makeActorInTaskyyYaFAA04SomeC0CyYacfU_' // NI-NS-LABEL: sil private [ossa] @$s12initializers15makeActorInTaskyyYaFAA04SomeC0CyYacfU_ : $@convention(thin) @async @substituted <τ_0_0> (@guaranteed Optional) -> @out τ_0_0 for { -// NI-NS: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none -// NI-NS-NEXT: hop_to_executor [[GENERIC_EXEC]] : $Optional +// NI-NS: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none +// NI-NS-NEXT: hop_to_executor [[GENERIC_EXEC]] : $Optional // NI-NS: apply -// NI-NS-NEXT: hop_to_executor [[GENERIC_EXEC]] : $Optional +// NI-NS-NEXT: hop_to_executor [[GENERIC_EXEC]] : $Optional // NI-NS: } // end sil function '$s12initializers15makeActorInTaskyyYaFAA04SomeC0CyYacfU_' @available(SwiftStdlib 5.1, *) func makeActorInTask() async { @@ -325,21 +330,21 @@ func makeActorInTask() async { } // NI-LABEL: sil hidden {{.*}} @$s12initializers21callActorMethodInTask1ayAA04SomeC0C_tYaF : $@convention(thin) @async (@guaranteed SomeActor) -> () { -// NI: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none -// NI-NEXT: hop_to_executor [[GENERIC_EXEC]] : $Optional +// NI: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none +// NI-NEXT: hop_to_executor [[GENERIC_EXEC]] : $Optional // NI: apply // NI: } // end sil function '$s12initializers21callActorMethodInTask1ayAA04SomeC0C_tYaF' -// NI-NS-LABEL: sil hidden{{.*}} [ossa] @$s12initializers21callActorMethodInTask1ayAA04SomeC0C_tYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed SomeActor) -> () { -// NI-NS: bb0([[ACTOR:%.*]] : @guaranteed $Optional, [[ARG:%.*]] : @guaranteed $SomeActor): +// NI-NS-LABEL: sil hidden{{.*}} [ossa] @$s12initializers21callActorMethodInTask1ayAA04SomeC0C_tYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed SomeActor) -> () { +// NI-NS: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, [[ARG:%.*]] : @guaranteed $SomeActor): // NI-NS: hop_to_executor [[ACTOR]] // NI-NS: } // end sil function '$s12initializers21callActorMethodInTask1ayAA04SomeC0C_tYaF' // CHECK-LABEL: sil private [ossa] @$s12initializers21callActorMethodInTask1ayAA04SomeC0C_tYaFyyYacfU_ : $@convention(thin) @async @substituted <τ_0_0> (@guaranteed Optional, @guaranteed SomeActor) -> @out τ_0_0 for <()> { -// CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none -// CHECK-NEXT: hop_to_executor [[GENERIC_EXEC]] : $Optional +// CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none +// CHECK-NEXT: hop_to_executor [[GENERIC_EXEC]] : $Optional // CHECK: apply -// CHECK-NEXT: hop_to_executor [[GENERIC_EXEC]] : $Optional +// CHECK-NEXT: hop_to_executor [[GENERIC_EXEC]] : $Optional @available(SwiftStdlib 5.1, *) func callActorMethodInTask(a: SomeActor) async { Task.detached { await a.someMethod() } diff --git a/test/SILGen/back_deployed_attr.swift b/test/SILGen/back_deployed_attr.swift index 928e5ea987e61..9e3696ec1177c 100644 --- a/test/SILGen/back_deployed_attr.swift +++ b/test/SILGen/back_deployed_attr.swift @@ -93,7 +93,7 @@ public func backDeployedCaller(_ s: inout S) { @backDeployed(before: macOS 10.52) nonisolated(nonsending) public func backDeployedNonisolatedNonsending() async -> Int { - // CHECK: bb0(%0 : @guaranteed $Optional): + // CHECK: bb0(%0 : @guaranteed $Builtin.ImplicitIsolationActor): // CHECK: [[FALLBACK_FN:%.*]] = function_ref @$s11back_deploy0A29DeployedNonisolatedNonsendingSiyYaFTwB : // CHECK: apply [[FALLBACK_FN]](%0) // CHECK: [[SHIPPING_FN:%.*]] = function_ref @$s11back_deploy0A29DeployedNonisolatedNonsendingSiyYaF : diff --git a/test/SILGen/execution_attr.swift b/test/SILGen/execution_attr.swift index 63dc3f0aac675..a83d6fae89357 100644 --- a/test/SILGen/execution_attr.swift +++ b/test/SILGen/execution_attr.swift @@ -9,7 +9,7 @@ // CHECK-LABEL: // executionCaller() // CHECK-NEXT: // Isolation: caller_isolation_inheriting -// CHECK-NEXT: sil hidden [ossa] @$s14execution_attr0A6CalleryyYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> () { +// CHECK-NEXT: sil hidden [ossa] @$s14execution_attr0A6CalleryyYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> () { nonisolated(nonsending) func executionCaller() async {} @@ -19,15 +19,15 @@ func executionCaller() async {} @concurrent func executionConcurrent() async {} -// DISABLED: sil hidden [ossa] @$s14execution_attr0A15CallerParameteryyyyYaYCXEYaF : $@convention(thin) @async (@guaranteed @noescape @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> ()) -> () { -// ENABLED: sil hidden [ossa] @$s14execution_attr0A15CallerParameteryyyyYaYCXEYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed @noescape @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> ()) -> () { +// DISABLED: sil hidden [ossa] @$s14execution_attr0A15CallerParameteryyyyYaYCXEYaF : $@convention(thin) @async (@guaranteed @noescape @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> ()) -> () { +// ENABLED: sil hidden [ossa] @$s14execution_attr0A15CallerParameteryyyyYaYCXEYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed @noescape @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> ()) -> () { // CHECK: } // end sil function '$s14execution_attr0A15CallerParameteryyyyYaYCXEYaF' func executionCallerParameter(_ x: nonisolated(nonsending) () async -> ()) async { await x() } // DISABLED-LABEL: sil hidden [ossa] @$s14execution_attr0A19ConcurrentParameteryyyyYaXEYaF : $@convention(thin) @async (@guaranteed @noescape @async @callee_guaranteed () -> ()) -> () { -// ENABLED-LABEL: sil hidden [ossa] @$s14execution_attr0A19ConcurrentParameteryyyyYaXEYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed @noescape @async @callee_guaranteed () -> ()) -> () { +// ENABLED-LABEL: sil hidden [ossa] @$s14execution_attr0A19ConcurrentParameteryyyyYaXEYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed @noescape @async @callee_guaranteed () -> ()) -> () { func executionConcurrentParameter(_ x: @concurrent () async -> ()) async { await x() } @@ -38,15 +38,17 @@ struct S { // DISABLED: sil hidden [ossa] @$s14execution_attr0A11CallerFieldyyAA1SVYaF : $@convention(thin) @async (@guaranteed S) -> () { // DISABLED: bb0([[ARG:%.*]] : @guaranteed $S): +// DISABLED: [[ACTOR_NONE:%.*]] = enum $Optional, #Optional.none!enumelt +// DISABLED: hop_to_executor [[ACTOR_NONE]] // DISABLED: [[FIELD:%.*]] = struct_extract [[ARG]] // DISABLED: [[FIELD_COPY:%.*]] = copy_value [[FIELD]] -// DISABLED: [[ACTOR_NONE:%.*]] = enum $Optional, #Optional.none!enumelt +// DISABLED: [[ACTOR_NONE_CAST:%.*]] = unchecked_value_cast [[ACTOR_NONE]] to $Builtin.ImplicitIsolationActor // DISABLED: [[BORROWED_FIELD:%.*]] = begin_borrow [[FIELD_COPY]] -// DISABLED: apply [[BORROWED_FIELD]]([[ACTOR_NONE]]) +// DISABLED: apply [[BORROWED_FIELD]]([[ACTOR_NONE_CAST]]) // DISABLED: } // end sil function '$s14execution_attr0A11CallerFieldyyAA1SVYaF' -// ENABLED: sil hidden [ossa] @$s14execution_attr0A11CallerFieldyyAA1SVYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed S) -> () { -// ENABLED: bb0([[ACTOR:%.*]] : @guaranteed $Optional, [[ARG:%.*]] : @guaranteed $S): +// ENABLED: sil hidden [ossa] @$s14execution_attr0A11CallerFieldyyAA1SVYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed S) -> () { +// ENABLED: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, [[ARG:%.*]] : @guaranteed $S): // ENABLED: [[FIELD:%.*]] = struct_extract [[ARG]] // ENABLED: [[FIELD_COPY:%.*]] = copy_value [[FIELD]] // ENABLED: [[BORROWED_FIELD:%.*]] = begin_borrow [[FIELD_COPY]] @@ -59,13 +61,13 @@ func executionCallerField(_ s: S) async { extension S { // CHECK-LABEL: // S.executionCallerFieldMethod(_:) // CHECK: // Isolation: unspecified - // CHECK: sil hidden [ossa] @$s14execution_attr1SV0A17CallerFieldMethodyyyyYaYCXEF : $@convention(method) (@guaranteed @noescape @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> (), @guaranteed S) -> () { + // CHECK: sil hidden [ossa] @$s14execution_attr1SV0A17CallerFieldMethodyyyyYaYCXEF : $@convention(method) (@guaranteed @noescape @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> (), @guaranteed S) -> () { func executionCallerFieldMethod(_ x: nonisolated(nonsending) () async -> ()) {} } // CHECK-LABEL: sil hidden [ossa] @$s14execution_attr24testWithDynamicIsolation2fnyyyYAXE_tYaF : $@convention(thin) @async (@guaranteed @isolated(any) @noescape @callee_guaranteed () -> ()) -> () { // CHECK: bb0([[PARAM_FN:%.*]] : @guaranteed $@isolated(any) @noescape @callee_guaranteed () -> ()): -// CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none!enumelt +// CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none!enumelt // CHECK-NEXT: hop_to_executor [[GENERIC_EXEC]] // CHECK-NEXT: [[FN:%.*]] = copy_value [[PARAM_FN]] // CHECK-NEXT: [[BORROWED_FN:%.*]] = begin_borrow [[FN]] @@ -80,8 +82,8 @@ func testWithDynamicIsolation(fn: @isolated(any) () -> Void) async { await fn() } -// CHECK-LABEL: sil hidden [ossa] @$s14execution_attr38testCallerIsolatedWithDynamicIsolation2fnyyyYAXE_tYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed @isolated(any) @noescape @callee_guaranteed () -> ()) -> () { -// CHECK: bb0([[ISOLATION:%.*]] : @guaranteed $Optional, [[PARAM_FN:%.*]] : @guaranteed $@isolated(any) @noescape @callee_guaranteed () -> ()): +// CHECK-LABEL: sil hidden [ossa] @$s14execution_attr38testCallerIsolatedWithDynamicIsolation2fnyyyYAXE_tYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed @isolated(any) @noescape @callee_guaranteed () -> ()) -> () { +// CHECK: bb0([[ISOLATION:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, [[PARAM_FN:%.*]] : @guaranteed $@isolated(any) @noescape @callee_guaranteed () -> ()): // CHECK: hop_to_executor [[ISOLATION]] // CHECK-NEXT: [[FN:%.*]] = copy_value [[PARAM_FN]] // CHECK-NEXT: [[BORROWED_FN:%.*]] = begin_borrow [[FN]] diff --git a/test/SILGen/hop_to_executor.swift b/test/SILGen/hop_to_executor.swift index a1daf20bed2c5..27399f366e61f 100644 --- a/test/SILGen/hop_to_executor.swift +++ b/test/SILGen/hop_to_executor.swift @@ -3,7 +3,7 @@ // CHECK-LABEL: sil hidden [ossa] @$s4test16unspecifiedAsyncyyYaF : $@convention(thin) @async () -> () // CHECK: bb0: -// CHECK-NEXT: [[GENERIC:%[0-9]+]] = enum $Optional, #Optional.none!enumelt +// CHECK-NEXT: [[GENERIC:%[0-9]+]] = enum $Optional, #Optional.none!enumelt // CHECK-NEXT: hop_to_executor [[GENERIC]] // CHECK: } // end sil function '$s4test16unspecifiedAsyncyyYaF' func unspecifiedAsync() async {} @@ -13,7 +13,7 @@ actor MyActor { private var p: Int // CHECK-LABEL: sil hidden [ossa] @$s4test7MyActorC6calleeyySiYaF : $@convention(method) @async (Int, @guaranteed MyActor) -> () { - // CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none + // CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none // CHECK: hop_to_executor [[GENERIC_EXEC]] : // CHECK: } // end sil function '$s4test7MyActorC6calleeyySiYaF' nonisolated func callee(_ x: Int) async { @@ -21,7 +21,7 @@ actor MyActor { } // CHECK-LABEL: sil hidden [ossa] @$s4test7MyActorC14throwingCalleeyySiYaKF : $@convention(method) @async (Int, @guaranteed MyActor) -> @error any Error { - // CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none + // CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none // CHECK: hop_to_executor [[GENERIC_EXEC]] : // CHECK: } // end sil function '$s4test7MyActorC14throwingCalleeyySiYaKF' nonisolated func throwingCallee(_ x: Int) async throws { @@ -283,7 +283,7 @@ struct BlueActor { } // CHECK-LABEL: sil hidden [ossa] @$s4test20unspecifiedAsyncFuncyyYaF : $@convention(thin) @async () -> () { -// CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none +// CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none // CHECK-NEXT: hop_to_executor [[GENERIC_EXEC]] : // CHECK: [[BORROW:%[0-9]+]] = begin_borrow {{%[0-9]+}} : $RedActorImpl // CHECK-NEXT: hop_to_executor [[BORROW]] : $RedActorImpl @@ -298,7 +298,7 @@ func unspecifiedAsyncFunc() async { // CHECK-LABEL: sil hidden [ossa] @$s4test27anotherUnspecifiedAsyncFuncyyAA12RedActorImplCYaF : $@convention(thin) @async (@guaranteed RedActorImpl) -> () { // CHECK: bb0([[RED:%[0-9]+]] : @guaranteed $RedActorImpl): -// CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none +// CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none // CHECK-NEXT: hop_to_executor [[GENERIC_EXEC]] : // CHECK: [[INTARG:%[0-9]+]] = apply {{%[0-9]+}}({{%[0-9]+}}, {{%[0-9]+}}) : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int // CHECK: [[METH:%[0-9]+]] = class_method [[RED]] : $RedActorImpl, #RedActorImpl.hello : (isolated RedActorImpl) -> (Int) -> (), $@convention(method) (Int, @sil_isolated @guaranteed RedActorImpl) -> () @@ -311,14 +311,14 @@ func anotherUnspecifiedAsyncFunc(_ red : RedActorImpl) async { } // CHECK-LABEL: sil hidden [ossa] @$s4test0A20GlobalActorFuncValueyyyyAA03RedC0VYcXEYaF -// CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none +// CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none // CHECK: hop_to_executor [[GENERIC_EXEC]] : // CHECK: function_ref @$s4test8RedActorV6sharedAA0bC4ImplCvgZ // CHECK: hop_to_executor [[RED:%[0-9]+]] : $RedActorImpl // CHECK-NEXT: end_borrow [[RED]] // CHECK-NEXT: begin_borrow // CHECK-NEXT: apply -// CHECK: hop_to_executor [[GENERIC_EXEC:%[0-9]+]] : $Optional +// CHECK: hop_to_executor [[GENERIC_EXEC:%[0-9]+]] : $Optional func testGlobalActorFuncValue(_ fn: @RedActor () -> Void) async { await fn() } @@ -482,18 +482,18 @@ extension MyActor { func testImplicitAsyncIsolatedParam( i: Int, d: Double, actor: MyActor, otherActor: MyActor ) async { - // CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none + // CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none // CHECK-NEXT: hop_to_executor [[GENERIC_EXEC]] : // CHECK: [[FN1:%.*]] = function_ref @$s4test19acceptIsolatedParamyySi_AA7MyActorCYiSdtF // CHECK-NEXT: hop_to_executor [[ACTOR:%.*]] : $MyActor // CHECK-NEXT: apply [[FN1]](%0, %2, %1) : $@convention(thin) (Int, @sil_isolated @guaranteed MyActor, Double) -> () - // CHECK-NEXT: hop_to_executor [[GENERIC_EXEC]] : $Optional + // CHECK-NEXT: hop_to_executor [[GENERIC_EXEC]] : $Optional await acceptIsolatedParam(i, actor, d) // CHECK: [[FN2:%.*]] = function_ref @$s4test7MyActorC13otherIsolatedyySi_ACYiSdtF : $@convention(method) (Int, @sil_isolated @guaranteed MyActor, Double, @guaranteed MyActor) -> () // CHECK-NEXT: hop_to_executor [[ACTOR:%.*]] : $MyActor // CHECK-NEXT: apply [[FN2]](%0, %2, %1, %3) : $@convention(method) (Int, @sil_isolated @guaranteed MyActor, Double, @guaranteed MyActor) -> () - // CHECK-NEXT: hop_to_executor [[GENERIC_EXEC]] : $Optional + // CHECK-NEXT: hop_to_executor [[GENERIC_EXEC]] : $Optional await otherActor.otherIsolated(i, actor, d) } diff --git a/test/SILGen/hop_to_executor_async_prop.swift b/test/SILGen/hop_to_executor_async_prop.swift index 979725b076998..b86bb550c1b98 100644 --- a/test/SILGen/hop_to_executor_async_prop.swift +++ b/test/SILGen/hop_to_executor_async_prop.swift @@ -81,7 +81,7 @@ struct GlobalCat { // CHECK-LABEL: sil hidden [ossa] @$s4test015accessSweaterOfC03catAA0C0VAA3CatC_tYaF : $@convention(thin) @async (@guaranteed Cat) -> @owned Sweater { // CHECK: bb0([[CAT:%[0-9]+]] : @guaranteed $Cat): -// CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none +// CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none // CHECK: hop_to_executor [[GENERIC_EXEC]] : // CHECK: [[CAT_GETTER:%[0-9]+]] = class_method [[CAT]] : $Cat, #Cat.computedSweater!getter : (isolated Cat) -> () -> Sweater, $@convention(method) (@sil_isolated @guaranteed Cat) -> @owned Sweater // CHECK: hop_to_executor [[CAT]] : $Cat @@ -110,7 +110,7 @@ func accessSweaterOfSweater(cat : Cat) async -> Sweater { // CHECK-LABEL: sil hidden [ossa] @$s4test26accessGlobalIsolatedMember3catSSAA3CatC_tYaF : $@convention(thin) @async (@guaranteed Cat) -> @owned String { // CHECK: bb0([[CAT:%[0-9]+]] : @guaranteed $Cat): -// CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none +// CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none // CHECK: hop_to_executor [[GENERIC_EXEC]] : // CHECK: [[GETTER:%[0-9]+]] = class_method [[CAT]] : $Cat, #Cat.leader!getter : (Cat) -> () -> String, $@convention(method) (@guaranteed Cat) -> @owned String @@ -443,21 +443,21 @@ struct Container { @GlobalCat var isoRef: CatBox = CatBox() // CHECK-LABEL: sil hidden [ossa] @$s4test9ContainerV12accessTuple1SfyYaF : $@convention(method) @async (@guaranteed Container) -> Float { - // CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none + // CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none // CHECK: hop_to_executor [[GENERIC_EXEC]] : // CHECK: hop_to_executor {{%[0-9]+}} : $MainActor // CHECK: [[ACCESS:%[0-9]+]] = begin_access [read] [dynamic] {{%[0-9]+}} : $*(Optional<(Int, Int)>, Float) // CHECK: [[ADDR:%[0-9]+]] = tuple_element_addr [[ACCESS]] : $*(Optional<(Int, Int)>, Float), 1 // CHECK: {{%[0-9]+}} = load [trivial] [[ADDR]] : $*Float // CHECK: end_access [[ACCESS]] : $*(Optional<(Int, Int)>, Float) - // CHECK: hop_to_executor [[GENERIC_EXEC]] : $Optional + // CHECK: hop_to_executor [[GENERIC_EXEC]] : $Optional // CHECK: } // end sil function '$s4test9ContainerV12accessTuple1SfyYaF' func accessTuple1() async -> Float { return await globalCircle.1 } // CHECK-LABEL: sil hidden [ossa] @$s4test9ContainerV12accessTuple2SiSgyYaFZ : $@convention(method) @async (@thin Container.Type) -> Optional { - // CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none + // CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none // CHECK: hop_to_executor [[GENERIC_EXEC]] : // CHECK: hop_to_executor {{%[0-9]+}} : $MainActor // CHECK: [[ACCESS:%[0-9]+]] = begin_access [read] [dynamic] {{%[0-9]+}} : $*(Optional<(Int, Int)>, Float) @@ -473,37 +473,37 @@ struct Container { // CHECK: [[ELM_ADDR:%[0-9]+]] = tuple_element_addr [[TUPLE_ADDR]] : $*(Int, Int), 0 // CHECK: {{%[0-9]+}} = load [trivial] [[ELM_ADDR]] : $*Int // CHECK: end_access [[ACCESS]] : $*(Optional<(Int, Int)>, Float) - // CHECK: hop_to_executor [[GENERIC_EXEC]] : $Optional + // CHECK: hop_to_executor [[GENERIC_EXEC]] : $Optional // CHECK: } // end sil function '$s4test9ContainerV12accessTuple2SiSgyYaFZ' static func accessTuple2() async -> Int? { return await globalCircle.0!.0 } // CHECK-LABEL: sil hidden [ossa] @$s4test9ContainerV12accessTuple3SfyYaF : $@convention(method) @async (@guaranteed Container) -> Float { - // CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none + // CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none // CHECK: hop_to_executor [[GENERIC_EXEC]] : // CHECK: [[ADDRESS_ACCESSOR:%[0-9]+]] = function_ref @$s4test9ContainerV12staticCircleSi_SitSg_Sftvau : $@convention(thin) () -> Builtin.RawPointer // CHECK: hop_to_executor {{%[0-9]+}} : $MainActor // CHECK: = apply [[ADDRESS_ACCESSOR]]() : $@convention(thin) () -> Builtin.RawPointer - // CHECK: hop_to_executor [[GENERIC_EXEC]] : $Optional + // CHECK: hop_to_executor [[GENERIC_EXEC]] : $Optional // CHECK: hop_to_executor {{%[0-9]+}} : $MainActor // CHECK: [[ACCESS:%[0-9]+]] = begin_access [read] [dynamic] {{%[0-9]+}} : $*(Optional<(Int, Int)>, Float) // CHECK: [[ADDR:%[0-9]+]] = tuple_element_addr [[ACCESS]] : $*(Optional<(Int, Int)>, Float), 1 // CHECK: {{%[0-9]+}} = load [trivial] [[ADDR]] : $*Float // CHECK: end_access [[ACCESS]] : $*(Optional<(Int, Int)>, Float) - // CHECK: hop_to_executor [[GENERIC_EXEC]] : $Optional + // CHECK: hop_to_executor [[GENERIC_EXEC]] : $Optional // CHECK: } // end sil function '$s4test9ContainerV12accessTuple3SfyYaF' func accessTuple3() async -> Float { return await Container.staticCircle.1 } // CHECK-LABEL: sil hidden [ossa] @$s4test9ContainerV12accessTuple4SiSgyYaFZ : $@convention(method) @async (@thin Container.Type) -> Optional { - // CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none + // CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none // CHECK: hop_to_executor [[GENERIC_EXEC]] : // CHECK: [[ADDRESS_ACCESSOR:%[0-9]+]] = function_ref @$s4test9ContainerV12staticCircleSi_SitSg_Sftvau : $@convention(thin) () -> Builtin.RawPointer // CHECK: hop_to_executor {{%[0-9]+}} : $MainActor // CHECK: = apply [[ADDRESS_ACCESSOR]]() : $@convention(thin) () -> Builtin.RawPointer - // CHECK: hop_to_executor [[GENERIC_EXEC]] : $Optional + // CHECK: hop_to_executor [[GENERIC_EXEC]] : $Optional // CHECK: hop_to_executor {{%[0-9]+}} : $MainActor // CHECK: [[ACCESS:%[0-9]+]] = begin_access [read] [dynamic] {{%[0-9]+}} : $*(Optional<(Int, Int)>, Float) // CHECK: [[ADDR:%[0-9]+]] = tuple_element_addr [[ACCESS]] : $*(Optional<(Int, Int)>, Float), 0 @@ -518,7 +518,7 @@ struct Container { // CHECK: [[ELM_ADDR:%[0-9]+]] = tuple_element_addr [[TUPLE_ADDR]] : $*(Int, Int), 0 // CHECK: {{%[0-9]+}} = load [trivial] [[ELM_ADDR]] : $*Int // CHECK: end_access [[ACCESS]] : $*(Optional<(Int, Int)>, Float) - // CHECK: hop_to_executor [[GENERIC_EXEC]] : $Optional + // CHECK: hop_to_executor [[GENERIC_EXEC]] : $Optional // CHECK: } // end sil function '$s4test9ContainerV12accessTuple4SiSgyYaFZ' static func accessTuple4() async -> Int? { return await Container.staticCircle.0!.0 @@ -526,16 +526,16 @@ struct Container { // CHECK-LABEL: sil hidden [ossa] @$s4test9ContainerV8getCountSiyYaFZ : $@convention(method) @async (@thin Container.Type) -> Int { - // CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none + // CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none // CHECK: hop_to_executor [[GENERIC_EXEC]] : // CHECK: [[ADDRESS_ACCESSOR:%[0-9]+]] = function_ref @$s4test9ContainerV7counterSivau : $@convention(thin) () -> Builtin.RawPointer // CHECK: hop_to_executor {{%[0-9]+}} : $MainActor // CHECK: = apply [[ADDRESS_ACCESSOR]]() : $@convention(thin) () -> Builtin.RawPointer - // CHECK: hop_to_executor [[GENERIC_EXEC]] : $Optional + // CHECK: hop_to_executor [[GENERIC_EXEC]] : $Optional // CHECK: hop_to_executor {{%[0-9]+}} : $MainActor // CHECK: {{%[0-9]+}} = begin_access [read] [dynamic] {{%[0-9]+}} : $*Int // CHECK: {{%[0-9]+}} = load [trivial] {{%[0-9]+}} : $*Int - // CHECK: hop_to_executor [[GENERIC_EXEC]] : $Optional + // CHECK: hop_to_executor [[GENERIC_EXEC]] : $Optional // CHECK: } // end sil function '$s4test9ContainerV8getCountSiyYaFZ' static func getCount() async -> Int { return await counter @@ -544,12 +544,12 @@ struct Container { // CHECK-LABEL: sil hidden [ossa] @$s4test9ContainerV8getValueSiSgyYaFZ : $@convention(method) @async (@thin Container.Type) -> Optional { // CHECK: bb0(%0 : $@thin Container.Type): - // CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none + // CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none // CHECK: hop_to_executor [[GENERIC_EXEC]] : // CHECK: [[ADDRESS_ACCESSOR:%[0-9]+]] = function_ref @$s4test9ContainerV4thisACSgvau : $@convention(thin) () -> Builtin.RawPointer // CHECK: hop_to_executor {{%[0-9]+}} : $MainActor // CHECK: = apply [[ADDRESS_ACCESSOR]]() : $@convention(thin) () -> Builtin.RawPointer - // CHECK: hop_to_executor {{%[0-9]+}} : $Optional + // CHECK: hop_to_executor {{%[0-9]+}} : $Optional // CHECK: [[MAIN:%[0-9]+]] = begin_borrow {{%[0-9]+}} : $MainActor // CHECK: hop_to_executor [[MAIN]] : $MainActor // CHECK: [[ACCESS:%[0-9]+]] = begin_access [read] [dynamic] {{%[0-9]+}} : $*Optional @@ -558,11 +558,11 @@ struct Container { // CHECK: [[TRUE_BB]]: // CHECK: {{%[0-9]+}} = load [trivial] {{%[0-9]+}} : $*Int // CHECK: end_access [[ACCESS]] : $*Optional - // CHECK: hop_to_executor [[GENERIC_EXEC]] : $Optional + // CHECK: hop_to_executor [[GENERIC_EXEC]] : $Optional // // CHECK: [[FALSE_BB]]: // CHECK: end_access [[ACCESS]] : $*Optional - // CHECK: hop_to_executor [[GENERIC_EXEC]] : $Optional + // CHECK: hop_to_executor [[GENERIC_EXEC]] : $Optional // // CHECK: } // end sil function '$s4test9ContainerV8getValueSiSgyYaFZ' static func getValue() async -> Int? { @@ -571,12 +571,12 @@ struct Container { // CHECK-LABEL: sil hidden [ossa] @$s4test9ContainerV10getOrCrashSfyYaFZ : $@convention(method) @async (@thin Container.Type) -> Float { // CHECK: bb0({{%[0-9]+}} : $@thin Container.Type): - // CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none + // CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none // CHECK: hop_to_executor [[GENERIC_EXEC]] : // CHECK: [[ADDRESS_ACCESSOR:%[0-9]+]] = function_ref @$s4test9ContainerV4thisACSgvau : $@convention(thin) () -> Builtin.RawPointer // CHECK: hop_to_executor {{%[0-9]+}} : $MainActor // CHECK: = apply [[ADDRESS_ACCESSOR]]() : $@convention(thin) () -> Builtin.RawPointer - // CHECK: hop_to_executor [[GENERIC_EXEC]] : $Optional + // CHECK: hop_to_executor [[GENERIC_EXEC]] : $Optional // CHECK: hop_to_executor {{%.*}} : $MainActor // CHECK: [[ACCESS:%[0-9]+]] = begin_access [read] [dynamic] {{%[0-9]+}} : $*Optional // CHECK: switch_enum_addr [[ACCESS]] : $*Optional, case #Optional.some!enumelt: [[SOME_BB:bb[0-9]+]], case #Optional.none!enumelt: [[CRASH_BB:bb[0-9]+]] @@ -597,12 +597,12 @@ struct Container { // CHECK-LABEL: sil hidden [ossa] @$s4test9ContainerV13getRefOrCrashAA6CatBoxCyYaFZ : $@convention(method) @async (@thin Container.Type) -> @owned CatBox { // CHECK: bb0({{%[0-9]+}} : $@thin Container.Type): - // CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none + // CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none // CHECK: hop_to_executor [[GENERIC_EXEC]] : // CHECK: [[ADDRESS_ACCESSOR:%[0-9]+]] = function_ref @$s4test9ContainerV4thisACSgvau : $@convention(thin) () -> Builtin.RawPointer // CHECK: hop_to_executor {{%[0-9]+}} : $MainActor // CHECK: = apply [[ADDRESS_ACCESSOR]]() : $@convention(thin) () -> Builtin.RawPointer - // CHECK: hop_to_executor [[GENERIC_EXEC]] : $Optional + // CHECK: hop_to_executor [[GENERIC_EXEC]] : $Optional // CHECK: hop_to_executor {{%.*}} : $MainActor // CHECK: [[ACCESS:%[0-9]+]] = begin_access [read] [dynamic] {{%[0-9]+}} : $*Optional // CHECK: switch_enum_addr [[ACCESS]] : $*Optional, case #Optional.some!enumelt: [[SOME_BB:bb[0-9]+]], case #Optional.none!enumelt: [[CRASH_BB:bb[0-9]+]] @@ -642,18 +642,18 @@ struct Blah { // closure #1 in Blah.test() // CHECK-LABEL: sil private [ossa] @$s4test4BlahVAAyyFyyYacfU_ : $@convention(thin) @async @substituted <τ_0_0> (@guaranteed Optional, Blah) -> @out τ_0_0 for <()> { - // CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none + // CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none // CHECK: hop_to_executor [[GENERIC_EXEC]] : // CHECK: hop_to_executor {{%[0-9]+}} : $MainActor // CHECK: [[ACTOR_OBJ_RAW:%[0-9]+]] = apply {{%[0-9]+}}({{%[0-9]+}}) : $@convention(method) (Blah) -> @owned Coordinator - // CHECK: hop_to_executor {{%[0-9]+}} : $Optional + // CHECK: hop_to_executor {{%[0-9]+}} : $Optional // CHECK: [[ACTOR_OBJ:%[0-9]+]] = begin_borrow [[ACTOR_OBJ_RAW]] : $Coordinator // CHECK: [[VAL:%[0-9]+]] = ref_element_addr [[ACTOR_OBJ]] : $Coordinator, #Coordinator.someValue // CHECK: hop_to_executor [[ACTOR_OBJ]] // CHECK: [[VAL_ACCESS:%[0-9]+]] = begin_access [read] [dynamic] [[VAL]] : $*Optional // CHECK: {{%[0-9]+}} = load [trivial] [[VAL_ACCESS]] : $*Optional // CHECK: end_access [[VAL_ACCESS]] : $*Optional - // CHECK: hop_to_executor [[GENERIC_EXEC]] : $Optional + // CHECK: hop_to_executor [[GENERIC_EXEC]] : $Optional // CHECK: } // end sil function '$s4test4BlahVAAyyFyyYacfU_' @available(SwiftStdlib 5.1, *) func test() { @@ -677,16 +677,16 @@ class Polar { // CHECK-LABEL: sil hidden{{.*}} @$s4test20accessStaticIsolatedSiyYaF : $@convention(thin) @async () -> Int { -// CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none +// CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none // CHECK: hop_to_executor [[GENERIC_EXEC]] : // CHECK: [[ADDRESSOR:%[0-9]+]] = function_ref @$s4test5PolarC11temperatureSivau : $@convention(thin) () -> Builtin.RawPointer // CHECK: hop_to_executor {{%.*}} : $MainActor // CHECK-NEXT: [[RAW_ADDR:%[0-9]+]] = apply [[ADDRESSOR]]() : $@convention(thin) () -> Builtin.RawPointer -// CHECK-NEXT: hop_to_executor {{%.*}} : $Optional +// CHECK-NEXT: hop_to_executor {{%.*}} : $Optional // CHECK: [[ADDR:%[0-9]+]] = pointer_to_address [[RAW_ADDR]] : $Builtin.RawPointer to [strict] $*Int // CHECK: hop_to_executor {{%.*}} : $MainActor // CHECK: {{%.*}} = load [trivial] {{%.*}} : $*Int -// CHECK: hop_to_executor [[GENERIC_EXEC]] : $Optional +// CHECK: hop_to_executor [[GENERIC_EXEC]] : $Optional func accessStaticIsolated() async -> Int { return await Polar.temperature } diff --git a/test/SILGen/isolated_any.swift b/test/SILGen/isolated_any.swift index 5956b01db67c6..cf4d42ce1cf8a 100644 --- a/test/SILGen/isolated_any.swift +++ b/test/SILGen/isolated_any.swift @@ -3,7 +3,7 @@ // REQUIRES: asserts // CHECK-LABEL: sil hidden [ossa] @$s4test8callSync2fnyyyYbYAXE_tYaF -// CHECK: [[NIL_EXECUTOR:%.*]] = enum $Optional, #Optional.none +// CHECK: [[NIL_EXECUTOR:%.*]] = enum $Optional, #Optional.none // CHECK-NEXT: hop_to_executor [[NIL_EXECUTOR]] // CHECK-NEXT: [[FN_COPY:%.*]] = copy_value %0 : $@isolated(any) @noescape @Sendable @callee_guaranteed () -> () // CHECK-NEXT: [[FN_BORROW1:%.*]] = begin_borrow [[FN_COPY]] : @@ -19,7 +19,7 @@ func callSync(fn: @isolated(any) @Sendable () -> ()) async { } // CHECK-LABEL: sil hidden [ossa] @$s4test9callAsync2fnyyyYaYbYAXE_tYaF -// CHECK: [[NIL_EXECUTOR:%.*]] = enum $Optional, #Optional.none +// CHECK: [[NIL_EXECUTOR:%.*]] = enum $Optional, #Optional.none // CHECK-NEXT: hop_to_executor [[NIL_EXECUTOR]] // CHECK-NEXT: [[FN_COPY:%.*]] = copy_value %0 : $@isolated(any) @noescape @Sendable @async @callee_guaranteed () -> () // CHECK-NEXT: [[FN_BORROW2:%.*]] = begin_borrow [[FN_COPY]] : diff --git a/test/SILGen/nonisolated_inherits_isolation.swift b/test/SILGen/nonisolated_inherits_isolation.swift index bb4c0a25fd939..2d88b3d764e7b 100644 --- a/test/SILGen/nonisolated_inherits_isolation.swift +++ b/test/SILGen/nonisolated_inherits_isolation.swift @@ -19,8 +19,8 @@ func unspecifiedAsyncUse(_ t: NonSendableKlass) async {} // CHECK-LABEL: // nonisolatedAsync() // CHECK-NEXT: Isolation: caller_isolation_inheriting -// CHECK-NEXT: sil hidden [ossa] @$s30nonisolated_inherits_isolation0A5AsyncyyYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> () { -// CHECK: bb0([[ACTOR:%.*]] : @guaranteed $Optional): +// CHECK-NEXT: sil hidden [ossa] @$s30nonisolated_inherits_isolation0A5AsyncyyYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> () { +// CHECK: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor): // CHECK: hop_to_executor [[ACTOR]] // CHECK: } // end sil function '$s30nonisolated_inherits_isolation0A5AsyncyyYaF' nonisolated func nonisolatedAsync() async {} @@ -29,10 +29,10 @@ func unspecifiedAsyncCallee() async {} // CHECK-LABEL: // unspecifiedAsync() // CHECK-NEXT: Isolation: caller_isolation_inheriting -// CHECK-NEXT: sil hidden [ossa] @$s30nonisolated_inherits_isolation16unspecifiedAsyncyyYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> () { -// CHECK: bb0([[ARG:%.*]] : @guaranteed $Optional): +// CHECK-NEXT: sil hidden [ossa] @$s30nonisolated_inherits_isolation16unspecifiedAsyncyyYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> () { +// CHECK: bb0([[ARG:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor): // CHECK: hop_to_executor [[ACTOR]] -// CHECK: [[FUNC_REF:%.*]] = function_ref @$s30nonisolated_inherits_isolation22unspecifiedAsyncCalleeyyYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> () +// CHECK: [[FUNC_REF:%.*]] = function_ref @$s30nonisolated_inherits_isolation22unspecifiedAsyncCalleeyyYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> () // CHECK: apply [[FUNC_REF]]([[ACTOR]]) // CHECK: hop_to_executor [[ACTOR]] // CHECK: } // end sil function '$s30nonisolated_inherits_isolation16unspecifiedAsyncyyYaF' @@ -53,7 +53,7 @@ struct NonisolatedStruct { // // CHECK-LABEL: // NonisolatedStruct.init(asynchronous:) // CHECK-NEXT: // Isolation: caller_isolation_inheriting - // CHECK-NEXT: sil hidden [ossa] @$s30nonisolated_inherits_isolation17NonisolatedStructV12asynchronousACyt_tYacfC : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @thin NonisolatedStruct.Type) -> NonisolatedStruct { + // CHECK-NEXT: sil hidden [ossa] @$s30nonisolated_inherits_isolation17NonisolatedStructV12asynchronousACyt_tYacfC : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @thin NonisolatedStruct.Type) -> NonisolatedStruct { // CHECK: } // end sil function '$s30nonisolated_inherits_isolation17NonisolatedStructV12asynchronousACyt_tYacfC' init(asynchronous: ()) async {} @@ -63,19 +63,19 @@ struct NonisolatedStruct { // But do apply it to async methods. // CHECK-LABEL: // NonisolatedStruct.asyncMethod() // CHECK-NEXT: // Isolation: caller_isolation_inheriting - // CHECK-NEXT: sil hidden [ossa] @$s30nonisolated_inherits_isolation17NonisolatedStructV11asyncMethodyyYaF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, NonisolatedStruct) -> () { + // CHECK-NEXT: sil hidden [ossa] @$s30nonisolated_inherits_isolation17NonisolatedStructV11asyncMethodyyYaF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, NonisolatedStruct) -> () { // CHECK: } // end sil function '$s30nonisolated_inherits_isolation17NonisolatedStructV11asyncMethodyyYaF' func asyncMethod() async {} } // CHECK-LABEL: // useNonisolatedStruct() // CHECK-NEXT: // Isolation: caller_isolation_inheriting -// CHECK-NEXT: sil hidden [ossa] @$s30nonisolated_inherits_isolation20useNonisolatedStructyyYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> () { +// CHECK-NEXT: sil hidden [ossa] @$s30nonisolated_inherits_isolation20useNonisolatedStructyyYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> () { // CHECK: bb0([[ACTOR:%.*]] : // CHECK: hop_to_executor [[ACTOR]] // CHECK: [[VALUE:%.*]] = apply {{%.*}}({{%.*}}) : $@convention(method) (@thin NonisolatedStruct.Type) -> NonisolatedStruct // CHECK: [[VAR_DECL:%.*]] = move_value [var_decl] [[VALUE]] -// CHECK: [[ASYNC_CALL:%.*]] = function_ref @$s30nonisolated_inherits_isolation17NonisolatedStructV11asyncMethodyyYaF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, NonisolatedStruct) -> () +// CHECK: [[ASYNC_CALL:%.*]] = function_ref @$s30nonisolated_inherits_isolation17NonisolatedStructV11asyncMethodyyYaF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, NonisolatedStruct) -> () // CHECK: apply [[ASYNC_CALL]]([[ACTOR]], [[VAR_DECL]]) // CHECK: hop_to_executor [[ACTOR]] // CHECK: extend_lifetime [[VAR_DECL]] @@ -90,13 +90,13 @@ func useNonisolatedStruct() async { // CHECK-LABEL: // useNonisolatedStruct2() // CHECK-NEXT: // Isolation: caller_isolation_inheriting -// CHECK-NEXT: sil hidden [ossa] @$s30nonisolated_inherits_isolation21useNonisolatedStruct2yyYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> () { +// CHECK-NEXT: sil hidden [ossa] @$s30nonisolated_inherits_isolation21useNonisolatedStruct2yyYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> () { // CHECK: bb0([[ACTOR:%.*]] : // CHECK: hop_to_executor [[ACTOR]] -// CHECK: [[VALUE:%.*]] = apply {{%.*}}([[ACTOR]], {{%.*}}) : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @thin NonisolatedStruct.Type) -> NonisolatedStruct +// CHECK: [[VALUE:%.*]] = apply {{%.*}}([[ACTOR]], {{%.*}}) : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @thin NonisolatedStruct.Type) -> NonisolatedStruct // CHECK: hop_to_executor [[ACTOR]] // CHECK: [[VAR_DECL:%.*]] = move_value [var_decl] [[VALUE]] -// CHECK: apply {{%.*}}([[ACTOR]], [[VAR_DECL]]) : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, NonisolatedStruct) -> () +// CHECK: apply {{%.*}}([[ACTOR]], [[VAR_DECL]]) : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, NonisolatedStruct) -> () // CHECK: hop_to_executor [[ACTOR]] // CHECK: extend_lifetime [[VAR_DECL]] // CHECK: } // end sil function '$s30nonisolated_inherits_isolation21useNonisolatedStruct2yyYaF' @@ -142,7 +142,9 @@ class MainActorKlass { // CHECK: [[B_ACTOR_COPY:%.*]] = copy_value [[B_ACTOR]] // CHECK: [[B_ACTOR_COPY_EX:%.*]] = init_existential_ref [[B_ACTOR_COPY]] : $MainActor // CHECK: [[B_ACTOR_COPY_EX_OPT:%.*]] = enum $Optional, #Optional.some!enumelt, [[B_ACTOR_COPY_EX]] - // CHECK: apply {{%.*}}([[B_ACTOR_COPY_EX_OPT]], [[B_VAR_DECL_2]]) : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed NonSendableKlass) -> () + // CHECK: [[B_ACTOR_COPY_EX_OPT_B:%.*]] = begin_borrow [[B_ACTOR_COPY_EX_OPT]] + // CHECK: [[B_ACTOR_COPY_EX_OPT_B_CAST:%.*]] = unchecked_value_cast [[B_ACTOR_COPY_EX_OPT_B]] to $Builtin.ImplicitIsolationActor + // CHECK: apply {{%.*}}([[B_ACTOR_COPY_EX_OPT_B_CAST]], [[B_VAR_DECL_2]]) : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed NonSendableKlass) -> () // CHECK: hop_to_executor [[B_ACTOR]] // CHECK: } // end sil function '$s30nonisolated_inherits_isolation14MainActorKlassC24callNonIsolatedWithParamyyYaF' func callNonIsolatedWithParam() async { @@ -154,16 +156,16 @@ class MainActorKlass { struct TestVarUse { var test: Int { - // CHECK-LABEL: sil hidden [ossa] @$s30nonisolated_inherits_isolation10TestVarUseV4testSivg : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, TestVarUse) -> Int + // CHECK-LABEL: sil hidden [ossa] @$s30nonisolated_inherits_isolation10TestVarUseV4testSivg : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, TestVarUse) -> Int get async { 42 } } } -// CHECK-LABEL: sil hidden [ossa] @$s30nonisolated_inherits_isolation12testUseOfVar1tyAA04TestgE0V_tYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, TestVarUse) -> () -// CHECK: bb0([[ISOLATION:%.*]] : @guaranteed $Optional, [[BASE:%.*]] : $TestVarUse) -// CHECK: [[GETTER:%.*]] = function_ref @$s30nonisolated_inherits_isolation10TestVarUseV4testSivg : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, TestVarUse) -> Int +// CHECK-LABEL: sil hidden [ossa] @$s30nonisolated_inherits_isolation12testUseOfVar1tyAA04TestgE0V_tYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, TestVarUse) -> () +// CHECK: bb0([[ISOLATION:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, [[BASE:%.*]] : $TestVarUse) +// CHECK: [[GETTER:%.*]] = function_ref @$s30nonisolated_inherits_isolation10TestVarUseV4testSivg : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, TestVarUse) -> Int // CHECK: {{.*}} = apply [[GETTER]]([[ISOLATION]], [[BASE]]) // CHECK: } // end sil function '$s30nonisolated_inherits_isolation12testUseOfVar1tyAA04TestgE0V_tYaF' func testUseOfVar(t: TestVarUse) async { diff --git a/test/SILGen/objc_async.swift b/test/SILGen/objc_async.swift index bf6eb7a038823..093aa80c646c7 100644 --- a/test/SILGen/objc_async.swift +++ b/test/SILGen/objc_async.swift @@ -255,7 +255,7 @@ func testThrowingMethodFromMain(slowServer: SlowServer) async -> String { // rdar://91502776 // CHECK-LABEL: sil hidden [ossa] @$s{{.*}}21checkCostcoMembershipSbyYaF : $@convention(thin) @async () -> Bool { // CHECK: bb0: -// CHECK: hop_to_executor {{%.*}} : $Optional +// CHECK: hop_to_executor {{%.*}} : $Optional // CHECK: [[FINAL_BUF:%.*]] = alloc_stack $Bool // CHECK: [[RESULT_BUF:%.*]] = alloc_stack $NSObject // CHECK: [[METH:%.*]] = objc_method {{%.*}} : $@objc_metatype Person.Type, #Person.asCustomer!foreign @@ -264,7 +264,7 @@ func testThrowingMethodFromMain(slowServer: SlowServer) async -> String { // CHECK: dealloc_stack {{%.*}} : $*@block_storage // CHECK: await_async_continuation {{%.*}} : $Builtin.RawUnsafeContinuation, resume bb1 // CHECK: bb1: -// CHECK: hop_to_executor {{%.*}} : $Optional +// CHECK: hop_to_executor {{%.*}} : $Optional // CHECK: [[RESULT:%.*]] = load [take] [[RESULT_BUF]] : $*NSObject // CHECK: objc_method {{%.*}} : $CostcoManager, #CostcoManager.isCustomerEnrolled!foreign // CHECK: get_async_continuation_addr Bool, [[FINAL_BUF]] : $*Bool @@ -275,7 +275,7 @@ func testThrowingMethodFromMain(slowServer: SlowServer) async -> String { // CHECK: dealloc_stack [[BLOCK_STORAGE]] : $*@block_storage // CHECK: await_async_continuation {{%.*}} : $Builtin.RawUnsafeContinuation, resume bb2 // CHECK: bb2: -// CHECK: hop_to_executor {{%.*}} : $Optional +// CHECK: hop_to_executor {{%.*}} : $Optional // CHECK: [[ANSWER:%.*]] = load [trivial] [[FINAL_BUF]] : $*Bool // CHECK: fix_lifetime [[EXTEND2]] : $CostcoManager // CHECK: destroy_value [[EXTEND2]] : $CostcoManager @@ -325,7 +325,7 @@ extension OptionalMemberLookups { // CHECK: destroy_value {{.*}} : $MainActor // CHECK: dealloc_stack {{.*}} : $*AutoreleasingUnsafeMutablePointer> // CHECK: dealloc_stack {{.*}} : $*@sil_unmanaged Optional -// CHECK: hop_to_executor {{.*}} : $Optional +// CHECK: hop_to_executor {{.*}} : $Optional // CHECK: switch_enum func checkHotdogs(_ v: some HotdogCompetitor, _ timeLimit: NSObject) async throws -> String? { return try await v.pileOfHotdogsToEat(withLimit: timeLimit) diff --git a/test/SILGen/objc_async_checked.swift b/test/SILGen/objc_async_checked.swift index d716256c1b974..ff491ef76f75c 100644 --- a/test/SILGen/objc_async_checked.swift +++ b/test/SILGen/objc_async_checked.swift @@ -306,7 +306,7 @@ func testThrowingMethodFromMain(slowServer: SlowServer) async -> String { // rdar://91502776 // CHECK-LABEL: sil hidden [ossa] @$s{{.*}}21checkCostcoMembershipSbyYaF : $@convention(thin) @async () -> Bool { // CHECK: bb0: -// CHECK: hop_to_executor {{%.*}} : $Optional +// CHECK: hop_to_executor {{%.*}} : $Optional // CHECK: [[FINAL_BUF:%.*]] = alloc_stack $Bool // CHECK: [[RESULT_BUF:%.*]] = alloc_stack $NSObject // CHECK: [[METH:%.*]] = objc_method {{%.*}} : $@objc_metatype Person.Type, #Person.asCustomer!foreign @@ -317,7 +317,7 @@ func testThrowingMethodFromMain(slowServer: SlowServer) async -> String { // CHECK: dealloc_stack {{%.*}} : $*@block_storage // CHECK: await_async_continuation {{%.*}} : $Builtin.RawUnsafeContinuation, resume bb1 // CHECK: bb1: -// CHECK: hop_to_executor {{%.*}} : $Optional +// CHECK: hop_to_executor {{%.*}} : $Optional // CHECK: [[RESULT:%.*]] = load [take] [[RESULT_BUF]] : $*NSObject // CHECK: objc_method {{%.*}} : $CostcoManager, #CostcoManager.isCustomerEnrolled!foreign // CHECK: get_async_continuation_addr Bool, [[FINAL_BUF]] : $*Bool @@ -328,7 +328,7 @@ func testThrowingMethodFromMain(slowServer: SlowServer) async -> String { // CHECK: dealloc_stack [[BLOCK_STORAGE]] : $*@block_storage // CHECK: await_async_continuation {{%.*}} : $Builtin.RawUnsafeContinuation, resume bb2 // CHECK: bb2: -// CHECK: hop_to_executor {{%.*}} : $Optional +// CHECK: hop_to_executor {{%.*}} : $Optional // CHECK: [[ANSWER:%.*]] = load [trivial] [[FINAL_BUF]] : $*Bool // CHECK: fix_lifetime [[EXTEND2]] : $CostcoManager // CHECK: destroy_value [[EXTEND2]] : $CostcoManager diff --git a/test/SILGen/objc_async_from_swift.swift b/test/SILGen/objc_async_from_swift.swift index 49bd3b9705fbb..dfc675ac257a8 100644 --- a/test/SILGen/objc_async_from_swift.swift +++ b/test/SILGen/objc_async_from_swift.swift @@ -19,8 +19,8 @@ import ObjCConcurrency // CHECK-LABEL: sil {{.*}}@{{.*}}15testSlowServing func testSlowServing(p: SlowServing) async throws { - // CHECK-NN: bb0([[HOP_TARGET:%.*]] : @guaranteed $Optional, - // CHECK-C: [[HOP_TARGET:%.*]] = enum $Optional, #Optional.none + // CHECK-NN: bb0([[HOP_TARGET:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, + // CHECK-C: [[HOP_TARGET:%.*]] = enum $Optional, #Optional.none // CHECK: hop_to_executor [[HOP_TARGET]] : // CHECK: objc_method {{.*}} $@convention(objc_method) <τ_0_0 where τ_0_0 : SlowServing> (@convention(block) (Int) -> (), τ_0_0) -> () // CHECK: hop_to_executor [[HOP_TARGET]] : @@ -43,8 +43,8 @@ func testSlowServing(p: SlowServing) async throws { // CHECK-LABEL: sil {{.*}}@{{.*}}20testSlowServingAgain func testSlowServingAgain(p: SlowServing) async throws { - // CHECK-NN: bb0([[HOP_TARGET:%.*]] : @guaranteed $Optional, - // CHECK-C: [[HOP_TARGET:%.*]] = enum $Optional, #Optional.none + // CHECK-NN: bb0([[HOP_TARGET:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, + // CHECK-C: [[HOP_TARGET:%.*]] = enum $Optional, #Optional.none // CHECK: hop_to_executor [[HOP_TARGET]] : // CHECK: objc_method {{.*}} $@convention(objc_method) <τ_0_0 where τ_0_0 : SlowServing> (@convention(block) (Optional, Optional) -> (), τ_0_0) -> () // CHECK: hop_to_executor [[HOP_TARGET]] : @@ -55,8 +55,8 @@ func testSlowServingAgain(p: SlowServing) async throws { class SlowSwiftServer: NSObject, SlowServing { // CHECK-LABEL: sil {{.*}} @$s21objc_async_from_swift15SlowSwiftServerC10requestIntSiyYaF - // CHECK-NN: bb0([[HOP_TARGET:%.*]] : @guaranteed $Optional, - // CHECK-C: [[HOP_TARGET:%.*]] = enum $Optional, #Optional.none + // CHECK-NN: bb0([[HOP_TARGET:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, + // CHECK-C: [[HOP_TARGET:%.*]] = enum $Optional, #Optional.none // CHECK: hop_to_executor [[HOP_TARGET]] : // CHECK: } // end sil function '$s21objc_async_from_swift15SlowSwiftServerC10requestIntSiyYaF{{.*}}' // CHECK-LABEL: sil private {{.*}} @${{.*}}10requestInt{{.*}}To : @@ -74,12 +74,12 @@ class SlowSwiftServer: NSObject, SlowServing { func requestInt() async -> Int { return 0 } func requestString() async -> String { return "" } // CHECK-LABEL: sil {{.*}} @$s21objc_async_from_swift15SlowSwiftServerC13requestStringSSyYaF - // CHECK-NN: bb0([[HOP_TARGET:%.*]] : @guaranteed $Optional, - // CHECK-C: [[HOP_TARGET:%.*]] = enum $Optional, #Optional.none + // CHECK-NN: bb0([[HOP_TARGET:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, + // CHECK-C: [[HOP_TARGET:%.*]] = enum $Optional, #Optional.none // CHECK: hop_to_executor [[HOP_TARGET]] : // CHECK-LABEL: sil {{.*}} @$s21objc_async_from_swift15SlowSwiftServerC16tryRequestStringSSyYaKF - // CHECK-NN: bb0([[HOP_TARGET:%.*]] : @guaranteed $Optional, - // CHECK-C: [[HOP_TARGET:%.*]] = enum $Optional, #Optional.none + // CHECK-NN: bb0([[HOP_TARGET:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, + // CHECK-C: [[HOP_TARGET:%.*]] = enum $Optional, #Optional.none // CHECK: hop_to_executor [[HOP_TARGET]] : // CHECK-LABEL: sil shared {{.*}} @${{.*}}16tryRequestString{{.*}}U_To : // CHECK: [[BLOCK_COPY:%.*]] = copy_block %0 @@ -95,14 +95,14 @@ class SlowSwiftServer: NSObject, SlowServing { func tryRequestString() async throws -> String { return "" } // CHECK-LABEL: sil {{.*}} @$s21objc_async_from_swift15SlowSwiftServerC19requestIntAndStringSi_SStyYaF - // CHECK-NN: bb0([[HOP_TARGET:%.*]] : @guaranteed $Optional, - // CHECK-C: [[HOP_TARGET:%.*]] = enum $Optional, #Optional.none + // CHECK-NN: bb0([[HOP_TARGET:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, + // CHECK-C: [[HOP_TARGET:%.*]] = enum $Optional, #Optional.none // CHECK: hop_to_executor [[HOP_TARGET]] : func requestIntAndString() async -> (Int, String) { return (0, "") } // CHECK-LABEL: sil {{.*}} @$s21objc_async_from_swift15SlowSwiftServerC22tryRequestIntAndStringSi_SStyYaKF - // CHECK-NN: bb0([[HOP_TARGET:%.*]] : @guaranteed $Optional, - // CHECK-C: [[HOP_TARGET:%.*]] = enum $Optional, #Optional.none + // CHECK-NN: bb0([[HOP_TARGET:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, + // CHECK-C: [[HOP_TARGET:%.*]] = enum $Optional, #Optional.none // CHECK: hop_to_executor [[HOP_TARGET]] : func tryRequestIntAndString() async throws -> (Int, String) { return (0, "") } } @@ -122,16 +122,17 @@ extension SlowServer: NativelySlowServing {} // CHECK-C-LABEL: sil private [transparent] [thunk] [ossa] @$sSo10SlowServerC21objc_async_from_swift08NativelyA7ServingA2cDP011doSomethingA0ySiSSYaFTW : $@convention(witness_method: NativelySlowServing) @async (@guaranteed String, @in_guaranteed SlowServer) -> Int { // CHECK-C: bb0([[ARG:%.*]] : @guaranteed $String, [[SELF_ADDR:%.*]] : $*SlowServer): // CHECK-C: [[SELF:%.*]] = load_borrow [[SELF_ADDR]] -// CHECK-C: [[FUNC:%.*]] = function_ref @$sSo10SlowServerC011doSomethingA0ySiSSYaFTO : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed String, @guaranteed SlowServer) -> Int +// CHECK-C: [[FUNC:%.*]] = function_ref @$sSo10SlowServerC011doSomethingA0ySiSSYaFTO : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed String, @guaranteed SlowServer) -> Int // CHECK-C: [[ACTOR:%.*]] = enum $Optional, #Optional.none!enumelt -// CHECK-C: hop_to_executor [[ACTOR]] -// CHECK-C: apply [[FUNC]]([[ACTOR]], [[ARG]], [[SELF]]) +// CHECK-C: [[ACTOR_C:%.*]] = unchecked_value_cast [[ACTOR]] : $Optional to $Builtin.ImplicitIsolationActor +// CHECK-C: hop_to_executor [[ACTOR_C]] +// CHECK-C: apply [[FUNC]]([[ACTOR_C]], [[ARG]], [[SELF]]) // CHECK-C: } // end sil function '$sSo10SlowServerC21objc_async_from_swift08NativelyA7ServingA2cDP011doSomethingA0ySiSSYaFTW' -// CHECK-NN-LABEL: sil private [transparent] [thunk] [ossa] @$sSo10SlowServerC21objc_async_from_swift08NativelyA7ServingA2cDP011doSomethingA0ySiSSYaFTW : $@convention(witness_method: NativelySlowServing) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed String, @in_guaranteed SlowServer) -> Int { -// CHECK-NN: bb0([[ACTOR:%.*]] : @guaranteed $Optional, [[ARG:%.*]] : @guaranteed $String, [[SELF_ADDR:%.*]] : $*SlowServer): +// CHECK-NN-LABEL: sil private [transparent] [thunk] [ossa] @$sSo10SlowServerC21objc_async_from_swift08NativelyA7ServingA2cDP011doSomethingA0ySiSSYaFTW : $@convention(witness_method: NativelySlowServing) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed String, @in_guaranteed SlowServer) -> Int { +// CHECK-NN: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, [[ARG:%.*]] : @guaranteed $String, [[SELF_ADDR:%.*]] : $*SlowServer): // CHECK-NN: [[SELF:%.*]] = load_borrow [[SELF_ADDR]] -// CHECK-NN: [[FUNC:%.*]] = function_ref @$sSo10SlowServerC011doSomethingA0ySiSSYaFTO : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed String, @guaranteed SlowServer) -> Int +// CHECK-NN: [[FUNC:%.*]] = function_ref @$sSo10SlowServerC011doSomethingA0ySiSSYaFTO : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed String, @guaranteed SlowServer) -> Int // CHECK-NN: apply [[FUNC]]([[ACTOR]], [[ARG]], [[SELF]]) // CHECK-NN: hop_to_executor [[ACTOR]] // CHECK-NN: } // end sil function '$sSo10SlowServerC21objc_async_from_swift08NativelyA7ServingA2cDP011doSomethingA0ySiSSYaFTW' @@ -140,16 +141,17 @@ extension SlowServer: NativelySlowServing {} // CHECK-C-LABEL: sil private [transparent] [thunk] [ossa] @$sSo10SlowServerC21objc_async_from_swift08NativelyA7ServingA2cDP10findAnswerSSyYaKFTW : $@convention(witness_method: NativelySlowServing) @async (@in_guaranteed SlowServer) -> (@owned String, @error any Error) { // CHECK-C: bb0([[SELF_ADDR:%.*]] : $*SlowServer): // CHECK-C: [[SELF:%.*]] = load_borrow [[SELF_ADDR]] -// CHECK-C: [[FUNC:%.*]] = function_ref @$sSo10SlowServerC10findAnswerSSyYaKFTO : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed SlowServer) -> (@owned String, @error any Error) +// CHECK-C: [[FUNC:%.*]] = function_ref @$sSo10SlowServerC10findAnswerSSyYaKFTO : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed SlowServer) -> (@owned String, @error any Error) // CHECK-C: [[ACTOR:%.*]] = enum $Optional, #Optional.none!enumelt -// CHECK-C: hop_to_executor [[ACTOR]] -// CHECK-C: try_apply [[FUNC]]([[ACTOR]], [[SELF]]) +// CHECK-C: [[ACTOR_CAST:%.*]] = unchecked_value_cast [[ACTOR]] : $Optional to $Builtin.ImplicitIsolationActor +// CHECK-C: hop_to_executor [[ACTOR_CAST]] +// CHECK-C: try_apply [[FUNC]]([[ACTOR_CAST]], [[SELF]]) // CHECK-C: } // end sil function '$sSo10SlowServerC21objc_async_from_swift08NativelyA7ServingA2cDP10findAnswerSSyYaKFTW' -// CHECK-NN-LABEL: sil private [transparent] [thunk] [ossa] @$sSo10SlowServerC21objc_async_from_swift08NativelyA7ServingA2cDP10findAnswerSSyYaKFTW : $@convention(witness_method: NativelySlowServing) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @in_guaranteed SlowServer) -> (@owned String, @error any Error) { -// CHECK-NN: bb0([[ACTOR:%.*]] : @guaranteed $Optional, [[SELF_ADDR:%.*]] : $*SlowServer): +// CHECK-NN-LABEL: sil private [transparent] [thunk] [ossa] @$sSo10SlowServerC21objc_async_from_swift08NativelyA7ServingA2cDP10findAnswerSSyYaKFTW : $@convention(witness_method: NativelySlowServing) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @in_guaranteed SlowServer) -> (@owned String, @error any Error) { +// CHECK-NN: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, [[SELF_ADDR:%.*]] : $*SlowServer): // CHECK-NN: [[SELF:%.*]] = load_borrow [[SELF_ADDR]] -// CHECK-NN: [[FUNC:%.*]] = function_ref @$sSo10SlowServerC10findAnswerSSyYaKFTO : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed SlowServer) -> (@owned String, @error any Error) +// CHECK-NN: [[FUNC:%.*]] = function_ref @$sSo10SlowServerC10findAnswerSSyYaKFTO : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed SlowServer) -> (@owned String, @error any Error) // CHECK-NN: try_apply [[FUNC]]([[ACTOR]], [[SELF]]) // // CHECK-NN: bb1( @@ -163,16 +165,17 @@ extension SlowServer: NativelySlowServing {} // CHECK-C-LABEL: sil private [transparent] [thunk] [ossa] @$sSo10SlowServerC21objc_async_from_swift08NativelyA7ServingA2cDP13serverRestartyySSYaFTW : $@convention(witness_method: NativelySlowServing) @async (@guaranteed String, @in_guaranteed SlowServer) -> () { // CHECK-C: bb0([[ARG:%.*]] : @guaranteed $String, [[SELF_PTR:%.*]] : $*SlowServer): // CHECK-C: [[SELF:%.*]] = load_borrow [[SELF_PTR]] -// CHECK-C: [[FUNC:%.*]] = function_ref @$sSo10SlowServerC13serverRestartyySSYaFTO : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed String, @guaranteed SlowServer) -> () +// CHECK-C: [[FUNC:%.*]] = function_ref @$sSo10SlowServerC13serverRestartyySSYaFTO : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed String, @guaranteed SlowServer) -> () // CHECK-C: [[ACTOR:%.*]] = enum $Optional, #Optional.none!enumelt -// CHECK-C: hop_to_executor [[ACTOR]] -// CHECK-C: apply [[FUNC]]([[ACTOR]], [[ARG]], [[SELF]]) +// CHECK-C: [[ACTOR_CAST:%.*]] = unchecked_value_cast [[ACTOR]] : $Optional to $Builtin.ImplicitIsolationActor +// CHECK-C: hop_to_executor [[ACTOR_CAST]] +// CHECK-C: apply [[FUNC]]([[ACTOR_CAST]], [[ARG]], [[SELF]]) // CHECK-C: } // end sil function '$sSo10SlowServerC21objc_async_from_swift08NativelyA7ServingA2cDP13serverRestartyySSYaFTW' -// CHECK-NN-LABEL: sil private [transparent] [thunk] [ossa] @$sSo10SlowServerC21objc_async_from_swift08NativelyA7ServingA2cDP13serverRestartyySSYaFTW : $@convention(witness_method: NativelySlowServing) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed String, @in_guaranteed SlowServer) -> () { -// CHECK-NN: bb0([[ACTOR:%.*]] : @guaranteed $Optional, [[ARG:%.*]] : @guaranteed $String, [[SELF_PTR:%.*]] : $*SlowServer): +// CHECK-NN-LABEL: sil private [transparent] [thunk] [ossa] @$sSo10SlowServerC21objc_async_from_swift08NativelyA7ServingA2cDP13serverRestartyySSYaFTW : $@convention(witness_method: NativelySlowServing) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed String, @in_guaranteed SlowServer) -> () { +// CHECK-NN: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, [[ARG:%.*]] : @guaranteed $String, [[SELF_PTR:%.*]] : $*SlowServer): // CHECK-NN: [[SELF:%.*]] = load_borrow [[SELF_PTR]] -// CHECK-NN: [[FUNC:%.*]] = function_ref @$sSo10SlowServerC13serverRestartyySSYaFTO : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed String, @guaranteed SlowServer) -> () +// CHECK-NN: [[FUNC:%.*]] = function_ref @$sSo10SlowServerC13serverRestartyySSYaFTO : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed String, @guaranteed SlowServer) -> () // CHECK-NN: apply [[FUNC]]([[ACTOR]], [[ARG]], [[SELF]]) // CHECK-NN: hop_to_executor [[ACTOR]] // CHECK-NN: } // end sil function '$sSo10SlowServerC21objc_async_from_swift08NativelyA7ServingA2cDP13serverRestartyySSYaFTW' @@ -181,16 +184,17 @@ extension SlowServer: NativelySlowServing {} // CHECK-C-LABEL: sil private [transparent] [thunk] [ossa] @$sSo10SlowServerC21objc_async_from_swift08NativelyA7ServingA2cDP19findMultipleAnswersSS_SityYaKFTW : $@convention(witness_method: NativelySlowServing) @async (@in_guaranteed SlowServer) -> (@owned String, Int, @error any Error) { // CHECK-C: bb0([[SELF_ADDR:%.*]] : $*SlowServer): // CHECK-C: [[SELF:%.*]] = load_borrow [[SELF_ADDR]] -// CHECK-C: [[FUNC:%.*]] = function_ref @$sSo10SlowServerC19findMultipleAnswersSS_SityYaKFTO : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed SlowServer) -> (@owned String, Int, @error any Error) +// CHECK-C: [[FUNC:%.*]] = function_ref @$sSo10SlowServerC19findMultipleAnswersSS_SityYaKFTO : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed SlowServer) -> (@owned String, Int, @error any Error) // CHECK-C: [[ACTOR:%.*]] = enum $Optional, #Optional.none!enumelt -// CHECK-C: hop_to_executor [[ACTOR]] -// CHECK-C: try_apply [[FUNC]]([[ACTOR]], [[SELF]]) +// CHECK-C: [[ACTOR_CAST:%.*]] = unchecked_value_cast [[ACTOR]] : $Optional to $Builtin.ImplicitIsolationActor +// CHECK-C: hop_to_executor [[ACTOR_CAST]] +// CHECK-C: try_apply [[FUNC]]([[ACTOR_CAST]], [[SELF]]) // CHECK-C: } // end sil function '$sSo10SlowServerC21objc_async_from_swift08NativelyA7ServingA2cDP19findMultipleAnswersSS_SityYaKFTW' -// CHECK-NN-LABEL: sil private [transparent] [thunk] [ossa] @$sSo10SlowServerC21objc_async_from_swift08NativelyA7ServingA2cDP19findMultipleAnswersSS_SityYaKFTW : $@convention(witness_method: NativelySlowServing) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @in_guaranteed SlowServer) -> (@owned String, Int, @error any Error) { -// CHECK-NN: bb0([[ACTOR:%.*]] : @guaranteed $Optional, [[SELF_ADDR:%.*]] : $*SlowServer): +// CHECK-NN-LABEL: sil private [transparent] [thunk] [ossa] @$sSo10SlowServerC21objc_async_from_swift08NativelyA7ServingA2cDP19findMultipleAnswersSS_SityYaKFTW : $@convention(witness_method: NativelySlowServing) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @in_guaranteed SlowServer) -> (@owned String, Int, @error any Error) { +// CHECK-NN: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, [[SELF_ADDR:%.*]] : $*SlowServer): // CHECK-NN: [[SELF:%.*]] = load_borrow [[SELF_ADDR]] -// CHECK-NN: [[FUNC:%.*]] = function_ref @$sSo10SlowServerC19findMultipleAnswersSS_SityYaKFTO : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed SlowServer) -> (@owned String, Int, @error any Error) +// CHECK-NN: [[FUNC:%.*]] = function_ref @$sSo10SlowServerC19findMultipleAnswersSS_SityYaKFTO : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed SlowServer) -> (@owned String, Int, @error any Error) // CHECK-NN: try_apply [[FUNC]]([[ACTOR]], [[SELF]]) // // CHECK-NN: bb1( @@ -204,13 +208,13 @@ class SlowServerlet: SlowServer { // Native Function // // CHECK-C-LABEL: sil hidden [ossa] @$s21objc_async_from_swift13SlowServerletC011doSomethingE8NullablyySiSSYaF : $@convention(method) @async (@guaranteed String, @guaranteed SlowServerlet) -> Int - // CHECK-C-NOT: bb0([[ACTOR:%.*]] : @guaranteed $Optional - // CHECK-C: [[ACTOR:%.*]] = enum $Optional, #Optional.none!enumelt + // CHECK-C-NOT: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor + // CHECK-C: [[ACTOR:%.*]] = enum $Optional, #Optional.none!enumelt // CHECK-C: hop_to_executor [[ACTOR]] // CHECK-C: // end sil function '$s21objc_async_from_swift13SlowServerletC011doSomethingE8NullablyySiSSYaF' - // CHECK-NN-LABEL: sil hidden [ossa] @$s21objc_async_from_swift13SlowServerletC011doSomethingE8NullablyySiSSYaF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed String, @guaranteed SlowServerlet) -> Int { - // CHECK-NN: bb0([[ACTOR:%.*]] : @guaranteed $Optional + // CHECK-NN-LABEL: sil hidden [ossa] @$s21objc_async_from_swift13SlowServerletC011doSomethingE8NullablyySiSSYaF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed String, @guaranteed SlowServerlet) -> Int { + // CHECK-NN: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor // CHECK-NN: hop_to_executor [[ACTOR]] // CHECK-NN: } // end sil function '$s21objc_async_from_swift13SlowServerletC011doSomethingE8NullablyySiSSYaF' @@ -221,12 +225,13 @@ class SlowServerlet: SlowServer { // // CHECK-LABEL: sil shared [thunk] [ossa] @$s21objc_async_from_swift13SlowServerletC011doSomethingE8NullablyySiSSYaFyyYacfU_To : $@convention(thin) @Sendable @async (NSString, Optional<@convention(block) @Sendable (Int) -> ()>, SlowServerlet) -> () { // CHECK-NN: [[NONE:%.*]] = enum $Optional, #Optional.none!enumelt + // CHECK-NN: [[NONE_CAST:%.*]] = unchecked_value_cast [[NONE]] : $Optional to $Builtin.ImplicitIsolationActor // CHECK: [[STR_ARG:%.*]] = begin_borrow {{.*}} : $String // CHECK: [[SELF:%.*]] = begin_borrow {{.*}} : $SlowServerlet // CHECK-C: [[FUNC:%.*]] = function_ref @$s21objc_async_from_swift13SlowServerletC011doSomethingE8NullablyySiSSYaF : $@convention(method) @async (@guaranteed String, @guaranteed SlowServerlet) -> Int // CHECK-C: apply [[FUNC]]([[STR_ARG]], [[SELF]]) - // CHECK-NN: [[FUNC:%.*]] = function_ref @$s21objc_async_from_swift13SlowServerletC011doSomethingE8NullablyySiSSYaF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed String, @guaranteed SlowServerlet) -> Int - // CHECK-NN: apply [[FUNC]]([[NONE]], [[STR_ARG]], [[SELF]]) + // CHECK-NN: [[FUNC:%.*]] = function_ref @$s21objc_async_from_swift13SlowServerletC011doSomethingE8NullablyySiSSYaF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed String, @guaranteed SlowServerlet) -> Int + // CHECK-NN: apply [[FUNC]]([[NONE_CAST]], [[STR_ARG]], [[SELF]]) // CHECK: } // end sil function '$s21objc_async_from_swift13SlowServerletC011doSomethingE8NullablyySiSSYaFyyYacfU_To' override func doSomethingSlowNullably(_: String) async -> Int { return 0 @@ -235,25 +240,26 @@ class SlowServerlet: SlowServer { // Native function. // // CHECK-C-LABEL: sil hidden [ossa] @$s21objc_async_from_swift13SlowServerletC18findAnswerNullablyyS2SYaF : $@convention(method) @async (@guaranteed String, @guaranteed SlowServerlet) -> @owned String - // CHECK-C-NOT: bb0([[ACTOR:%.*]] : @guaranteed $Optional - // CHECK-C: [[ACTOR:%.*]] = enum $Optional, #Optional.none!enumelt + // CHECK-C-NOT: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor + // CHECK-C: [[ACTOR:%.*]] = enum $Optional, #Optional.none!enumelt // CHECK-C-NEXT: hop_to_executor [[ACTOR]] // CHECK-C: } // end sil function '$s21objc_async_from_swift13SlowServerletC18findAnswerNullablyyS2SYaF' - // CHECK-NN-LABEL: sil hidden [ossa] @$s21objc_async_from_swift13SlowServerletC18findAnswerNullablyyS2SYaF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed String, @guaranteed SlowServerlet) -> @owned String { - // CHECK-NN: bb0([[ACTOR:%.*]] : @guaranteed $Optional, + // CHECK-NN-LABEL: sil hidden [ossa] @$s21objc_async_from_swift13SlowServerletC18findAnswerNullablyyS2SYaF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed String, @guaranteed SlowServerlet) -> @owned String { + // CHECK-NN: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, // CHECK-NN: hop_to_executor [[ACTOR]] // CHECK-NN: } // end sil function '$s21objc_async_from_swift13SlowServerletC18findAnswerNullablyyS2SYaF' // @objc closure thunk // CHECK-LABEL: sil shared [thunk] [ossa] @$s21objc_async_from_swift13SlowServerletC18findAnswerNullablyyS2SYaFyyYacfU_To : $@convention(thin) @Sendable @async (NSString, Optional<@convention(block) @Sendable (NSString) -> ()>, SlowServerlet) -> () { // CHECK-NN: [[ACTOR:%.*]] = enum $Optional, #Optional.none!enumelt + // CHECK-NN: [[ACTOR_CAST:%.*]] = unchecked_value_cast [[ACTOR]] : $Optional to $Builtin.ImplicitIsolationActor // CHECK: [[STR_ARG:%.*]] = begin_borrow {{.*}} : $String // CHECK: [[SELF:%.*]] = begin_borrow {{.*}} : $SlowServerlet // CHECK-C: [[FUNC:%.*]] = function_ref @$s21objc_async_from_swift13SlowServerletC18findAnswerNullablyyS2SYaF : $@convention(method) @async (@guaranteed String, @guaranteed SlowServerlet) -> @owned String // CHECK-C: apply [[FUNC]]([[STR_ARG]], [[SELF]]) - // CHECK-NN: [[FUNC:%.*]] = function_ref @$s21objc_async_from_swift13SlowServerletC18findAnswerNullablyyS2SYaF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed String, @guaranteed SlowServerlet) -> @owned String - // CHECK-NN: apply [[FUNC]]([[ACTOR]], [[STR_ARG]], [[SELF]]) + // CHECK-NN: [[FUNC:%.*]] = function_ref @$s21objc_async_from_swift13SlowServerletC18findAnswerNullablyyS2SYaF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed String, @guaranteed SlowServerlet) -> @owned String + // CHECK-NN: apply [[FUNC]]([[ACTOR_CAST]], [[STR_ARG]], [[SELF]]) // CHECK: } // end sil function '$s21objc_async_from_swift13SlowServerletC18findAnswerNullablyyS2SYaFyyYacfU_To' override func findAnswerNullably(_ x: String) async -> String { return x @@ -262,13 +268,13 @@ class SlowServerlet: SlowServer { // Native // // CHECK-C-LABEL: sil hidden [ossa] @$s21objc_async_from_swift13SlowServerletC28doSomethingDangerousNullablyyS2SYaKF : $@convention(method) @async (@guaranteed String, @guaranteed SlowServerlet) -> (@owned String, @error any Error) - // CHECK-C-NOT: bb0([[ACTOR:%.*]] : @guaranteed $Optional, - // CHECK-C: [[ACTOR:%.*]] = enum $Optional, #Optional.none!enumelt + // CHECK-C-NOT: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, + // CHECK-C: [[ACTOR:%.*]] = enum $Optional, #Optional.none!enumelt // CHECK-C-NEXT: hop_to_executor [[ACTOR]] // CHECK-C: } // end sil function '$s21objc_async_from_swift13SlowServerletC28doSomethingDangerousNullablyyS2SYaKF' - // CHECK-NN-LABEL: sil hidden [ossa] @$s21objc_async_from_swift13SlowServerletC28doSomethingDangerousNullablyyS2SYaKF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed String, @guaranteed SlowServerlet) -> (@owned String, @error any Error) { - // CHECK-NN: bb0([[ACTOR:%.*]] : @guaranteed $Optional, + // CHECK-NN-LABEL: sil hidden [ossa] @$s21objc_async_from_swift13SlowServerletC28doSomethingDangerousNullablyyS2SYaKF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed String, @guaranteed SlowServerlet) -> (@owned String, @error any Error) { + // CHECK-NN: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, // CHECK-NN: hop_to_executor [[ACTOR]] // CHECK-NN: } // end sil function '$s21objc_async_from_swift13SlowServerletC28doSomethingDangerousNullablyyS2SYaKF' @@ -276,12 +282,13 @@ class SlowServerlet: SlowServer { // // CHECK-LABEL: sil shared [thunk] [ossa] @$s21objc_async_from_swift13SlowServerletC28doSomethingDangerousNullablyyS2SYaKFyyYacfU_To : $@convention(thin) @Sendable @async (NSString, Optional<@convention(block) @Sendable (Optional, Optional) -> ()>, SlowServerlet) -> () { // CHECK-NN: [[ACTOR:%.*]] = enum $Optional, #Optional.none!enumelt + // CHECK-NN: [[ACTOR_CAST:%.*]] = unchecked_value_cast [[ACTOR]] : $Optional to $Builtin.ImplicitIsolationActor // CHECK: [[STR_ARG:%.*]] = begin_borrow {{.*}} : $String // CHECK: [[SELF:%.*]] = begin_borrow {{.*}} : $SlowServerlet // CHECK-C: [[NATIVE:%.*]] = function_ref @$s21objc_async_from_swift13SlowServerletC28doSomethingDangerousNullablyyS2SYaKF : $@convention(method) @async (@guaranteed String, @guaranteed SlowServerlet) -> (@owned String, @error any Error) // CHECK-C: apply [[NATIVE]]([[STR_ARG]], [[SELF]]) - // CHECK-NN: [[NATIVE:%.*]] = function_ref @$s21objc_async_from_swift13SlowServerletC28doSomethingDangerousNullablyyS2SYaKF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed String, @guaranteed SlowServerlet) -> (@owned String, @error any Error) - // CHECK-NN: apply [[NATIVE]]([[ACTOR]], [[STR_ARG]], [[SELF]]) + // CHECK-NN: [[NATIVE:%.*]] = function_ref @$s21objc_async_from_swift13SlowServerletC28doSomethingDangerousNullablyyS2SYaKF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed String, @guaranteed SlowServerlet) -> (@owned String, @error any Error) + // CHECK-NN: apply [[NATIVE]]([[ACTOR_CAST]], [[STR_ARG]], [[SELF]]) // CHECK: } // end sil function '$s21objc_async_from_swift13SlowServerletC28doSomethingDangerousNullablyyS2SYaKFyyYacfU_To' override func doSomethingDangerousNullably(_ x: String) async throws -> String { return x @@ -290,24 +297,25 @@ class SlowServerlet: SlowServer { // Native // // CHECK-C-LABEL: sil hidden [ossa] @$s21objc_async_from_swift13SlowServerletC30doSomethingUnspecifiedNullablySSyYaKF : $@convention(method) @async (@guaranteed SlowServerlet) -> (@owned String, @error any Error) - // CHECK-C-NOT: bb0([[ACTOR:%.*]] : @guaranteed $Optional, - // CHECK-C: [[ACTOR:%.*]] = enum $Optional, #Optional.none!enumelt + // CHECK-C-NOT: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, + // CHECK-C: [[ACTOR:%.*]] = enum $Optional, #Optional.none!enumelt // CHECK-C-NEXT: hop_to_executor [[ACTOR]] // CHECK-C: } // end sil function '$s21objc_async_from_swift13SlowServerletC30doSomethingUnspecifiedNullablySSyYaKF' - // CHECK-NN-LABEL: sil hidden [ossa] @$s21objc_async_from_swift13SlowServerletC30doSomethingUnspecifiedNullablySSyYaKF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed SlowServerlet) -> (@owned String, @error any Error) { - // CHECK-NN: bb0([[ACTOR:%.*]] : @guaranteed $Optional, + // CHECK-NN-LABEL: sil hidden [ossa] @$s21objc_async_from_swift13SlowServerletC30doSomethingUnspecifiedNullablySSyYaKF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed SlowServerlet) -> (@owned String, @error any Error) { + // CHECK-NN: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, // CHECK-NN: hop_to_executor [[ACTOR]] // CHECK-NN: } // end sil function '$s21objc_async_from_swift13SlowServerletC30doSomethingUnspecifiedNullablySSyYaKF' // @objc closure thunk // CHECK-LABEL: sil shared [thunk] [ossa] @$s21objc_async_from_swift13SlowServerletC30doSomethingUnspecifiedNullablySSyYaKFyyYacfU_To : $@convention(thin) @Sendable @async (Optional<@convention(block) @Sendable (Optional, Optional) -> ()>, SlowServerlet) -> () { // CHECK-NN: [[ACTOR:%.*]] = enum $Optional, #Optional.none!enumelt + // CHECK-NN: [[ACTOR_CAST:%.*]] = unchecked_value_cast [[ACTOR]] : $Optional to $Builtin.ImplicitIsolationActor // CHECK: [[SELF:%.*]] = begin_borrow {{.*}} : $SlowServerlet // CHECK-C: [[NATIVE:%.*]] = function_ref @$s21objc_async_from_swift13SlowServerletC30doSomethingUnspecifiedNullablySSyYaKF : $@convention(method) @async (@guaranteed SlowServerlet) -> (@owned String, @error any Error) // CHECK-C: try_apply [[NATIVE]]([[SELF]]) - // CHECK-NN: [[NATIVE:%.*]] = function_ref @$s21objc_async_from_swift13SlowServerletC30doSomethingUnspecifiedNullablySSyYaKF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed SlowServerlet) -> (@owned String, @error any Error) - // CHECK-NN: try_apply [[NATIVE]]([[ACTOR]], [[SELF]]) + // CHECK-NN: [[NATIVE:%.*]] = function_ref @$s21objc_async_from_swift13SlowServerletC30doSomethingUnspecifiedNullablySSyYaKF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed SlowServerlet) -> (@owned String, @error any Error) + // CHECK-NN: try_apply [[NATIVE]]([[ACTOR_CAST]], [[SELF]]) // CHECK: } // end sil function '$s21objc_async_from_swift13SlowServerletC30doSomethingUnspecifiedNullablySSyYaKFyyYacfU_To' override func doSomethingUnspecifiedNullably() async throws -> String { fatalError() @@ -316,24 +324,25 @@ class SlowServerlet: SlowServer { // Native // // CHECK-C-LABEL: sil hidden [ossa] @$s21objc_async_from_swift13SlowServerletC17doSomethingFlaggySSyYaKF : $@convention(method) @async (@guaranteed SlowServerlet) -> (@owned String, @error any Error) - // CHECK-C-NOT: bb0([[ACTOR:%.*]] : @guaranteed $Optional, - // CHECK-C: [[ACTOR:%.*]] = enum $Optional, #Optional.none!enumelt + // CHECK-C-NOT: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, + // CHECK-C: [[ACTOR:%.*]] = enum $Optional, #Optional.none!enumelt // CHECK-C-NEXT: hop_to_executor [[ACTOR]] // CHECK-C: } // end sil function '$s21objc_async_from_swift13SlowServerletC17doSomethingFlaggySSyYaKF' - // CHECK-NN-LABEL: sil hidden [ossa] @$s21objc_async_from_swift13SlowServerletC17doSomethingFlaggySSyYaKF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed SlowServerlet) -> (@owned String, @error any Error) { - // CHECK-NN: bb0([[ACTOR:%.*]] : @guaranteed $Optional, + // CHECK-NN-LABEL: sil hidden [ossa] @$s21objc_async_from_swift13SlowServerletC17doSomethingFlaggySSyYaKF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed SlowServerlet) -> (@owned String, @error any Error) { + // CHECK-NN: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, // CHECK-NN: hop_to_executor [[ACTOR]] // CHECK-NN: } // end sil function '$s21objc_async_from_swift13SlowServerletC17doSomethingFlaggySSyYaKF' // @objc thunk closure // CHECK-LABEL: sil shared [thunk] [ossa] @$s21objc_async_from_swift13SlowServerletC17doSomethingFlaggySSyYaKFyyYacfU_To : $@convention(thin) @Sendable @async (@convention(block) @Sendable ({{.*}}, Optional, Optional) -> (), SlowServerlet) -> () { // CHECK-NN: [[ACTOR:%.*]] = enum $Optional, #Optional.none!enumelt + // CHECK-NN: [[ACTOR_CAST:%.*]] = unchecked_value_cast [[ACTOR]] : $Optional to $Builtin.ImplicitIsolationActor // CHECK: [[SELF:%.*]] = begin_borrow {{.*}} : $SlowServerlet // CHECK-C: [[NATIVE:%.*]] = function_ref @$s21objc_async_from_swift13SlowServerletC17doSomethingFlaggySSyYaKF : $@convention(method) @async (@guaranteed SlowServerlet) -> (@owned String, @error any Error) // CHECK-C: try_apply [[NATIVE]]([[SELF]]) : {{.*}}, normal [[NORMAL_BB:bb[0-9]+]], error [[ERROR_BB:bb[0-9]+]] - // CHECK-NN: [[NATIVE:%.*]] = function_ref @$s21objc_async_from_swift13SlowServerletC17doSomethingFlaggySSyYaKF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed SlowServerlet) -> (@owned String, @error any Error) - // CHECK-NN: try_apply [[NATIVE]]([[ACTOR]], [[SELF]]) : {{.*}}, normal [[NORMAL_BB:bb[0-9]+]], error [[ERROR_BB:bb[0-9]+]] + // CHECK-NN: [[NATIVE:%.*]] = function_ref @$s21objc_async_from_swift13SlowServerletC17doSomethingFlaggySSyYaKF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed SlowServerlet) -> (@owned String, @error any Error) + // CHECK-NN: try_apply [[NATIVE]]([[ACTOR_CAST]], [[SELF]]) : {{.*}}, normal [[NORMAL_BB:bb[0-9]+]], error [[ERROR_BB:bb[0-9]+]] // // CHECK: [[NORMAL_BB]]({{.*}}): // CHECK: integer_literal {{.*}}0 @@ -348,24 +357,25 @@ class SlowServerlet: SlowServer { // Native // // CHECK-C-LABEL: sil hidden [ossa] @$s21objc_async_from_swift13SlowServerletC21doSomethingZeroFlaggySSyYaKF : $@convention(method) @async (@guaranteed SlowServerlet) -> (@owned String, @error any Error) - // CHECK-C-NOT: bb0([[ACTOR:%.*]] : @guaranteed $Optional, - // CHECK-C: [[ACTOR:%.*]] = enum $Optional, #Optional.none!enumelt + // CHECK-C-NOT: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, + // CHECK-C: [[ACTOR:%.*]] = enum $Optional, #Optional.none!enumelt // CHECK-C-NEXT: hop_to_executor [[ACTOR]] // CHECK-C: } // end sil function '$s21objc_async_from_swift13SlowServerletC21doSomethingZeroFlaggySSyYaKF' // - // CHECK-NN-LABEL: sil hidden [ossa] @$s21objc_async_from_swift13SlowServerletC21doSomethingZeroFlaggySSyYaKF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed SlowServerlet) -> (@owned String, @error any Error) { - // CHECK-NN: bb0([[ACTOR:%.*]] : @guaranteed $Optional, + // CHECK-NN-LABEL: sil hidden [ossa] @$s21objc_async_from_swift13SlowServerletC21doSomethingZeroFlaggySSyYaKF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed SlowServerlet) -> (@owned String, @error any Error) { + // CHECK-NN: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, // CHECK-NN: hop_to_executor [[ACTOR]] // CHECK-NN: } // end sil function '$s21objc_async_from_swift13SlowServerletC21doSomethingZeroFlaggySSyYaKF' // // @objc thunk closure // CHECK-LABEL: sil shared [thunk] [ossa] @$s21objc_async_from_swift13SlowServerletC21doSomethingZeroFlaggySSyYaKFyyYacfU_To : $@convention(thin) @Sendable @async (@convention(block) @Sendable (Optional, {{.*}}, Optional) -> (), SlowServerlet) -> () { // CHECK-NN: [[ACTOR:%.*]] = enum $Optional, #Optional.none!enumelt + // CHECK-NN: [[ACTOR_CAST:%.*]] = unchecked_value_cast [[ACTOR]] : $Optional to $Builtin.ImplicitIsolationActor // CHECK: [[SELF:%.*]] = begin_borrow {{.*}} : $SlowServerlet // CHECK-C: [[NATIVE:%.*]] = function_ref @$s21objc_async_from_swift13SlowServerletC21doSomethingZeroFlaggySSyYaKF : $@convention(method) @async (@guaranteed SlowServerlet) -> (@owned String, @error any Error) // CHECK-C: try_apply [[NATIVE]]([[SELF]]) : {{.*}}, normal [[NORMAL_BB:bb[0-9]+]], error [[ERROR_BB:bb[0-9]+]] - // CHECK-NN: [[NATIVE:%.*]] = function_ref @$s21objc_async_from_swift13SlowServerletC21doSomethingZeroFlaggySSyYaKF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed SlowServerlet) -> (@owned String, @error any Error) - // CHECK-NN: try_apply [[NATIVE]]([[ACTOR]], [[SELF]]) : {{.*}}, normal [[NORMAL_BB:bb[0-9]+]], error [[ERROR_BB:bb[0-9]+]] + // CHECK-NN: [[NATIVE:%.*]] = function_ref @$s21objc_async_from_swift13SlowServerletC21doSomethingZeroFlaggySSyYaKF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed SlowServerlet) -> (@owned String, @error any Error) + // CHECK-NN: try_apply [[NATIVE]]([[ACTOR_CAST]], [[SELF]]) : {{.*}}, normal [[NORMAL_BB:bb[0-9]+]], error [[ERROR_BB:bb[0-9]+]] // // CHECK: [[NORMAL_BB]]({{.*}}): // CHECK: integer_literal {{.*}}1 @@ -379,23 +389,24 @@ class SlowServerlet: SlowServer { // Native // // CHECK-C-LABEL: sil hidden [ossa] @$s21objc_async_from_swift13SlowServerletC28doSomethingMultiResultFlaggySS_SStyYaKF : $@convention(method) @async (@guaranteed SlowServerlet) -> (@owned String, @owned String, @error any Error) - // CHECK-C-NOT: bb0([[ACTOR:%.*]] : @guaranteed $Optional, - // CHECK-C: [[ACTOR:%.*]] = enum $Optional, #Optional.none!enumelt + // CHECK-C-NOT: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, + // CHECK-C: [[ACTOR:%.*]] = enum $Optional, #Optional.none!enumelt // CHECK-C-NEXT: hop_to_executor [[ACTOR]] // CHECK-C: } // end sil function '$s21objc_async_from_swift13SlowServerletC28doSomethingMultiResultFlaggySS_SStyYaKF' // - // CHECK-NN-LABEL: sil hidden [ossa] @$s21objc_async_from_swift13SlowServerletC28doSomethingMultiResultFlaggySS_SStyYaKF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed SlowServerlet) -> (@owned String, @owned String, @error any Error) { - // CHECK-NN: bb0([[ACTOR:%.*]] : @guaranteed $Optional, + // CHECK-NN-LABEL: sil hidden [ossa] @$s21objc_async_from_swift13SlowServerletC28doSomethingMultiResultFlaggySS_SStyYaKF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed SlowServerlet) -> (@owned String, @owned String, @error any Error) { + // CHECK-NN: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, // CHECK-NN: hop_to_executor [[ACTOR]] // CHECK-NN: } // end sil function '$s21objc_async_from_swift13SlowServerletC28doSomethingMultiResultFlaggySS_SStyYaKF' // // CHECK-LABEL: sil shared [thunk] [ossa] @$s21objc_async_from_swift13SlowServerletC28doSomethingMultiResultFlaggySS_SStyYaKFyyYacfU_To : $@convention(thin) @Sendable @async (@convention(block) @Sendable ({{.*}}, Optional, Optional, Optional) -> (), SlowServerlet) -> () { // CHECK-NN: [[ACTOR:%.*]] = enum $Optional, #Optional.none!enumelt + // CHECK-NN: [[ACTOR_CAST:%.*]] = unchecked_value_cast [[ACTOR]] : $Optional to $Builtin.ImplicitIsolationActor // CHECK: [[SELF:%.*]] = begin_borrow {{.*}} : $SlowServerlet // CHECK-C: [[NATIVE:%.*]] = function_ref @$s21objc_async_from_swift13SlowServerletC28doSomethingMultiResultFlaggySS_SStyYaKF : $@convention(method) @async (@guaranteed SlowServerlet) -> (@owned String, @owned String, @error any Error) // CHECK-C: try_apply [[NATIVE]]([[SELF]]) : {{.*}}, normal [[NORMAL_BB:bb[0-9]+]], error [[ERROR_BB:bb[0-9]+]] - // CHECK-NN: [[NATIVE:%.*]] = function_ref @$s21objc_async_from_swift13SlowServerletC28doSomethingMultiResultFlaggySS_SStyYaKF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed SlowServerlet) -> (@owned String, @owned String, @error any Error) - // CHECK-NN: try_apply [[NATIVE]]([[ACTOR]], [[SELF]]) : {{.*}}, normal [[NORMAL_BB:bb[0-9]+]], error [[ERROR_BB:bb[0-9]+]] + // CHECK-NN: [[NATIVE:%.*]] = function_ref @$s21objc_async_from_swift13SlowServerletC28doSomethingMultiResultFlaggySS_SStyYaKF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed SlowServerlet) -> (@owned String, @owned String, @error any Error) + // CHECK-NN: try_apply [[NATIVE]]([[ACTOR_CAST]], [[SELF]]) : {{.*}}, normal [[NORMAL_BB:bb[0-9]+]], error [[ERROR_BB:bb[0-9]+]] // // CHECK: [[NORMAL_BB]]({{.*}}): // CHECK: integer_literal {{.*}}1 @@ -462,7 +473,7 @@ func testAutoclosureInStaticMethod() { // Default argument for method. // // CHECK-C-LABEL: sil private [ossa] @$s21objc_async_from_swift29testAutoclosureInStaticMethodyyF9TestKlassL_C8getValue2id11valueForKeySSSgSS_S2SYaKXEtYaFZfA0_ : $@convention(thin) () -> @owned @async @callee_guaranteed (@guaranteed String) -> (@owned String, @error any Error) { - // CHECK-NN-LABEL: sil private [ossa] @$s21objc_async_from_swift29testAutoclosureInStaticMethodyyF9TestKlassL_C8getValue2id11valueForKeySSSgSS_S2SYaKYCXEtYaFZfA0_ : $@convention(thin) () -> @owned @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed String) -> (@owned String, @error any Error) { + // CHECK-NN-LABEL: sil private [ossa] @$s21objc_async_from_swift29testAutoclosureInStaticMethodyyF9TestKlassL_C8getValue2id11valueForKeySSSgSS_S2SYaKYCXEtYaFZfA0_ : $@convention(thin) () -> @owned @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed String) -> (@owned String, @error any Error) { // // Get standard. // CHECK: [[METATYPE:%.*]] = metatype $@objc_metatype SlowServer.Type @@ -470,14 +481,14 @@ func testAutoclosureInStaticMethod() { // CHECK: [[STANDARD:%.*]] = apply [[GET_STANDARD_FUNC]]([[METATYPE]]) // // Then grab value. - // CHECK-C: [[GET_VALUE:%.*]] = function_ref @$s21objc_async_from_swift29testAutoclosureInStaticMethodyyF9TestKlassL_C8getValue2id11valueForKeySSSgSS_S2SYaKXEtYaFZfA0_S2SYaKYCcSo10SlowServerCcfu_ : $@convention(thin) (@guaranteed SlowServer) -> @owned @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed String) -> (@owned String, @error any Error) - // CHECK-NN: [[GET_VALUE:%.*]] = function_ref @$s21objc_async_from_swift29testAutoclosureInStaticMethodyyF9TestKlassL_C8getValue2id11valueForKeySSSgSS_S2SYaKYCXEtYaFZfA0_S2SYaKYCcSo10SlowServerCcfu_ : $@convention(thin) (@guaranteed SlowServer) -> @owned @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed String) -> (@owned String, @error any Error) + // CHECK-C: [[GET_VALUE:%.*]] = function_ref @$s21objc_async_from_swift29testAutoclosureInStaticMethodyyF9TestKlassL_C8getValue2id11valueForKeySSSgSS_S2SYaKXEtYaFZfA0_S2SYaKYCcSo10SlowServerCcfu_ : $@convention(thin) (@guaranteed SlowServer) -> @owned @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed String) -> (@owned String, @error any Error) + // CHECK-NN: [[GET_VALUE:%.*]] = function_ref @$s21objc_async_from_swift29testAutoclosureInStaticMethodyyF9TestKlassL_C8getValue2id11valueForKeySSSgSS_S2SYaKYCXEtYaFZfA0_S2SYaKYCcSo10SlowServerCcfu_ : $@convention(thin) (@guaranteed SlowServer) -> @owned @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed String) -> (@owned String, @error any Error) // CHECK: [[RESULT:%.*]] = apply [[GET_VALUE]]([[STANDARD]]) // // Then we need to thunk to eliminate the implicit leading parameter. We use // the thunk that passes in .none so this acts as a concurrent function. // - // CHECK-C: [[THUNK_FN:%.*]] = function_ref @$sScA_pSgS2Ss5Error_pIegHgILgozo_S2SsAB_pIegHgozo_TR : $@convention(thin) @async (@guaranteed String, @guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed String) -> (@owned String, @error any Error)) -> (@owned String, @error any Error) + // CHECK-C: [[THUNK_FN:%.*]] = function_ref @$sBAS2Ss5Error_pIegHgILgozo_S2SsAA_pIegHgozo_TR : $@convention(thin) @async (@guaranteed String, @guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed String) -> (@owned String, @error any Error)) -> (@owned String, @error any Error) // CHECK-C: [[THUNKED:%.*]] = partial_apply [callee_guaranteed] [[THUNK_FN]]([[RESULT]]) // CHECK-C: return [[THUNKED]] // CHECK-NN: return [[RESULT]] @@ -486,12 +497,12 @@ func testAutoclosureInStaticMethod() { // This is the first implicit closure. We close over self here. // - // CHECK-C-LABEL: sil private [ossa] @$s21objc_async_from_swift29testAutoclosureInStaticMethodyyF9TestKlassL_C8getValue2id11valueForKeySSSgSS_S2SYaKXEtYaFZfA0_S2SYaKYCcSo10SlowServerCcfu_ : $@convention(thin) (@guaranteed SlowServer) -> @owned @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed String) -> (@owned String, @error any Error) { + // CHECK-C-LABEL: sil private [ossa] @$s21objc_async_from_swift29testAutoclosureInStaticMethodyyF9TestKlassL_C8getValue2id11valueForKeySSSgSS_S2SYaKXEtYaFZfA0_S2SYaKYCcSo10SlowServerCcfu_ : $@convention(thin) (@guaranteed SlowServer) -> @owned @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed String) -> (@owned String, @error any Error) { // CHECK: bb0([[SELF:%.*]] : // // Close over self and return it. - // CHECK-C: [[SECOND_CLOSURE:%.*]] = function_ref @$s21objc_async_from_swift29testAutoclosureInStaticMethodyyF9TestKlassL_C8getValue2id11valueForKeySSSgSS_S2SYaKXEtYaFZfA0_S2SYaKYCcSo10SlowServerCcfu_S2SYaKYCcfu0_ : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed String, @guaranteed SlowServer) -> (@owned String, @error any Error) - // CHECK-NN: [[SECOND_CLOSURE:%.*]] = function_ref @$s21objc_async_from_swift29testAutoclosureInStaticMethodyyF9TestKlassL_C8getValue2id11valueForKeySSSgSS_S2SYaKYCXEtYaFZfA0_S2SYaKYCcSo10SlowServerCcfu_S2SYaKYCcfu0_ : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed String, @guaranteed SlowServer) -> (@owned String, @error any Error) + // CHECK-C: [[SECOND_CLOSURE:%.*]] = function_ref @$s21objc_async_from_swift29testAutoclosureInStaticMethodyyF9TestKlassL_C8getValue2id11valueForKeySSSgSS_S2SYaKXEtYaFZfA0_S2SYaKYCcSo10SlowServerCcfu_S2SYaKYCcfu0_ : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed String, @guaranteed SlowServer) -> (@owned String, @error any Error) + // CHECK-NN: [[SECOND_CLOSURE:%.*]] = function_ref @$s21objc_async_from_swift29testAutoclosureInStaticMethodyyF9TestKlassL_C8getValue2id11valueForKeySSSgSS_S2SYaKYCXEtYaFZfA0_S2SYaKYCcSo10SlowServerCcfu_S2SYaKYCcfu0_ : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed String, @guaranteed SlowServer) -> (@owned String, @error any Error) // CHECK: [[SELF_COPY:%.*]] = copy_value [[SELF]] // CHECK: [[CLOSE_OVER_SELF:%.*]] = partial_apply [callee_guaranteed] [[SECOND_CLOSURE]]([[SELF_COPY]]) // CHECK: return [[CLOSE_OVER_SELF]] @@ -499,9 +510,9 @@ func testAutoclosureInStaticMethod() { // CHECK-NN: } // end sil function '$s21objc_async_from_swift29testAutoclosureInStaticMethodyyF9TestKlassL_C8getValue2id11valueForKeySSSgSS_S2SYaKYCXEtYaFZfA0_S2SYaKYCcSo10SlowServerCcfu_' // The second closure. In this function we actually perform the objective-c call. - // CHECK-C-LABEL: sil private [ossa] @$s21objc_async_from_swift29testAutoclosureInStaticMethodyyF9TestKlassL_C8getValue2id11valueForKeySSSgSS_S2SYaKXEtYaFZfA0_S2SYaKYCcSo10SlowServerCcfu_S2SYaKYCcfu0_ : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed String, @guaranteed SlowServer) -> (@owned String, @error any Error) { - // CHECK-NN-LABEL: sil private [ossa] @$s21objc_async_from_swift29testAutoclosureInStaticMethodyyF9TestKlassL_C8getValue2id11valueForKeySSSgSS_S2SYaKYCXEtYaFZfA0_S2SYaKYCcSo10SlowServerCcfu_S2SYaKYCcfu0_ : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed String, @guaranteed SlowServer) -> (@owned String, @error any Error) { - // CHECK: bb0([[ACTOR:%.*]] : @guaranteed $Optional, [[ARG:%.*]] : @guaranteed $String, [[CAPTURE:%.*]] : @closureCapture @guaranteed $SlowServer): + // CHECK-C-LABEL: sil private [ossa] @$s21objc_async_from_swift29testAutoclosureInStaticMethodyyF9TestKlassL_C8getValue2id11valueForKeySSSgSS_S2SYaKXEtYaFZfA0_S2SYaKYCcSo10SlowServerCcfu_S2SYaKYCcfu0_ : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed String, @guaranteed SlowServer) -> (@owned String, @error any Error) { + // CHECK-NN-LABEL: sil private [ossa] @$s21objc_async_from_swift29testAutoclosureInStaticMethodyyF9TestKlassL_C8getValue2id11valueForKeySSSgSS_S2SYaKYCXEtYaFZfA0_S2SYaKYCcSo10SlowServerCcfu_S2SYaKYCcfu0_ : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed String, @guaranteed SlowServer) -> (@owned String, @error any Error) { + // CHECK: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, [[ARG:%.*]] : @guaranteed $String, [[CAPTURE:%.*]] : @closureCapture @guaranteed $SlowServer): // // Hop to the actor // CHECK: hop_to_executor [[ACTOR]] @@ -545,12 +556,13 @@ func testAutoclosureInStaticMethod() { // thunk for @escaping @callee_guaranteed @async (@guaranteed Actor?, @guaranteed String) -> (@owned String, @error @owned Error) - // CHECK-C-LABEL: sil shared [transparent] [serialized] [reabstraction_thunk] [ossa] @$sScA_pSgS2Ss5Error_pIegHgILgozo_S2SsAB_pIegHgozo_TR : $@convention(thin) @async (@guaranteed String, @guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed String) -> (@owned String, @error any Error)) -> (@owned String, @error any Error) { - // CHECK-C: bb0([[ARG:%.*]] : @guaranteed $String, [[FUNC:%.*]] : @guaranteed $@async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed String) -> (@owned String, @error any Error)): + // CHECK-C-LABEL: sil shared [transparent] [serialized] [reabstraction_thunk] [ossa] @$sBAS2Ss5Error_pIegHgILgozo_S2SsAA_pIegHgozo_TR : $@convention(thin) @async (@guaranteed String, @guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed String) -> (@owned String, @error any Error)) -> (@owned String, @error any Error) { + // CHECK-C: bb0([[ARG:%.*]] : @guaranteed $String, [[FUNC:%.*]] : @guaranteed $@async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed String) -> (@owned String, @error any Error)): // CHECK-C: [[ACTOR:%.*]] = enum $Optional, #Optional.none!enumelt // CHECK-C: hop_to_executor [[ACTOR]] - // CHECK-C: try_apply [[FUNC]]([[ACTOR]], [[ARG]]) - // CHECK-C: } // end sil function '$sScA_pSgS2Ss5Error_pIegHgILgozo_S2SsAB_pIegHgozo_TR' + // CHECK-C: [[ACTOR_CAST:%.*]] = unchecked_value_cast [[ACTOR]] : $Optional to $Builtin.ImplicitIsolationActor + // CHECK-C: try_apply [[FUNC]]([[ACTOR_CAST]], [[ARG]]) + // CHECK-C: } // end sil function '$sBAS2Ss5Error_pIegHgILgozo_S2SsAA_pIegHgozo_TR' // Actual static method // @@ -561,14 +573,14 @@ func testAutoclosureInStaticMethod() { // // CHECK-C-LABEL: sil private [ossa] @$s21objc_async_from_swift29testAutoclosureInStaticMethodyyF9TestKlassL_C8getValue2id11valueForKeySSSgSS_S2SYaKXEtYaFZ : $@convention(method) @async (@guaranteed String, @guaranteed @noescape @async @callee_guaranteed (@guaranteed String) -> (@owned String, @error any Error), @thick TestKlass.Type) -> @owned Optional { // CHECK-C: bb0([[STRING:%.*]] : @guaranteed $String, [[COMPLETION:%.*]] : @guaranteed $@noescape @async @callee_guaranteed (@guaranteed String) -> (@owned String, @error any Error), [[METATYPE:%.*]] : $@thick TestKlass.Type) - // CHECK-C: [[EXEC_NONE:%.*]] = enum $Optional, #Optional.none!enumelt + // CHECK-C: [[EXEC_NONE:%.*]] = enum $Optional, #Optional.none!enumelt // CHECK-C: hop_to_executor [[EXEC_NONE]] // CHECK-C: hop_to_executor [[EXEC_NONE]] // CHECK-C: hop_to_executor [[EXEC_NONE]] // CHECK-C: } // end sil function '$s21objc_async_from_swift29testAutoclosureInStaticMethodyyF9TestKlassL_C8getValue2id11valueForKeySSSgSS_S2SYaKXEtYaFZ' - // CHECK-NN-LABEL: sil private [ossa] @$s21objc_async_from_swift29testAutoclosureInStaticMethodyyF9TestKlassL_C8getValue2id11valueForKeySSSgSS_S2SYaKYCXEtYaFZ : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed String, @guaranteed @noescape @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed String) -> (@owned String, @error any Error), @thick TestKlass.Type) -> @owned Optional { - // CHECK-NN: bb0([[ACTOR:%.*]] : @guaranteed $Optional, [[STRING:%.*]] : @guaranteed $String, [[COMPLETION:%.*]] : @guaranteed $@noescape @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed String) -> (@owned String, @error any Error), %3 : $@thick TestKlass.Type): + // CHECK-NN-LABEL: sil private [ossa] @$s21objc_async_from_swift29testAutoclosureInStaticMethodyyF9TestKlassL_C8getValue2id11valueForKeySSSgSS_S2SYaKYCXEtYaFZ : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed String, @guaranteed @noescape @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed String) -> (@owned String, @error any Error), @thick TestKlass.Type) -> @owned Optional { + // CHECK-NN: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, [[STRING:%.*]] : @guaranteed $String, [[COMPLETION:%.*]] : @guaranteed $@noescape @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed String) -> (@owned String, @error any Error), %3 : $@thick TestKlass.Type): // CHECK-NN: hop_to_executor [[ACTOR]] // CHECK-NN: hop_to_executor [[ACTOR]] // CHECK-NN: hop_to_executor [[ACTOR]] @@ -588,7 +600,7 @@ func testAutoclosureInStaticMethod() { // Default argument for method. // // CHECK-C-LABEL: sil private [ossa] @$s21objc_async_from_swift29testAutoclosureInStaticMethodyyF9TestKlassL_C17getMainActorValue2id11valueForKeySSSgSS_S2SYaKXEtYaFZfA0_ : $@convention(thin) () -> @owned @async @callee_guaranteed (@guaranteed String) -> (@owned String, @error any Error) { - // CHECK-NN-LABEL: sil private [ossa] @$s21objc_async_from_swift29testAutoclosureInStaticMethodyyF9TestKlassL_C17getMainActorValue2id11valueForKeySSSgSS_S2SYaKYCXEtYaFZfA0_ : $@convention(thin) () -> @owned @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed String) -> (@owned String, @error any Error) { + // CHECK-NN-LABEL: sil private [ossa] @$s21objc_async_from_swift29testAutoclosureInStaticMethodyyF9TestKlassL_C17getMainActorValue2id11valueForKeySSSgSS_S2SYaKYCXEtYaFZfA0_ : $@convention(thin) () -> @owned @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed String) -> (@owned String, @error any Error) { // // Get standard. // CHECK: [[METATYPE:%.*]] = metatype $@objc_metatype SlowServer.Type @@ -600,7 +612,7 @@ func testAutoclosureInStaticMethod() { // CHECK-NN: [[GET_VALUE:%.*]] = function_ref @$s21objc_async_from_swift29testAutoclosureInStaticMethodyyF9TestKlassL_C17getMainActorValue2id11valueForKeySSSgSS_S2SYaKYCXEtYaFZfA0_S2SYaKScMYccSo10SlowServerCcfu_ : $@convention(thin) (@guaranteed SlowServer) -> @owned @async @callee_guaranteed (@guaranteed String) -> (@owned String, @error any Error) // CHECK: [[RESULT:%.*]] = apply [[GET_VALUE]]([[STANDARD]]) // - // CHECK-NN: [[THUNK:%.*]] = function_ref @$sS2Ss5Error_pIegHgozo_ScA_pSgS2SsAA_pIegHgILgozo_TR : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed String, @guaranteed @async @callee_guaranteed (@guaranteed String) -> (@owned String, @error any Error)) -> (@owned String, @error any Error) + // CHECK-NN: [[THUNK:%.*]] = function_ref @$sS2Ss5Error_pIegHgozo_BAS2SsAA_pIegHgILgozo_TR : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed String, @guaranteed @async @callee_guaranteed (@guaranteed String) -> (@owned String, @error any Error)) -> (@owned String, @error any Error) // CHECK-NN: [[THUNKED_RESULT:%.*]] = partial_apply [callee_guaranteed] [[THUNK]]([[RESULT]]) // CHECK-C: return [[RESULT]] // CHECK-NN: return [[THUNKED_RESULT]] @@ -676,8 +688,8 @@ func testAutoclosureInStaticMethod() { // nonisolated(nonsending) by default just due to the way the compiler emits // thunks at different times due to different usages. // - // CHECK-NN-LABEL: sil shared [transparent] [serialized] [reabstraction_thunk] [ossa] @$sS2Ss5Error_pIegHgozo_ScA_pSgS2SsAA_pIegHgILgozo_TR : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed String, @guaranteed @async @callee_guaranteed (@guaranteed String) -> (@owned String, @error any Error)) -> (@owned String, @error any Error) { - // CHECK-NN: bb0([[ACTOR:%.*]] : @guaranteed $Optional, [[ARG:%.*]] : @guaranteed $String, [[FUNC:%.*]] : @guaranteed $@async @callee_guaranteed (@guaranteed String) -> (@owned String, @error any Error)): + // CHECK-NN-LABEL: sil shared [transparent] [serialized] [reabstraction_thunk] [ossa] @$sS2Ss5Error_pIegHgozo_BAS2SsAA_pIegHgILgozo_TR : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed String, @guaranteed @async @callee_guaranteed (@guaranteed String) -> (@owned String, @error any Error)) -> (@owned String, @error any Error) { + // CHECK-NN: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, [[ARG:%.*]] : @guaranteed $String, [[FUNC:%.*]] : @guaranteed $@async @callee_guaranteed (@guaranteed String) -> (@owned String, @error any Error)): // CHECK-NN: try_apply [[FUNC]]([[ARG]]) // // CHECK-NN: bb1( @@ -685,7 +697,7 @@ func testAutoclosureInStaticMethod() { // // CHECK-NN: bb2( // CHECK-NN: hop_to_executor [[ACTOR]] - // CHECK-NN: } // end sil function '$sS2Ss5Error_pIegHgozo_ScA_pSgS2SsAA_pIegHgILgozo_TR' + // CHECK-NN: } // end sil function '$sS2Ss5Error_pIegHgozo_BAS2SsAA_pIegHgILgozo_TR' // Actual static method // @@ -693,14 +705,14 @@ func testAutoclosureInStaticMethod() { // // CHECK-C-LABEL: sil private [ossa] @$s21objc_async_from_swift29testAutoclosureInStaticMethodyyF9TestKlassL_C17getMainActorValue2id11valueForKeySSSgSS_S2SYaKXEtYaFZ : $@convention(method) @async (@guaranteed String, @guaranteed @noescape @async @callee_guaranteed (@guaranteed String) -> (@owned String, @error any Error), @thick TestKlass.Type) -> @owned Optional { // CHECK-C: bb0([[STRING:%.*]] : @guaranteed $String, [[COMPLETION:%.*]] : @guaranteed $@noescape @async @callee_guaranteed (@guaranteed String) -> (@owned String, @error any Error), [[METATYPE:%.*]] : $@thick TestKlass.Type) - // CHECK-C: [[EXEC_NONE:%.*]] = enum $Optional, #Optional.none!enumelt + // CHECK-C: [[EXEC_NONE:%.*]] = enum $Optional, #Optional.none!enumelt // CHECK-C: hop_to_executor [[EXEC_NONE]] // CHECK-C: hop_to_executor [[EXEC_NONE]] // CHECK-C: hop_to_executor [[EXEC_NONE]] // CHECK-C: } // end sil function '$s21objc_async_from_swift29testAutoclosureInStaticMethodyyF9TestKlassL_C17getMainActorValue2id11valueForKeySSSgSS_S2SYaKXEtYaFZ' // - // CHECK-NN-LABEL: sil private [ossa] @$s21objc_async_from_swift29testAutoclosureInStaticMethodyyF9TestKlassL_C17getMainActorValue2id11valueForKeySSSgSS_S2SYaKYCXEtYaFZ : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed String, @guaranteed @noescape @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed String) -> (@owned String, @error any Error), @thick TestKlass.Type) -> @owned Optional { - // CHECK-NN: bb0([[ACTOR:%.*]] : @guaranteed $Optional, [[STRING:%.*]] : @guaranteed $String, [[COMPLETION:%.*]] : @guaranteed $@noescape @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @guaranteed String) -> (@owned String, @error any Error), %3 : $@thick TestKlass.Type) + // CHECK-NN-LABEL: sil private [ossa] @$s21objc_async_from_swift29testAutoclosureInStaticMethodyyF9TestKlassL_C17getMainActorValue2id11valueForKeySSSgSS_S2SYaKYCXEtYaFZ : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed String, @guaranteed @noescape @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed String) -> (@owned String, @error any Error), @thick TestKlass.Type) -> @owned Optional { + // CHECK-NN: bb0([[ACTOR:%.*]] : @guaranteed $Builtin.ImplicitIsolationActor, [[STRING:%.*]] : @guaranteed $String, [[COMPLETION:%.*]] : @guaranteed $@noescape @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @guaranteed String) -> (@owned String, @error any Error), %3 : $@thick TestKlass.Type) // CHECK-NN: hop_to_executor [[ACTOR]] // CHECK-NN: hop_to_executor [[ACTOR]] // CHECK-NN: hop_to_executor [[ACTOR]] diff --git a/test/SILGen/objc_effectful_properties.swift b/test/SILGen/objc_effectful_properties.swift index 24dba591ecfae..bca51d5ea6bc5 100644 --- a/test/SILGen/objc_effectful_properties.swift +++ b/test/SILGen/objc_effectful_properties.swift @@ -52,7 +52,7 @@ func testAsyncThrows(eff : EffProps) async { // CHECK-LABEL: sil {{.*}}@${{.*}}17testMainActorProp func testMainActorProp(eff : EffProps) async { - // CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none + // CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none // CHECK-NEXT: hop_to_executor [[GENERIC_EXEC]] : // CHECK: hop_to_executor [[GENERIC_EXEC]] : // CHECK: } // end sil function '${{.*}}17testMainActorProp @@ -61,7 +61,7 @@ func testMainActorProp(eff : EffProps) async { // CHECK-LABEL: sil {{.*}}@${{.*}}19testMainActorMethod func testMainActorMethod(eff : EffProps) async { - // CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none + // CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none // CHECK-NEXT: hop_to_executor [[GENERIC_EXEC]] : // CHECK: hop_to_executor [[GENERIC_EXEC]] : // CHECK: } // end sil function '${{.*}}19testMainActorMethod diff --git a/test/SILGen/objc_effectful_properties_checked.swift b/test/SILGen/objc_effectful_properties_checked.swift index 14f891b76b69c..31d34d40771d9 100644 --- a/test/SILGen/objc_effectful_properties_checked.swift +++ b/test/SILGen/objc_effectful_properties_checked.swift @@ -62,7 +62,7 @@ func testAsyncThrows(eff : EffProps) async { // CHECK-LABEL: sil {{.*}}@${{.*}}17testMainActorProp func testMainActorProp(eff : EffProps) async { - // CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none + // CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none // CHECK-NEXT: hop_to_executor [[GENERIC_EXEC]] : // CHECK: hop_to_executor [[GENERIC_EXEC]] : // CHECK: } // end sil function '${{.*}}17testMainActorProp @@ -71,7 +71,7 @@ func testMainActorProp(eff : EffProps) async { // CHECK-LABEL: sil {{.*}}@${{.*}}19testMainActorMethod func testMainActorMethod(eff : EffProps) async { - // CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none + // CHECK: [[GENERIC_EXEC:%.*]] = enum $Optional, #Optional.none // CHECK-NEXT: hop_to_executor [[GENERIC_EXEC]] : // CHECK: hop_to_executor [[GENERIC_EXEC]] : // CHECK: } // end sil function '${{.*}}19testMainActorMethod diff --git a/test/SILGen/toplevel_globalactorvars.swift b/test/SILGen/toplevel_globalactorvars.swift index 5cde7c24fc169..6b460cd847a7e 100644 --- a/test/SILGen/toplevel_globalactorvars.swift +++ b/test/SILGen/toplevel_globalactorvars.swift @@ -130,7 +130,8 @@ if a < 10 { nonisolated(nonsending) func nonisolatedNonSendingFunction() async {} -// CHECK: [[FUNC:%.*]] = function_ref @$s24toplevel_globalactorvars29nonisolatedNonSendingFunctionyyYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional) -> () -// CHECK: apply [[FUNC]]([[ACTOR]]) +// CHECK: [[ACTOR_CAST:%.*]] = unchecked_value_cast [[ACTOR]] : $Optional to $Builtin.ImplicitIsolationActor +// CHECK: [[FUNC:%.*]] = function_ref @$s24toplevel_globalactorvars29nonisolatedNonSendingFunctionyyYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor) -> () +// CHECK: apply [[FUNC]]([[ACTOR_CAST]]) // CHECK-NEXT: hop_to_executor [[ACTOR]] await nonisolatedNonSendingFunction() diff --git a/test/SILOptimizer/consuming_parameter.swift b/test/SILOptimizer/consuming_parameter.swift index 2fb0bd07d241a..bcf000d04bce2 100644 --- a/test/SILOptimizer/consuming_parameter.swift +++ b/test/SILOptimizer/consuming_parameter.swift @@ -5,7 +5,7 @@ // CHECK-LABEL: sil [ossa] @async_dead_arg_call : {{.*}} { // CHECK: {{bb[0-9]+}}([[INSTANCE:%[^,]+]] : @noImplicitCopy @_eagerMove @owned // CHECK: destroy_value [[INSTANCE]] -// CHECK: [[EXECUTOR:%[^,]+]] = enum $Optional, #Optional.none!enumelt +// CHECK: [[EXECUTOR:%[^,]+]] = enum $Optional, #Optional.none!enumelt // CHECK: [[CALLEE:%[^,]+]] = function_ref @async_callee // CHECK: apply [[CALLEE]]() // CHECK: hop_to_executor [[EXECUTOR]] @@ -18,7 +18,7 @@ public func async_dead_arg_call(o: consuming AnyObject) async { // CHECK-LABEL: sil [ossa] @async_dead_arg_call_lexical : {{.*}} { // CHECK: {{bb[0-9]+}}([[INSTANCE:%[^,]+]] : @noImplicitCopy @_lexical @owned -// CHECK: [[EXECUTOR:%[^,]+]] = enum $Optional, #Optional.none!enumelt +// CHECK: [[EXECUTOR:%[^,]+]] = enum $Optional, #Optional.none!enumelt // CHECK: [[CALLEE:%[^,]+]] = function_ref @async_callee // CHECK: apply [[CALLEE]]() // CHECK: hop_to_executor [[EXECUTOR]] @@ -47,7 +47,7 @@ public class C { // CHECK-LABEL: sil [ossa] @async_dead_arg_call_method : {{.*}} { // CHECK: {{bb[0-9]+}}([[INSTANCE:%[^,]+]] : @noImplicitCopy @_eagerMove @owned // CHECK: destroy_value [[INSTANCE]] - // CHECK: [[EXECUTOR:%[^,]+]] = enum $Optional, #Optional.none!enumelt + // CHECK: [[EXECUTOR:%[^,]+]] = enum $Optional, #Optional.none!enumelt // CHECK: [[CALLEE:%[^,]+]] = function_ref @async_callee : $@convention(thin) @async () -> () // CHECK: apply [[CALLEE]]() : $@convention(thin) @async () -> () // CHECK: hop_to_executor [[EXECUTOR]] diff --git a/test/SILOptimizer/definite_init_actor.swift b/test/SILOptimizer/definite_init_actor.swift index 33e48e2c07bf3..2666284c593bb 100644 --- a/test/SILOptimizer/definite_init_actor.swift +++ b/test/SILOptimizer/definite_init_actor.swift @@ -79,7 +79,7 @@ actor BoringActor { // CHECK: bb0([[SELF:%[0-9]+]] : $SingleVarActor): // TODO: We should be able to eliminate this by reasoning that the stores // are to local memory. - // CHECK: [[GENERIC_EXECUTOR:%.*]] = enum $Optional, #Optional.none + // CHECK: [[GENERIC_EXECUTOR:%.*]] = enum $Optional, #Optional.none // CHECK-NEXT: hop_to_executor [[GENERIC_EXECUTOR]] // CHECK: [[EI:%.*]] = end_init_let_ref [[SELF]] // CHECK: store {{%[0-9]+}} to [[ACCESS:%[0-9]+]] @@ -96,7 +96,7 @@ actor BoringActor { // CHECK: bb0({{%[0-9]+}} : $Int, [[SELF:%[0-9]+]] : $SingleVarActor): // TODO: We should be able to eliminate this by reasoning that the stores // are to local memory. - // CHECK: [[GENERIC_EXECUTOR:%.*]] = enum $Optional, #Optional.none + // CHECK: [[GENERIC_EXECUTOR:%.*]] = enum $Optional, #Optional.none // CHECK-NEXT: hop_to_executor [[GENERIC_EXECUTOR]] // CHECK: [[EI:%.*]] = end_init_let_ref [[SELF]] // CHECK: [[MYVAR_REF:%[0-9]+]] = ref_element_addr [[EI]] : $SingleVarActor, #SingleVarActor.myVar @@ -118,7 +118,7 @@ actor BoringActor { // TODO: We should be able to eliminate this by reasoning that the stores // are to local memory. - // CHECK: [[GENERIC_EXECUTOR:%.*]] = enum $Optional, #Optional.none + // CHECK: [[GENERIC_EXECUTOR:%.*]] = enum $Optional, #Optional.none // CHECK-NEXT: hop_to_executor [[GENERIC_EXECUTOR]] // CHECK: [[EI:%.*]] = end_init_let_ref [[SELF]] @@ -150,7 +150,7 @@ actor BoringActor { // TODO: We should be able to eliminate this by reasoning that the stores // are to local memory. - // CHECK: [[GENERIC_EXECUTOR:%.*]] = enum $Optional, #Optional.none + // CHECK: [[GENERIC_EXECUTOR:%.*]] = enum $Optional, #Optional.none // CHECK: hop_to_executor [[GENERIC_EXECUTOR]] // CHECK: cond_br {{%[0-9]+}}, [[SUCCESS_BB:bb[0-9]+]], {{bb[0-9]+}} @@ -170,7 +170,7 @@ actor BoringActor { // CHECK: [[SELF_ALLOC:%[0-9]+]] = alloc_stack [lexical] [var_decl] $SingleVarActor, let, name "self" // Initial hop to the generic executor. - // CHECK: [[GENERIC_EXECUTOR:%.*]] = enum $Optional, #Optional.none + // CHECK: [[GENERIC_EXECUTOR:%.*]] = enum $Optional, #Optional.none // CHECK-NEXT: hop_to_executor [[GENERIC_EXECUTOR]] // Hop immediately after the call to the synchronous init. @@ -219,7 +219,7 @@ actor DefaultInit { // CHECK: bb0([[SELF:%[0-9]+]] : $DefaultInit): // Initial hop to the generic executor. // TODO: This should be easy to remove. - // CHECK: [[GENERIC_EXECUTOR:%.*]] = enum $Optional, #Optional.none + // CHECK: [[GENERIC_EXECUTOR:%.*]] = enum $Optional, #Optional.none // CHECK-NEXT: hop_to_executor [[GENERIC_EXECUTOR]] // CHECK: [[EI:%.*]] = end_init_let_ref [[SELF]] // CHECK: store {{%[0-9]+}} to {{%[0-9]+}} : $*ActingError @@ -231,7 +231,7 @@ actor DefaultInit { // CHECK: bb0({{%[0-9]+}} : $Bool, [[SELF:%[0-9]+]] : $DefaultInit): // Initial hop to the generic executor. // TODO: This should be fairly easy to remove. - // CHECK: [[GENERIC_EXECUTOR:%.*]] = enum $Optional, #Optional.none + // CHECK: [[GENERIC_EXECUTOR:%.*]] = enum $Optional, #Optional.none // CHECK-NEXT: hop_to_executor [[GENERIC_EXECUTOR]] // CHECK: [[EI:%.*]] = end_init_let_ref [[SELF]] // CHECK: store {{%[0-9]+}} to {{%[0-9]+}} : $*ActingError @@ -253,7 +253,7 @@ actor MultiVarActor { // CHECK: bb0({{%[0-9]+}} : $Bool, [[SELF:%[0-9]+]] : $MultiVarActor): // Initial hop to the generic executor. // TODO: This should be easy to remove. - // CHECK: [[GENERIC_EXECUTOR:%.*]] = enum $Optional, #Optional.none + // CHECK: [[GENERIC_EXECUTOR:%.*]] = enum $Optional, #Optional.none // CHECK-NEXT: hop_to_executor [[GENERIC_EXECUTOR]] // CHECK: [[EI:%.*]] = end_init_let_ref [[SELF]] // CHECK: [[REF:%[0-9]+]] = ref_element_addr [[EI]] : $MultiVarActor, #MultiVarActor.firstVar @@ -271,7 +271,7 @@ actor MultiVarActor { // CHECK-LABEL: sil hidden @$s4test13MultiVarActorC10noSuccCaseACSb_tYacfc : $@convention(method) @async (Bool, @sil_isolated @owned MultiVarActor) -> @owned MultiVarActor { // Initial hop to the generic executor. // TODO: This should be easy to remove. - // CHECK: [[GENERIC_EXECUTOR:%.*]] = enum $Optional, #Optional.none + // CHECK: [[GENERIC_EXECUTOR:%.*]] = enum $Optional, #Optional.none // CHECK-NEXT: hop_to_executor [[GENERIC_EXECUTOR]] // CHECK: store {{%[0-9]+}} to [[A1:%[0-9]+]] : $*Int @@ -293,7 +293,7 @@ actor MultiVarActor { // CHECK-LABEL: sil hidden @$s4test13MultiVarActorC10noPredCaseACSb_tYacfc : $@convention(method) @async (Bool, @sil_isolated @owned MultiVarActor) -> @owned MultiVarActor { // Initial hop to the generic executor. // TODO: This should be easy to remove. - // CHECK: [[GENERIC_EXECUTOR:%.*]] = enum $Optional, #Optional.none + // CHECK: [[GENERIC_EXECUTOR:%.*]] = enum $Optional, #Optional.none // CHECK-NEXT: hop_to_executor [[GENERIC_EXECUTOR]] // CHECK: store {{%[0-9]+}} to [[ACCESS:%[0-9]+]] : $*Int @@ -316,7 +316,7 @@ actor MultiVarActor { // TODO: We should be able to remove this hop by proving that all the // stores before return are local. We don't really care about invalid // code, of course, but it should fall out. - // CHECK: [[GENERIC_EXECUTOR:%.*]] = enum $Optional, #Optional.none + // CHECK: [[GENERIC_EXECUTOR:%.*]] = enum $Optional, #Optional.none // CHECK-NEXT: hop_to_executor [[GENERIC_EXECUTOR]] init?(doesNotFullyInit1: Bool) async { firstVar = 1 @@ -324,7 +324,7 @@ actor MultiVarActor { } // CHECK-LABEL: sil hidden @$s4test13MultiVarActorC17doesNotFullyInit2ACSb_tYacfc - // CHECK: [[GENERIC_EXECUTOR:%.*]] = enum $Optional, #Optional.none + // CHECK: [[GENERIC_EXECUTOR:%.*]] = enum $Optional, #Optional.none // CHECK-NEXT: hop_to_executor [[GENERIC_EXECUTOR]] init(doesNotFullyInit2: Bool) async { firstVar = 1 @@ -332,7 +332,7 @@ actor MultiVarActor { } // CHECK-LABEL: sil hidden @$s4test13MultiVarActorC17doesNotFullyInit3ACSb_tYaKcfc - // CHECK: [[GENERIC_EXECUTOR:%.*]] = enum $Optional, #Optional.none + // CHECK: [[GENERIC_EXECUTOR:%.*]] = enum $Optional, #Optional.none // CHECK-NEXT: hop_to_executor [[GENERIC_EXECUTOR]] init(doesNotFullyInit3: Bool) async throws { firstVar = 1 @@ -340,7 +340,7 @@ actor MultiVarActor { } // CHECK-LABEL: sil hidden @$s4test13MultiVarActorC17doesNotFullyInit4ACSgSb_tYacfc - // CHECK: [[GENERIC_EXECUTOR:%.*]] = enum $Optional, #Optional.none + // CHECK: [[GENERIC_EXECUTOR:%.*]] = enum $Optional, #Optional.none // CHECK-NEXT: hop_to_executor [[GENERIC_EXECUTOR]] init?(doesNotFullyInit4: Bool) async { firstVar = 1 @@ -358,7 +358,7 @@ actor TaskMaster { // CHECK-LABEL: @$s4test10TaskMasterCACyYacfc : $@convention(method) @async (@sil_isolated @owned TaskMaster) -> @owned TaskMaster { // Initial hop to the generic executor. // TODO: This should be easy to remove. - // CHECK: [[GENERIC_EXECUTOR:%.*]] = enum $Optional, #Optional.none + // CHECK: [[GENERIC_EXECUTOR:%.*]] = enum $Optional, #Optional.none // CHECK-NEXT: hop_to_executor [[GENERIC_EXECUTOR]] // CHECK: [[ELM:%[0-9]+]] = ref_element_addr [[SELF:%[0-9]+]] : $TaskMaster, #TaskMaster.task @@ -382,7 +382,7 @@ actor SomeActor { // CHECK-LABEL: sil hidden @$s4test9SomeActorCACyYacfc : $@convention(method) @async (@sil_isolated @owned SomeActor) -> @owned SomeActor { // Initial hop to the generic executor. // TODO: This should be easy to remove. - // CHECK: [[GENERIC_EXECUTOR:%.*]] = enum $Optional, #Optional.none + // CHECK: [[GENERIC_EXECUTOR:%.*]] = enum $Optional, #Optional.none // CHECK-NEXT: hop_to_executor [[GENERIC_EXECUTOR]] // CHECK-NOT: begin_access @@ -397,7 +397,7 @@ actor Ahmad { // CHECK-LABEL: sil hidden @$s4test5AhmadCACyYacfc : $@convention(method) @async (@owned Ahmad) -> @owned Ahmad { // CHECK: bb0{{.*}}: - // CHECK-NEXT: [[GENERIC:%[0-9]+]] = enum $Optional, #Optional.none!enumelt + // CHECK-NEXT: [[GENERIC:%[0-9]+]] = enum $Optional, #Optional.none!enumelt // CHECK-NEXT: hop_to_executor [[GENERIC]] // CHECK: store {{%[0-9]+}} to {{%[0-9]+}} : $*Int // CHECK: } // end sil function '$s4test5AhmadCACyYacfc' @@ -412,7 +412,7 @@ actor Customer { // CHECK-LABEL: sil hidden @$s4test8CustomerCACyYaKcfc : init() async throws { - // CHECK: [[GENERIC:%[0-9]+]] = enum $Optional, #Optional.none!enumelt + // CHECK: [[GENERIC:%[0-9]+]] = enum $Optional, #Optional.none!enumelt // CHECK-NEXT: hop_to_executor [[GENERIC]] // CHECK: [[SELF:%.*]] = end_init_let_ref %0 : $Customer diff --git a/test/SILOptimizer/definite_init_flow_sensitive_distributed_actor_self.swift b/test/SILOptimizer/definite_init_flow_sensitive_distributed_actor_self.swift index 7aa74dc6a124f..d5085743272c1 100644 --- a/test/SILOptimizer/definite_init_flow_sensitive_distributed_actor_self.swift +++ b/test/SILOptimizer/definite_init_flow_sensitive_distributed_actor_self.swift @@ -13,6 +13,9 @@ distributed actor NotCodableDA // CHECK-LABEL: sil hidden{{.*}}@$s4test12NotCodableDAC11actorSystemACyxGx_tYacfc : $@convention(method) @async (@in ActorSystem, @sil_isolated @owned NotCodableDA) -> @owned NotCodableDA { init(actorSystem: ActorSystem) async { + // CHECK: [[ISOLATION:%.*]] = enum $Optional, #Optional.none!enumelt + // CHECK: hop_to_executor [[ISOLATION]] + self.actorSystem = actorSystem // First use of #isolation, which is replaced by 'nil'. diff --git a/test/Serialization/caller_isolation_inherit.swift b/test/Serialization/caller_isolation_inherit.swift index 632d746f549ae..54a1e4f942b3b 100644 --- a/test/Serialization/caller_isolation_inherit.swift +++ b/test/Serialization/caller_isolation_inherit.swift @@ -19,7 +19,7 @@ actor A { // CHECK-LABEL: // unspecifiedAsync(_:) // CHECK-NEXT: // Isolation: caller_isolation_inheriting - // CHECK-NEXT: sil @$s11WithFeature16unspecifiedAsyncyyxYalF : $@convention(thin) @async <τ_0_0> (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @in_guaranteed τ_0_0) -> () + // CHECK-NEXT: sil @$s11WithFeature16unspecifiedAsyncyyxYalF : $@convention(thin) @async <τ_0_0> (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @in_guaranteed τ_0_0) -> () func test1() async { // If unspecifiedAsync does not inherit the isolation of A, then we will get // an error. @@ -37,7 +37,7 @@ actor A { // CHECK-LABEL: // unspecifiedAsyncCaller(_:) // CHECK: // Isolation: caller_isolation_inheriting - // CHECK: sil @$s11WithFeature22unspecifiedAsyncCalleryyxYalF : $@convention(thin) @async <τ_0_0> (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @in_guaranteed τ_0_0) -> () + // CHECK: sil @$s11WithFeature22unspecifiedAsyncCalleryyxYalF : $@convention(thin) @async <τ_0_0> (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @in_guaranteed τ_0_0) -> () func test1b() async { await WithFeature.unspecifiedAsyncCaller(ns) } @@ -64,14 +64,14 @@ actor A { // CHECK-LABEL: // unspecifiedAsyncCaller(_:) // CHECK: // Isolation: caller_isolation_inheriting - // CHECK: sil @$s14WithoutFeature22unspecifiedAsyncCalleryyxYalF : $@convention(thin) @async <τ_0_0> (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @in_guaranteed τ_0_0) -> () + // CHECK: sil @$s14WithoutFeature22unspecifiedAsyncCalleryyxYalF : $@convention(thin) @async <τ_0_0> (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @in_guaranteed τ_0_0) -> () func test2b() async { await WithoutFeature.unspecifiedAsyncCaller(ns) } // CHECK-LABEL: // nonisolatedAsync(_:) // CHECK: // Isolation: caller_isolation_inheriting - // CHECK: sil @$s11WithFeature16nonisolatedAsyncyyxYalF : $@convention(thin) @async <τ_0_0> (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @in_guaranteed τ_0_0) -> () + // CHECK: sil @$s11WithFeature16nonisolatedAsyncyyxYalF : $@convention(thin) @async <τ_0_0> (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @in_guaranteed τ_0_0) -> () func test3() async { await WithFeature.nonisolatedAsync(ns) } @@ -87,7 +87,7 @@ actor A { // CHECK-LABEL: // nonisolatedAsyncCaller(_:) // CHECK: // Isolation: caller_isolation_inheriting - // CHECK: sil @$s11WithFeature22nonisolatedAsyncCalleryyxYalF : $@convention(thin) @async <τ_0_0> (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @in_guaranteed τ_0_0) -> () + // CHECK: sil @$s11WithFeature22nonisolatedAsyncCalleryyxYalF : $@convention(thin) @async <τ_0_0> (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @in_guaranteed τ_0_0) -> () func test3b() async { await WithFeature.nonisolatedAsyncCaller(ns) } @@ -112,14 +112,14 @@ actor A { // CHECK-LABEL: // nonisolatedAsyncCaller(_:) // CHECK: // Isolation: caller_isolation_inheriting - // CHECK: sil @$s14WithoutFeature22nonisolatedAsyncCalleryyxYalF : $@convention(thin) @async <τ_0_0> (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @in_guaranteed τ_0_0) -> () + // CHECK: sil @$s14WithoutFeature22nonisolatedAsyncCalleryyxYalF : $@convention(thin) @async <τ_0_0> (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @in_guaranteed τ_0_0) -> () func test4b() async { await WithoutFeature.nonisolatedAsyncCaller(ns) } // CHECK-LABEL: // S.unspecifiedAsync(_:) // CHECK: // Isolation: caller_isolation_inheriting - // CHECK: sil @$s11WithFeature1SV16unspecifiedAsyncyyxYalF : $@convention(method) @async <τ_0_0> (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @in_guaranteed τ_0_0, S) -> () + // CHECK: sil @$s11WithFeature1SV16unspecifiedAsyncyyxYalF : $@convention(method) @async <τ_0_0> (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @in_guaranteed τ_0_0, S) -> () func test5() async { let s = WithFeature.S() await s.unspecifiedAsync(ns) @@ -137,7 +137,7 @@ actor A { // CHECK-LABEL: // S.unspecifiedAsyncCaller(_:) // CHECK: // Isolation: caller_isolation_inheriting - // CHECK: sil @$s11WithFeature1SV22unspecifiedAsyncCalleryyxYalF : $@convention(method) @async <τ_0_0> (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @in_guaranteed τ_0_0, S) -> () + // CHECK: sil @$s11WithFeature1SV22unspecifiedAsyncCalleryyxYalF : $@convention(method) @async <τ_0_0> (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @in_guaranteed τ_0_0, S) -> () func test5b() async { let s = WithFeature.S() await s.unspecifiedAsyncCaller(ns) @@ -145,7 +145,7 @@ actor A { // CHECK-LABEL: // S.nonisolatedAsync(_:) // CHECK: // Isolation: caller_isolation_inheriting - // CHECK: sil @$s11WithFeature1SV16nonisolatedAsyncyyxYalF : $@convention(method) @async <τ_0_0> (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @in_guaranteed τ_0_0, S) -> () + // CHECK: sil @$s11WithFeature1SV16nonisolatedAsyncyyxYalF : $@convention(method) @async <τ_0_0> (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @in_guaranteed τ_0_0, S) -> () func test6() async { let s = WithFeature.S() await s.nonisolatedAsync(ns) @@ -163,7 +163,7 @@ actor A { // CHECK-LABEL: // S.nonisolatedAsyncCaller(_:) // CHECK: // Isolation: caller_isolation_inheriting - // CHECK: sil @$s11WithFeature1SV22nonisolatedAsyncCalleryyxYalF : $@convention(method) @async <τ_0_0> (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @in_guaranteed τ_0_0, S) -> () + // CHECK: sil @$s11WithFeature1SV22nonisolatedAsyncCalleryyxYalF : $@convention(method) @async <τ_0_0> (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @in_guaranteed τ_0_0, S) -> () func test6b() async { let s = WithFeature.S() await s.nonisolatedAsyncCaller(ns) @@ -191,7 +191,7 @@ actor A { // CHECK-LABEL: // S.unspecifiedAsyncCaller(_:) // CHECK: // Isolation: caller_isolation_inheriting - // CHECK: sil @$s14WithoutFeature1SV22unspecifiedAsyncCalleryyxYalF : $@convention(method) @async <τ_0_0> (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @in_guaranteed τ_0_0, S) -> () + // CHECK: sil @$s14WithoutFeature1SV22unspecifiedAsyncCalleryyxYalF : $@convention(method) @async <τ_0_0> (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @in_guaranteed τ_0_0, S) -> () func test7b() async { let s = WithoutFeature.S() await s.unspecifiedAsyncCaller(ns) @@ -219,7 +219,7 @@ actor A { // CHECK-LABEL: // S.nonisolatedAsyncCaller(_:) // CHECK: // Isolation: caller_isolation_inheriting - // CHECK: sil @$s14WithoutFeature1SV22nonisolatedAsyncCalleryyxYalF : $@convention(method) @async <τ_0_0> (@sil_isolated @sil_implicit_leading_param @guaranteed Optional, @in_guaranteed τ_0_0, S) -> () + // CHECK: sil @$s14WithoutFeature1SV22nonisolatedAsyncCalleryyxYalF : $@convention(method) @async <τ_0_0> (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitIsolationActor, @in_guaranteed τ_0_0, S) -> () func test8b() async { let s = WithoutFeature.S() await s.nonisolatedAsyncCaller(ns) diff --git a/test/embedded/concurrency-builtins.swift b/test/embedded/concurrency-builtins.swift index c133d2342b7b6..c8480295ebedd 100644 --- a/test/embedded/concurrency-builtins.swift +++ b/test/embedded/concurrency-builtins.swift @@ -6,6 +6,7 @@ // REQUIRES: swift_feature_Embedded import Builtin +import _Concurrency public func test() async { _ = Builtin.createAsyncTask(0) { () async throws -> Int in diff --git a/tools/swift-ide-test/swift-ide-test.cpp b/tools/swift-ide-test/swift-ide-test.cpp index 8ea7ceaf6bc3a..8e72a4382a8ee 100644 --- a/tools/swift-ide-test/swift-ide-test.cpp +++ b/tools/swift-ide-test/swift-ide-test.cpp @@ -4614,6 +4614,8 @@ int main(int argc, char *argv[]) { InitInvok.computeCXXStdlibOptions(); } + InitInvok.computeAArch64TBIOptions(); + if (!options::InProcessPluginServerPath.empty()) { InitInvok.getSearchPathOptions().InProcessPluginServerPath = options::InProcessPluginServerPath;