SIL function can be serialized with different kinds: [serialized] or

[serialized_for_package] if Package CMO is enabled. The latter kind
allows a function to be serialized even if it contains loadable types,
if Package CMO is enabled. Renamed IsSerialized_t as SerializedKind_t.

The tri-state serialization kind requires validating inlinability
depending on the serialization kinds of callee vs caller; e.g. if the
callee is [serialized_for_package], the caller must be _not_ [serialized].
Renamed `hasValidLinkageForFragileInline` as `canBeInlinedIntoCaller`
that takes in its caller's SerializedKind as an argument. Another argument
`assumeFragileCaller` is also added to ensure that the calle sites of
this function know the caller is serialized unless it's called for SIL
inlining optimization passes.

The [serialized_for_package] attribute is allowed for SIL function, global var,
v-table, and witness-table.

Resolves rdar://128406520
This commit is contained in:
Ellie Shin
2024-05-16 12:23:47 -07:00
parent 0f332e17dd
commit 5ccc4cd394
71 changed files with 1187 additions and 687 deletions

View File

@@ -230,7 +230,7 @@ static SILFunction *specializeVTableMethod(SILFunction *origMethod,
module.linkFunction(SpecializedF, SILModule::LinkingMode::LinkAll);
SpecializedF->setLinkage(SILLinkage::Public);
SpecializedF->setSerialized(IsNotSerialized);
SpecializedF->setSerializedKind(IsNotSerialized);
return SpecializedF;
}