Merge UE5/RES CL# 15462083 to UE5/Main

This represents UE4/Main @ 15414221

[CL 15463811 by Marc Audy in ue5-main branch]
This commit is contained in:
Marc Audy
2021-02-18 18:13:28 -04:00
parent ec7517b4e2
commit 9753392e2b
1568 changed files with 172702 additions and 12923 deletions
@@ -2559,12 +2559,26 @@ void FStructProperty::EmitReferenceInfo(UClass& OwnerClass, int32 BaseOffset, TA
void *FunctionPtr = (void*)CppStructOps->AddStructReferencedObjects();
OwnerClass.ReferenceTokenStream.EmitPointer(FunctionPtr);
}
if (ContainsObjectReference(EncounteredStructProps, EPropertyObjectReferenceType::Strong | EPropertyObjectReferenceType::Weak))
// Check if the struct has any properties that reference UObjects
bool bHasPropertiesWithObjectReferences = false;
if (Struct->PropertyLink)
{
// Can't use ContainObjectReference here as it also checks for STRUCT_AddStructReferencedObjects but we only care about property exposed refs
EncounteredStructProps.Add(this);
for (FProperty* Property = Struct->PropertyLink; Property && !bHasPropertiesWithObjectReferences; Property = Property->PropertyLinkNext)
{
bHasPropertiesWithObjectReferences = Property->ContainsObjectReference(EncounteredStructProps, EPropertyObjectReferenceType::Strong | EPropertyObjectReferenceType::Weak);
}
EncounteredStructProps.RemoveSingleSwap(this);
}
// If the struct has UObject properties (and only if) emit tokens for them
if (bHasPropertiesWithObjectReferences)
{
FGCReferenceFixedArrayTokenHelper FixedArrayHelper(OwnerClass, BaseOffset + GetOffset_ForGC(), ArrayDim, ElementSize, *this);
FProperty* Property = Struct->PropertyLink;
while( Property )
while (Property)
{
Property->EmitReferenceInfo(OwnerClass, BaseOffset + GetOffset_ForGC(), EncounteredStructProps);
Property = Property->PropertyLinkNext;
@@ -1377,9 +1377,13 @@ FLinkerLoad::ELinkerStatus FLinkerLoad::SerializePackageFileSummary()
ELinkerStatus Status = SerializePackageFileSummaryInternal();
if (Status == LINKER_Failed && bIsAsyncLoader)
if (Status == LINKER_Failed)
{
GetAsyncLoader()->EndReadingHeader();
if (bIsAsyncLoader)
{
GetAsyncLoader()->EndReadingHeader();
}
return Status;
}
@@ -1422,8 +1422,14 @@ const TCHAR* FProperty::ImportSingleProperty( const TCHAR* Str, void* DestData,
Str++;
}
int32 removeIdx = FCString::Atoi(*strIdx);
ArrayHelper.RemoveValues(removeIdx);
if (ArrayHelper.IsValidIndex(removeIdx))
{
ArrayHelper.RemoveValues(removeIdx);
}
else
{
Warn->Logf(ELogVerbosity::Warning, TEXT("%s.RemoveIndex(%d): Index not found in array"), *ArrayProperty->GetName(), removeIdx);
}
}
SkipWhitespace(Str);
if (*Str != ')')
@@ -3372,8 +3372,8 @@ UObject* StaticConstructObject_Internal(const FStaticConstructObjectParameters&
check(Result != nullptr);
// Don't call the constructor on recycled subobjects, they haven't been destroyed.
if (!bRecycledSubobject)
{
STAT(FScopeCycleCounterUObject ConstructorScope(InClass, GET_STATID(STAT_ConstructObject)));
{
STAT(FScopeCycleCounterUObject ConstructorScope(InClass->GetFName().IsNone() ? nullptr : InClass, GET_STATID(STAT_ConstructObject)));
(*InClass->ClassConstructor)(FObjectInitializer(Result, Params));
}
@@ -707,8 +707,9 @@ struct TStructOpsTypeTraitsBase2
WithNetDeltaSerializer = false, // struct has a NetDeltaSerialize function for serializing differences in state from a previous NetSerialize operation.
WithSerializeFromMismatchedTag = false, // struct has a SerializeFromMismatchedTag function for converting from other property tags.
WithStructuredSerializeFromMismatchedTag = false, // struct has an FStructuredArchive-based SerializeFromMismatchedTag function for converting from other property tags.
WithPostScriptConstruct = false, // struct has a PostScriptConstruct function which is called after it is constructed in blueprints
WithPostScriptConstruct = false, // struct has a PostScriptConstruct function which is called after it is constructed in blueprints
WithNetSharedSerialization = false, // struct has a NetSerialize function that does not require the package map to serialize its state.
WithPureVirtual = false, // struct has PURE_VIRTUAL functions and cannot be constructed when CHECK_PUREVIRTUALS is true
};
};
@@ -717,6 +718,12 @@ struct TStructOpsTypeTraits : public TStructOpsTypeTraitsBase2<CPPSTRUCT>
{
};
#if CHECK_PUREVIRTUALS
#define DISABLE_ABSTRACT_CONSTRUCT TStructOpsTypeTraits<CPPSTRUCT>::WithPureVirtual
#else
#define DISABLE_ABSTRACT_CONSTRUCT (false && TStructOpsTypeTraits<CPPSTRUCT>::WithPureVirtual)
#endif
#if !PLATFORM_COMPILER_HAS_IF_CONSTEXPR
@@ -724,28 +731,39 @@ struct TStructOpsTypeTraits : public TStructOpsTypeTraitsBase2<CPPSTRUCT>
* Selection of constructor behavior.
*/
template<class CPPSTRUCT>
FORCEINLINE typename TEnableIf<!TStructOpsTypeTraits<CPPSTRUCT>::WithNoInitConstructor>::Type ConstructWithNoInitOrNot(void *Data)
FORCEINLINE typename TEnableIf<!DISABLE_ABSTRACT_CONSTRUCT && !TStructOpsTypeTraits<CPPSTRUCT>::WithNoInitConstructor>::Type ConstructWithNoInitOrNot(void* Data)
{
new (Data) CPPSTRUCT();
}
template<class CPPSTRUCT>
FORCEINLINE typename TEnableIf<TStructOpsTypeTraits<CPPSTRUCT>::WithNoInitConstructor>::Type ConstructWithNoInitOrNot(void *Data)
FORCEINLINE typename TEnableIf<!DISABLE_ABSTRACT_CONSTRUCT && TStructOpsTypeTraits<CPPSTRUCT>::WithNoInitConstructor>::Type ConstructWithNoInitOrNot(void* Data)
{
new (Data) CPPSTRUCT(ForceInit);
}
template<class CPPSTRUCT>
FORCEINLINE typename TEnableIf<!TStructOpsTypeTraits<CPPSTRUCT>::WithNoInitConstructor>::Type ConstructForTestsWithNoInitOrNot(void* Data)
FORCEINLINE typename TEnableIf<DISABLE_ABSTRACT_CONSTRUCT>::Type ConstructWithNoInitOrNot(void* Data)
{
}
template<class CPPSTRUCT>
FORCEINLINE typename TEnableIf<!DISABLE_ABSTRACT_CONSTRUCT && !TStructOpsTypeTraits<CPPSTRUCT>::WithNoInitConstructor>::Type ConstructForTestsWithNoInitOrNot(void* Data)
{
new (Data) CPPSTRUCT;
}
template<class CPPSTRUCT>
FORCEINLINE typename TEnableIf<TStructOpsTypeTraits<CPPSTRUCT>::WithNoInitConstructor>::Type ConstructForTestsWithNoInitOrNot(void* Data)
FORCEINLINE typename TEnableIf<!DISABLE_ABSTRACT_CONSTRUCT && TStructOpsTypeTraits<CPPSTRUCT>::WithNoInitConstructor>::Type ConstructForTestsWithNoInitOrNot(void* Data)
{
new (Data) CPPSTRUCT(ForceInit);
}
template<class CPPSTRUCT>
FORCEINLINE typename TEnableIf<DISABLE_ABSTRACT_CONSTRUCT>::Type ConstructForTestsWithNoInitOrNot(void* Data)
{
}
/**
* Selection of Serialize call.
*/
@@ -1173,19 +1191,24 @@ public:
{
return TTraits::WithZeroConstructor;
}
virtual void Construct(void *Dest) override
virtual void Construct(void* Dest) override
{
check(!TTraits::WithZeroConstructor); // don't call this if we have indicated it is not necessary
// that could have been an if statement, but we might as well force optimization above the virtual call
// could also not attempt to call the constructor for types where this is not possible, but I didn't do that here
#if PLATFORM_COMPILER_HAS_IF_CONSTEXPR
if constexpr (TStructOpsTypeTraits<CPPSTRUCT>::WithNoInitConstructor)
#if CHECK_PUREVIRTUALS
if constexpr (!TStructOpsTypeTraits<CPPSTRUCT>::WithPureVirtual)
#endif
{
new (Dest) CPPSTRUCT(ForceInit);
}
else
{
new (Dest) CPPSTRUCT();
if constexpr (TStructOpsTypeTraits<CPPSTRUCT>::WithNoInitConstructor)
{
new (Dest) CPPSTRUCT(ForceInit);
}
else
{
new (Dest) CPPSTRUCT();
}
}
#else
ConstructWithNoInitOrNot<CPPSTRUCT>(Dest);
@@ -1197,13 +1220,18 @@ public:
// that could have been an if statement, but we might as well force optimization above the virtual call
// could also not attempt to call the constructor for types where this is not possible, but I didn't do that here
#if PLATFORM_COMPILER_HAS_IF_CONSTEXPR
if constexpr (TStructOpsTypeTraits<CPPSTRUCT>::WithNoInitConstructor)
#if CHECK_PUREVIRTUALS
if constexpr (!TStructOpsTypeTraits<CPPSTRUCT>::WithPureVirtual)
#endif
{
new (Dest) CPPSTRUCT(ForceInit);
}
else
{
new (Dest) CPPSTRUCT;
if constexpr (TStructOpsTypeTraits<CPPSTRUCT>::WithNoInitConstructor)
{
new (Dest) CPPSTRUCT(ForceInit);
}
else
{
new (Dest) CPPSTRUCT;
}
}
#else
ConstructForTestsWithNoInitOrNot<CPPSTRUCT>(Dest);
@@ -1579,6 +1607,17 @@ public:
*/
static COREUOBJECT_API void DeferCppStructOps(FName Target, ICppStructOps* InCppStructOps);
template<class CPPSTRUCT>
static typename TEnableIf<!DISABLE_ABSTRACT_CONSTRUCT>::Type DeferCppStructOps(FName Target)
{
DeferCppStructOps(Target, new UScriptStruct::TCppStructOps<CPPSTRUCT>);
}
template<class CPPSTRUCT>
static typename TEnableIf<DISABLE_ABSTRACT_CONSTRUCT>::Type DeferCppStructOps(FName Target)
{
DeferCppStructOps(Target, nullptr);
}
/** Look for the CppStructOps and hook it up **/
virtual COREUOBJECT_API void PrepareCppStructOps();
@@ -400,7 +400,13 @@ bool FORCEINLINE NetworkGuidSetsAreSame( const TSet< FNetworkGUID >& A, const TS
class INetDeltaBaseState : public TSharedFromThis<INetDeltaBaseState>
{
public:
INetDeltaBaseState() { }
INetDeltaBaseState()
: LastAckedHistory(0)
, ChangelistHistory(0)
{
}
virtual ~INetDeltaBaseState() { }
virtual bool IsStateEqual(INetDeltaBaseState* Otherstate) = 0;
@@ -411,7 +417,15 @@ public:
*/
virtual void CountBytes(FArchive& Ar) const {}
uint32 GetLastAckedHistory() const { return LastAckedHistory; }
void SetLastAckedHistory(uint32 InAckedHistory) { LastAckedHistory = InAckedHistory; }
uint32 GetChangelistHistory() const { return ChangelistHistory; }
void SetChangelistHistory(uint32 InChangelistHistory) { ChangelistHistory = InChangelistHistory; }
private:
uint32 LastAckedHistory;
uint32 ChangelistHistory;
};
struct FNetDeltaSerializeInfo;
@@ -2384,7 +2384,7 @@ struct COREUOBJECT_API FCoreUObjectDelegates
DECLARE_MULTICAST_DELEGATE_OneParam(FPreLoadMapDelegate, const FString& /* MapName */);
static FPreLoadMapDelegate PreLoadMap;
/** Sent at the _successful_ end of LoadMap */
/** Sent at the end of LoadMap */
DECLARE_MULTICAST_DELEGATE_OneParam(FPostLoadMapDelegate, UWorld* /* LoadedWorld */);
static FPostLoadMapDelegate PostLoadMapWithWorld;