mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[silgen] Use Builtin.ImplicitActor instead of Optional<any Actor> to represent the implicit isolated parameter.
NOTE: We are not performing any bitmasking at all now. This is so that we can transition the code base/tests to expect Builtin.ImplicitActor instead of Optional<any Actor>. NOTE: The actual test changes are in the next commit. I did this to make it easier to review the changes. This should not have any user visible changes.
This commit is contained in:
38
include/swift/SIL/ConcurrencyUtils.h
Normal file
38
include/swift/SIL/ConcurrencyUtils.h
Normal file
@@ -0,0 +1,38 @@
|
||||
//===--- 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.ImplicitActor
|
||||
///
|
||||
/// \p finalType if empty, we always return
|
||||
/// Builtin.ImplicitActor. Otherwise we bitcast to finalType after
|
||||
/// tieing the lifetime of the result to \p value.
|
||||
SILValue clearImplicitActorBits(SILBuilder &b, SILLocation loc, SILValue value,
|
||||
SILType finalType = {});
|
||||
|
||||
SILValue setImplicitActorBits(SILBuilder &b, SILLocation loc, SILValue value);
|
||||
|
||||
} // namespace swift
|
||||
|
||||
#endif
|
||||
@@ -1330,6 +1330,17 @@ public:
|
||||
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());
|
||||
|
||||
Reference in New Issue
Block a user