Assert if you attempt to perform a write to the transaction-stack while in non-scoped transaction (writes to a Closed() scope are permitted).
Code changes:
Introduce FStackRange to hold a stack pointer range.
Use FStackRange in FContext for storing the true stack range for the thread.
Add a FStackRange to each FTransaction, and use this to ensure that write records aren't added to a transaction if the address is within the transaction's stack.
By having a serparate stack per transaction we can prevent stack writes making their way to a parent transaction's write log, reducing the amount of memory that may need to be tracked and simplifying the Undo logic.
Ensuring that the write log does not contain stack writes is required for the open-memory validator.
#rb neil.henning
[CL 36005508 by ben clayton in ue5-main branch]
When dealing with external code, non-runtime may need to record writes in the open. For instance, the animation code uses the ISPC compiler, which is not natively RTFM-compatible, but we can run ISPC code in the open and manually track its writes.
#rb Brandon.Schaefer
[CL 35978986 by john stiles in ue5-main branch]
Replace AutoRTFM::TIsSafeToReturnFromOpen with AutoRTFM::TAssignFromOpenToClosed.
This provides the same "is-it-safe-to-return-T" functionality, but also supports custom logic for safely copy-assigning or move-assigning a value from the open to the closed.
This is used to fix a memory leak with FText.
#rb neil.henning
[CL 35965187 by ben clayton in ue5-main branch]
Move GTestAnnotation from a global variable, and the FTestAnnotation type to test-local. Having this be global will be treated as a memory leak as the leak detector is run before global destructors.
Use MALLOCLEAK_IGNORE_SCOPE() for calling PerformGarbageCollectionWithIncrementalReachabilityAnalysis(). If the GC does not complete within the time limit, then it'll leak tasks that never complete. Unfortunately, I see no way to flush these.
#rb neil.henning
[CL 35964330 by ben clayton in ue5-main branch]
If the transaction was aborted between CreateStatID() and the FUObjectItem destructor, then the memory allocated in the open for the StatID was not freed.
Allocate the memory in the open, and carefully assign / reset StatIDStringStorage atomically in the open / abort handler.
Also fix / silence some other leaks in UECoreTests.cpp
#rb neil.henning
[CL 35962183 by ben clayton in ue5-main branch]
This API deletes all pushed handlers for a given key. It is functionally equivalent to calling `PopOnAbortHandler` repeatedly, but more efficient.
#rb Brandon.Schaefer
[CL 35935689 by john stiles in ue5-main branch]
This can be necessary when writing an OnAbort handler. We want to roll back changes to heap objects, but it's unsafe to roll back changes to objects on the inner-transaction's stack, so we need to be able to differentiate the two.
[CL 35934666 by john stiles in ue5-main branch]
[FYI] john.stiles
Original CL Desc
-----------------------------------------------------------------
[AutoRTFM] Add PopAllOnAbortHandlers method.
This API deletes all pushed handlers for a given key. It is functionally equivalent to calling `PopOnAbortHandler` repeatedly, but more efficient.
[CL 35930214 by john stiles in ue5-main branch]
This API deletes all pushed handlers for a given key. It is functionally equivalent to calling `PopOnAbortHandler` repeatedly, but more efficient.
[CL 35929239 by john stiles in ue5-main branch]
Add and use FRWTransactionallySafeAccessDetector, a transaction-safe version of FRWAccessDetector.
Use a FTransactionallySafeCriticalSection for UObjectDeleteListenersCritical.
#rb neil.henning
[CL 35622505 by ben clayton in ue5-main branch]
Fortunately, this seemed to work as expected and didn't expose any lurking issues.
#rb michael.nicolella
[CL 35552522 by john stiles in ue5-main branch]
Abort tasks should be destructed immediately after being called, otherwise their destructors may depend on memory freed by a later task.
Commit tasks should be destructed before the abort handlers, again as they might depend on memory that is freed.
#rb michael.nicolella
[CL 35470950 by ben clayton in ue5-main branch]
* Use fopen() as a no-RTFM function instead of std::atomic_bool, as the latter has an inlined implementation on linux.
* Add missing tests for modf() and modff(). Add the missing modfl() registration which these caught.
* Fix RTFM_vswprintf() count calculations for non-windows. vswprintf() is horribly non-portable, and returns -1 if the buffer is too short.
* Adjust the printf tests to handle other non-portablity issues.
* Wrap wide string literals with std::wstring_view() when in REQUIRES(), as catch2 prints a bunch of '?' on error otherwise.
#rb neil.henning
[CL 35365141 by ben clayton in ue5-main branch]