Commit Graph

35 Commits

Author SHA1 Message Date
phillip kavan
9817b53199 Allow TObjectPtr instances to resolve directly to placeholder-typed references when T=UObject.
Notes:
- For placeholder-typed objects, TObjectPtr<UObject> is considered to be type safe since placeholder types are based on UObject.
- This means we can avoid having to check for and indirectly resolve placeholders via the ptr's internal object handle in these cases.

#jira UE-209831
#rb Francis.Hurteau, Zousar.Shaker

[CL 32434610 by phillip kavan in ue5-main branch]
2024-03-22 11:12:08 -04:00
phillip kavan
91216b7898 [UE]: More revisions to placeholder property bag type import/export serialization support during map asset loads in the editor.
Change summary:
- Modified ObjectPtr_Private::IsObjectPtrEqualToRawPtrOfRelatedType() to include a non-resolving NULL check for LHS. This allows unsafe type object pointers to equate to NULL object pointers (in addition to nullptr) - e.g. for compiled paths that do implicit type conversions from nullptr to TObjectPtr(nullptr). Also updated the unit test to reflect this behavior change.
- Replaced FPropertyBagRepository::IsPropertyBagPlaceholderType() with IsPropertyBagPlaceholderObject().
- No longer setting RF_HasPlaceholderType on placeholder import type CDOs. This allows UObject initializers to evaluate/dereference the CDO ptr normally as a UObject*, even if created with a placeholder type.
- Replaced direct RF_HasPlaceholderType flag queries with FPropertyBagRepository::IsPropertyBagPlaceholderObject() instead for placeholder export object queries in FLinkerLoad. This remains inclusive of the CDO.
- Now appending RF_HasPlaceholderType onto the ObjectFlags member for export entries created from placeholder type imports. The flag will be cleared if/when the correct instance is patched back into the export table (e.g. at reinstancing time).
- Modified FLinkerLoad::TryCreatePlaceholderTypeForExport() to remove the check for 'bSerializeUnknownProperty'. This does not get set until after we've created the placeholder type when we attempt to Preload() the export that's using it.
- Modified FLinkerLoad::Serialize() to virtualize serialization when loading a property bag for an object with a missing type import that was serialized with an asset version older than EUnrealEngineObjectUE5Version::SCRIPT_SERIALIZATION_OFFSET.
- Modified FLinkerLoad::Preload() to include an asset version check for when serialization of placeholder exports can be safely narrowed to SerializeScriptProperties(). For older asset versions, any non-TPS data serialization is now virtualized instead.
- A warning is now emitted by FLinkerLoad::operator<<() when returning NULL for placeholder export object refs in those cases where we are not able to enforce its type safety at runtime. This now includes reflected properties that might serialize a reference to a placeholder type's CDO, which should be an unlikely edge case that we'll now report on here.
- Re-enabled unit tests for object handle/pointer type safety (ObjectHandleTests.cpp).
- Added a "stress test" method for object pointers to assist with A/B testing and perf analysis (ObjectPtrTests.cpp).
- Modified natvis to extend the TObjectPtr format to display as 'nullptr' for pointers to placeholder export types. Intent is to minimize confusion while debugging since object pointers don't allow access to unsafe type objects directly.
- Added a CVar to control whether or not we will create placeholder exports as serialization targets when import types are missing on map load (SceneGraph.EnablePropertyBagPlaceholderObjectSupport). Also can be enabled at launch via command line (-EnablePropertyBagPlaceholderObjects) for iteration purposes. Currently the CVar/feature defaults to off (experimental/WiP).

#jira UE-197358
#rb Francis.Hurteau

[CL 31447968 by phillip kavan in ue5-main branch]
2024-02-13 16:53:52 -05:00
zousar shaker
a181f60498 Reduce overhead in object handle access tracking by reducing high frequency thrash of TArrayView. Synthetic test of 100 million handle accesses in a loop went from 4243ms total time to 1430ms total time.
Further improvements to be had by avoiding CheckCallable overhead of TFunction and making a lockless container to store read callbacks.  Those will be investigated in future changelists.

#rb joe.pribele
[FYI] dan.oconnor
[FYI] ben.zeigler

