[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:
Michael Gottesman
2025-08-06 17:01:52 -07:00
parent fe9c21fd87
commit 788abd0b96
16 changed files with 360 additions and 102 deletions

View File

@@ -1248,3 +1248,16 @@ ManagedValue SILGenBuilder::borrowObjectRValue(SILGenFunction &SGF,
}
return SGF.emitFormalEvaluationManagedBeginBorrow(loc, value);
}
SILValue SILGenBuilder::convertToImplicitActor(SILLocation loc,
SILValue value) {
auto type = SILType::getBuiltinImplicitActorType(getASTContext());
if (value->getType() == type)
return value;
assert(value->getType() == SILType::getOpaqueIsolationType(getASTContext()) &&
"Can only convert Optional<any Actor> to "
"Builtin.ImplicitActor");
if (value->getOwnershipKind() != OwnershipKind::Guaranteed)
value = SGF.emitManagedBeginBorrow(loc, value).getValue();
return createUncheckedValueCast(loc, value, type);
}