[CL 27728373 by zousar shaker in ue5-main branch]
2023-09-08 17:04:23 -04:00
robert manuszewski
b5e73242e3 Experimental support for Incremental Reachability Analysis (second attempt)
Disabled by default. gc.AllowIncrementalReachability controls if it's enabled or not.
gc.IncrementalReachabilityTimeLimit controls time limit (defaults to 0.005 = 5ms)
gc.VerifyNoUnrachableObjects (defaults to 0) controls additional GC assumption verification that no unreachable objects are reachable after RA is complete
gc.ContinuousIncrementalGC (defaults to 0) is a new GC stress test that runs incremental GC continuously
TObjectPtr barrier (Obj->MarkAsReachable()) is also currently disabled (compiled out with a macro) until we have all the places (ARO/BPVM) properly running barriers
EngineTest tests can and will run Incremental Reachability Analysis tests even if all the above is disabled

#rb Johan.Torp, Zousar.Shaker

[CL 26252569 by robert manuszewski in ue5-main branch]
2023-06-27 01:44:30 -04:00
robert manuszewski
d5c2c7bc97 Undo changelist 26229717
#rb none

[CL 26237963 by robert manuszewski in ue5-main branch]
2023-06-26 13:26:02 -04:00
robert manuszewski
5800b6b608 Experimental support for Incremental Reachability Analysis
Disabled by default. gc.AllowIncrementalReachability controls if it's enabled or not.
gc.IncrementalReachabilityTimeLimit controls time limit (defaults to 0.005 = 5ms)
gc.VerifyUnrachableObjects (defaults to 0) controls additional GC assumption verification that no unreachable objects are reachable after RA is complete
gc.ContinuousIncrementalGC (defaults to 0) is a new GC stress test that runs incremental GC continuously
TObjectPtr barrier (Obj->MarkAsReachable()) is also currently disabled (compiled out with a macro) until we have all the places (ARO/BPVM) properly running barriers
EngineTest tests can and will run Incremental Reachability Analysis tests even if all the above is disabled

#rb Johan.Torp, Zousar.Shaker

[CL 26229728 by robert manuszewski in ue5-main branch]
2023-06-26 04:38:56 -04:00
joe pribele
f2b80ba74b added GetOuter and GetPackage to FObectPtr and TObjectPtr
changed how the Object Handle index stores info to be able to get the class of the outer objects
Packages dont' store a ObjectPathId or ClassDescriptor as it is always known

https://p4-swarm.epicgames.net/reviews/25378953
#rb zousar.shaker
#preflight 64791957e25209b6cbbb45fc

[CL 25747367 by joe pribele in ue5-main branch]
2023-06-01 18:45:09 -04:00
kirill zorin
de8db5ff76 Converting ARO-facing raw pointers to TObjectPtr ahead of raw pointer ARO API deprecation.
#rb zousar.shaker
#rb markus.breyer
#rb robert.manuszewski

#preflight 646391406b1406b54ab15460

[CL 25489627 by kirill zorin in ue5-main branch]
2023-05-16 10:52:49 -04:00
kirill zorin
a58d329c4d Update TObjectPtr unit tests to assert against specific pointers (instead of all pointers) due to upcoming ARO changes.
#rb joe.pribele
#preflight 644ae1066638b912841d8bc1

[CL 25223794 by kirill zorin in ue5-main branch]
2023-04-27 17:20:13 -04:00
kirill zorin
448abc5841 Excluding relevant unit tests when mutable TObjectPtr containers are disabled
#rb zousar.shaker
#preflight 644a878c1c2846595c9d171a

[CL 25214999 by kirill zorin in ue5-main branch]
2023-04-27 11:06:53 -04:00
joe pribele
9f5fbe6b97 reducing the number of items in the array conversion tests as the 100k items was unnecessary
https://p4-swarm.epicgames.net/reviews/25165292

#rb devin.doucette
#preflight 6446f4a827014596f3952e7d

[CL 25172199 by joe pribele in ue5-main branch]
2023-04-24 17:46:08 -04:00
joe pribele
db7a692cc7 second attempt to fix for performance problem when converting arrays of TObjectPtr to UObject*
changed the access tracking to a bulk operation api to allow for single calls instead of O(n) calls
#preflight 63fe5fc7ac6c61e2b553e9a9

[CL 24449378 by joe pribele in ue5-main branch]
2023-02-28 15:26:26 -05:00
joe pribele
6d1d492c29 [Backout] - CL24432584
#fyi joe.pribele
Original CL Desc
-----------------------------------------------------------------
fix for performance problem when converting arrays of TObjectPtr to UObject*
changed the access tracking to a bulk operation api to allow for single calls instead of O(n) calls
#preflight 63fd1de9f43e53f6811a37af

[CL 24436160 by joe pribele in ue5-main branch]
2023-02-27 19:54:50 -05:00
joe pribele
bcc680cfa3 fix for performance problem when converting arrays of TObjectPtr to UObject*
changed the access tracking to a bulk operation api to allow for single calls instead of O(n) calls
#preflight 63fd1de9f43e53f6811a37af

[CL 24432584 by joe pribele in ue5-main branch]
2023-02-27 16:37:45 -05:00
steve robb
4900d8a570 Replaced TModels traits class with TModels_V.
#rb devin.doucette
#preflight 63d3aabf5354589b5cd2343b

[CL 23889491 by steve robb in ue5-main branch]
2023-01-27 14:51:16 -05:00
joe pribele
e39d3ce7ef changed ObjectHandleTracking to use Functions instead of delegates as the performance of delegate is poor
https://p4-swarm.epicgames.net/reviews/23751084

#rb zousar.shaker
#preflight 63c9ae14d45afa2a8fc37d9d

[CL 23781117 by joe pribele in ue5-main branch]
2023-01-19 16:34:29 -05:00
joe pribele
eb2bb506e7 code cleanup of ObjectHandle
made ObjectPathId to private
trimmed down the public API as much as possible

https://p4-swarm.epicgames.net/reviews/23658342

#rb zousar.shaker
#preflight 63c5c8922a6acaf1625fcf25

[CL 23734208 by joe pribele in ue5-main branch]
2023-01-16 19:20:47 -05:00
joe pribele
cffacc0be5 support for TObjectPtr handling renames and GetTypeHash(TObjectPtr) no long has to resolve
GetTypeHash will create a packaged object ref for hashing if the class is defined as lazy load otherwise raw pointer is hashed
a map was added for moved objects and ObjectPathId can be a WeakObjectPtr
the map allows UObjects to be mapped back to packed object refs

#rb zousar.shaker
https://p4-swarm.epicgames.net/reviews/23356491
#preflight 63b5de641c35d1cbdbccecf7
#preflight 63b70406e26e31879b8aa6d3

[CL 23589497 by joe pribele in ue5-main branch]
2023-01-05 12:27:16 -05:00
joe pribele
0f45c0a9d5 Undo //UE5/Main/Engine/... changelist 23416765
#preflight 638fed855c5308d18c157af0

[CL 23423019 by joe pribele in ue5-main branch]
2022-12-06 20:58:56 -05:00
joe pribele
115c3e1a0e support for TObjectPtr handling renames and GetTypeHash(TObjectPtr) no long has to resolve
GetTypeHash will create a packaged object ref for hashing if the class is defined as lazy load otherwise raw pointer is hashed
a map was added for moved objects and ObjectPathId can be a WeakObjectPtr
the map allows UObjects to be mapped back to packed object refs
#preflight 638fad1b5624e6da5e166024

[CL 23416765 by joe pribele in ue5-main branch]
2022-12-06 16:27:20 -05:00
joe pribele
50cfdde358 [CoreUObject] changed to check for null in TObjectPtr.GetPathName()
#preflight 63643317de2c4dbb5d47122c

[CL 22968073 by joe pribele in ue5-main branch]
2022-11-03 17:47:24 -04:00
joe pribele
a1505d5477 [CoreUObject] compile fix for Linux.
moved test classes outside of namespace as that was causing problems for the compiler
#preflight 6356dcc73a547c3da332a751

[CL 22733737 by joe pribele in ue5-main branch]
2022-10-24 15:11:24 -04:00
joe pribele
fa12cd9a46 [CoreUObject] fix for TObjectPtr equals operator with multiple inheritance
resolved pointers where comparing uintptr_t instead of the raw pointers which allow for inheritance
#jira https://jira.it.epicgames.com/browse/UE-168013
#rb zousar.shaker
#preflight 6356c19a9e14ee3c795a2b6f

[CL 22731180 by joe pribele in ue5-main branch]
2022-10-24 13:12:36 -04:00
joe pribele
0574fc6d7a removed usage of TObjectPtr.IsNull and IsNullNoResolve
#rb zousar.shaker
#p4v-preflight-copy 22193787

[CL 22361481 by joe pribele in ue5-main branch]
2022-10-05 15:34:23 -04:00
zousar shaker
6503f197d5 Improve debugability of FObjectPtr/TObjectPtr by supplying a "DebugPtr" member on both that can be used to dereference resolved object references in debugger watch windows. This required changing TObjectPtr to not privately inherit from FObjectPtr, but to instead contain an FObjectPtr.
#rb devin.doucette
#rb matt.peters

[CL 22147494 by zousar shaker in ue5-main branch]
2022-09-22 18:18:37 -04:00