93 void* (*Allocate)(
size_t Size,
size_t Alignment);
97 void* (*Reallocate)(
void* Pointer,
size_t Size,
size_t Alignment);
101 void* (*AllocateZeroed)(
size_t Size,
size_t Alignment);
129 void (*OnRuntimeEnabledChanged)();
134 void (*OnRetryTransactionsChanged)();
139 void (*OnMemoryValidationLevelChanged)();
144 void (*OnMemoryValidationThrottlingChanged)();
149 void (*OnMemoryValidationStatisticsChanged)();
153#if UE_AUTORTFM_ENABLED
166#if UE_AUTORTFM_ENABLED
177#if UE_AUTORTFM_ENABLED
186#if UE_AUTORTFM_ENABLED
195#if UE_AUTORTFM_ENABLED
204#if UE_AUTORTFM_ENABLED
213#if UE_AUTORTFM_ENABLED
224#if UE_AUTORTFM_ENABLED
235#if UE_AUTORTFM_ENABLED
245#if UE_AUTORTFM_ENABLED
251#if UE_AUTORTFM_ENABLED
257#if UE_AUTORTFM_ENABLED
263#if UE_AUTORTFM_ENABLED
269#if UE_AUTORTFM_ENABLED
275#if UE_AUTORTFM_ENABLED
290#if UE_AUTORTFM_ENABLED
300#if UE_AUTORTFM_ENABLED
332#if UE_AUTORTFM_ENABLED
346#if UE_AUTORTFM_ENABLED
356#if UE_AUTORTFM_ENABLED
365#if UE_AUTORTFM_ENABLED
375#if UE_AUTORTFM_ENABLED
385#if UE_AUTORTFM_ENABLED
402#if UE_AUTORTFM_ENABLED
412#if UE_AUTORTFM_ENABLED
427#if UE_AUTORTFM_ENABLED
437#if UE_AUTORTFM_ENABLED
522 case EContextStatus::AbortedByFailedLockAcquisition:
523 case EContextStatus::AbortedByLanguage:
524 case EContextStatus::AbortedByRequest:
525 case EContextStatus::AbortedByCascadingAbort:
526 case EContextStatus::AbortedByCascadingRetry:
528 case EContextStatus::Idle:
529 case EContextStatus::OnTrack:
530 case EContextStatus::Committing:
531 case EContextStatus::InStaticLocalInitializer:
559namespace ForTheRuntime
582template<
typename FunctorType>
588template<
typename FunctorType>
599template<
typename FunctorType>
651template<
typename FunctorType>
659 const_cast<void*
>(
static_cast<const void*
>(&Functor))));
668template<
typename FunctorType>
676 const_cast<void*
>(
static_cast<const void*
>(&Functor))));
684template<
typename FunctorType>
690 const_cast<void*
>(
static_cast<const void*
>(&Functor)));
708 ForTheRuntime::CascadingAbortTransactionInternal();
716template<
typename T,
typename =
void>
742template<
typename T,
typename =
void>
747template<
typename T,
typename =
void>
772template<
typename ...
TYPES>
775 template<
size_t I = 0,
typename SRC =
void>
778 if constexpr(I <
sizeof...(TYPES))
780 using E = std::tuple_element_t<I, std::tuple<
TYPES...>>;
781 TAssignFromOpenToClosed<E>::Assign(std::get<I>(
Closed), std::get<I>(std::forward<SRC>(
Open)));
786 template<
typename SRC>
800 template<
typename OPEN>
822 typename FunctorType =
void,
823 typename ReturnType =
decltype(std::declval<FunctorType>()())
828 "function return type is not safe to return from Open()");
837 if constexpr (std::is_same_v<void, ReturnType>)
843 const FunctorType&
Fn = *
reinterpret_cast<FunctorType*
>(Arg);
857 const_cast<void*
>(
static_cast<const void*
>(&Functor)),
869 TAssignFromOpenToClosed<ReturnType>::Assign(
Self.ReturnValue, std::move(
Self.Functor()));
871 const FunctorType& Functor;
872 ReturnType ReturnValue{};
884 reinterpret_cast<void*
>(&Helper),
887 return Helper.ReturnValue;
910 const_cast<void*
>(
static_cast<const void*
>(&Functor))));
922 ForTheRuntime::CascadingRetryTransactionInternal();
941 ForTheRuntime::OnCommitInternal(std::forward<FunctorType>(Work));
960 ForTheRuntime::OnPreAbortInternal(std::forward<FunctorType>(Work));
975 ForTheRuntime::OnAbortInternal(std::forward<FunctorType>(Work));
992 ForTheRuntime::OnCompleteInternal(std::forward<FunctorType>(Work));
1008 ForTheRuntime::PushOnCommitHandlerInternal(Key, std::forward<FunctorType>(Work));
1025 ForTheRuntime::PopOnCommitHandlerInternal(Key);
1039 ForTheRuntime::PopAllOnCommitHandlersInternal(Key);
1056 ForTheRuntime::PushOnAbortHandlerInternal(Key, std::forward<FunctorType>(Work));
1073 ForTheRuntime::PopOnAbortHandlerInternal(Key);
1090 ForTheRuntime::PopAllOnAbortHandlersInternal(Key);
1167#if UE_AUTORTFM_ENABLED
1182 if (AutoRTFM::IsTransactional())
1184 AutoRTFM::Unreachable(Message);
1191 if (AutoRTFM::IsClosed())
1193 AutoRTFM::Unreachable(Message);
1200template <
typename FuncType,
typename ...
ArgTypes>
1205template <
typename Type>
1214namespace ForTheRuntime
1293 if (AutoRTFM::IsClosed())
1321 [[
deprecated(
"Use `SetEnsureOnInternalAbort` instead!")]]
1328 [[
deprecated(
"Use `GetEnsureOnInternalAbort` instead!")]]
1335 [[
deprecated(
"Use `GetInternalAbortAction` instead!")]]
1435namespace AutoRTFM::Private
1439 template<
typename FunctorType>
1442 AutoRTFM::Open(std::forward<FunctorType>(
F));
1447 template<
typename FunctorType>
1450 AutoRTFM::Open<EMemoryValidationLevel::Disabled>(std::forward<FunctorType>(
F));
1455 template<
typename FunctorType>
1458 return AutoRTFM::Close(std::move(
F));
1463 template<
typename FunctorType>
1466 AutoRTFM::OnPreAbort(std::forward<FunctorType>(
F));
1471 template<
typename FunctorType>
1474 AutoRTFM::OnAbort(std::forward<FunctorType>(
F));
1479 template<
typename FunctorType>
1482 AutoRTFM::OnCommit(std::forward<FunctorType>(
F));
1487 template<
typename FunctorType>
1490 AutoRTFM::Transact(std::forward<FunctorType>(
F));
1497 template <
typename Type,
int Unique>
1507#define UE_AUTORTFM_DECLARE_THREAD_LOCAL_VAR_IMPL(Type, Name) Type& Name = ::AutoRTFM::Private::FThreadLocalHelper::Get<Type, __COUNTER__>()
1509#define UE_AUTORTFM_OPEN_IMPL ::AutoRTFM::Private::FOpenHelper{} + [&]()
1510#define UE_AUTORTFM_OPEN_NO_VALIDATION_IMPL ::AutoRTFM::Private::FOpenNoMemoryValidationHelper{} + [&]()
1511#define UE_AUTORTFM_CLOSE_IMPL ::AutoRTFM::Private::FCloseHelper{} + [&]()
1512#define UE_AUTORTFM_ONPREABORT_IMPL(...) ::AutoRTFM::Private::FOnPreAbortHelper{} + [__VA_ARGS__]() mutable
1513#define UE_AUTORTFM_ONABORT_IMPL(...) ::AutoRTFM::Private::FOnAbortHelper{} + [__VA_ARGS__]() mutable
1514#define UE_AUTORTFM_ONCOMMIT_IMPL(...) ::AutoRTFM::Private::FOnCommitHelper{} + [__VA_ARGS__]() mutable
1515#define UE_AUTORTFM_TRANSACT_IMPL ::AutoRTFM::Private::FTransactHelper{} + [&]()
1519#define UE_AUTORTFM_DECLARE_THREAD_LOCAL_VAR_IMPL(Type, Name) thread_local Type Name
1520#define UE_AUTORTFM_OPEN_IMPL
1521#define UE_AUTORTFM_OPEN_NO_VALIDATION_IMPL
1522#define UE_AUTORTFM_CLOSE_IMPL
1523#define UE_AUTORTFM_ONPREABORT_IMPL(...) while (false)
1524#define UE_AUTORTFM_ONABORT_IMPL(...) while (false)
1525#define UE_AUTORTFM_ONCOMMIT_IMPL(...)
1526#define UE_AUTORTFM_TRANSACT_IMPL
1533#define UE_AUTORTFM_DECLARE_THREAD_LOCAL_VAR(Type, Name) UE_AUTORTFM_DECLARE_THREAD_LOCAL_VAR_IMPL(Type, Name)
1537#define UE_AUTORTFM_OPEN UE_AUTORTFM_OPEN_IMPL
1539#define UE_AUTORTFM_OPEN_NO_VALIDATION UE_AUTORTFM_OPEN_NO_VALIDATION_IMPL
1543#define UE_AUTORTFM_CLOSE UE_AUTORTFM_CLOSE_IMPL
1549#define UE_AUTORTFM_ONPREABORT(...) UE_AUTORTFM_ONPREABORT_IMPL(__VA_ARGS__)
1555#define UE_AUTORTFM_ONABORT(...) UE_AUTORTFM_ONABORT_IMPL(__VA_ARGS__)
1561#define UE_AUTORTFM_ONCOMMIT(...) UE_AUTORTFM_ONCOMMIT_IMPL(__VA_ARGS__)
1565#define UE_AUTORTFM_TRANSACT UE_AUTORTFM_TRANSACT_IMPL
1568#define UE_AUTORTFM_REGISTER_OPEN_TO_CLOSED_FUNCTIONS(...) \
1569 static const ::AutoRTFM::ForTheRuntime::TAutoRegisterOpenToClosedFunctions<__VA_ARGS__> UE_AUTORTFM_CONCAT(AutoRTFMFunctionRegistration, __COUNTER__)
1571#define UE_AUTORTFM_REGISTER_OPEN_TO_CLOSED_FUNCTIONS(...)
OODEFFUNC typedef void(OODLE_CALLBACK t_fp_OodleCore_Plugin_Free)(void *ptr)
autortfm_memory_validation_level
Definition AutoRTFMConstants.h:19
@ autortfm_memory_validation_level_warn
Definition AutoRTFMConstants.h:27
@ autortfm_memory_validation_level_error
Definition AutoRTFMConstants.h:30
@ autortfm_memory_validation_level_default
Definition AutoRTFMConstants.h:21
@ autortfm_memory_validation_level_disabled
Definition AutoRTFMConstants.h:24
#define UE_AUTORTFM_CRITICAL_INLINE
Definition AutoRTFMDefines.h:202
#define UE_AUTORTFM_FORCENOINLINE
Definition AutoRTFMDefines.h:173
#define UE_AUTORTFM_CALLSITE_FORCEINLINE
Definition AutoRTFMDefines.h:126
#define AUTORTFM_EXCEPT
Definition AutoRTFMDefines.h:135
#define UE_AUTORTFM_UNUSED(UNUSEDVAR)
Definition AutoRTFMDefines.h:197
#define AUTORTFM_CALL_IS_DISABLED(EXPR_OR_TYPE)
Definition AutoRTFMDefines.h:125
#define AUTORTFM_DISABLE
Definition AutoRTFMDefines.h:116
#define UE_AUTORTFM_FORCEINLINE
Definition AutoRTFMDefines.h:171
#define AUTORTFM_DISABLE_UNREACHABLE_CODE_WARNINGS
Definition AutoRTFMDefines.h:193
#define UE_AUTORTFM_API
Definition AutoRTFMDefines.h:156
#define UE_AUTORTFM_CRITICAL_INLINE_ALWAYS
Definition AutoRTFMDefines.h:203
#define AUTORTFM_OPEN
Definition AutoRTFMDefines.h:122
#define AUTORTFM_RESTORE_UNREACHABLE_CODE_WARNINGS
Definition AutoRTFMDefines.h:194
#define UE_AUTORTFM_ALWAYS_OPEN
Definition AutoRTFMDefines.h:114
#define AUTORTFM_NOEXCEPT
Definition AutoRTFMDefines.h:134
uint64_t autortfm_transaction_id
Definition AutoRTFM.h:86
UE_AUTORTFM_CRITICAL_INLINE void autortfm_commit(void(*UninstrumentedWork)(void *), void(*InstrumentedWork)(void *), void *Arg)
Definition AutoRTFM.h:238
UE_AUTORTFM_CRITICAL_INLINE autortfm_result autortfm_commit_transaction() AUTORTFM_NOEXCEPT
Definition AutoRTFM.h:260
UE_AUTORTFM_CRITICAL_INLINE void autortfm_did_free(void *ptr) AUTORTFM_NOEXCEPT
Definition AutoRTFM.h:415
UE_AUTORTFM_CRITICAL_INLINE bool autortfm_is_transactional(void) AUTORTFM_NOEXCEPT
Definition AutoRTFM.h:180
UE_AUTORTFM_CRITICAL_INLINE autortfm_transaction_id autortfm_current_transaction_id() AUTORTFM_NOEXCEPT
Definition AutoRTFM.h:254
UE_AUTORTFM_CRITICAL_INLINE void autortfm_record_open_write_no_memory_validation(void *Ptr, size_t Size) AUTORTFM_NOEXCEPT
Definition AutoRTFM.h:303
UE_AUTORTFM_CRITICAL_INLINE void autortfm_abort_transaction() AUTORTFM_NOEXCEPT
Definition AutoRTFM.h:248
UE_AUTORTFM_CRITICAL_INLINE void autortfm_check_abi(void *ptr, size_t size) AUTORTFM_NOEXCEPT
Definition AutoRTFM.h:430
UE_AUTORTFM_CRITICAL_INLINE void autortfm_on_commit(void(*work)(void *arg), void *arg)
Definition AutoRTFM.h:359
UE_AUTORTFM_CRITICAL_INLINE void autortfm_unreachable(const char *Message) AUTORTFM_NOEXCEPT
Definition AutoRTFM.h:443
UE_AUTORTFM_CRITICAL_INLINE void autortfm_on_pre_abort(void(*work)(void *arg), void *arg) AUTORTFM_NOEXCEPT
Definition AutoRTFM.h:368
UE_AUTORTFM_CRITICAL_INLINE void autortfm_register_open_to_closed_functions(autortfm_open_to_closed_table *Table) AUTORTFM_NOEXCEPT
Definition AutoRTFM.h:336
UE_AUTORTFM_CRITICAL_INLINE void autortfm_open(void(*work)(void *arg), void *arg, const void *)
Definition AutoRTFM.h:266
autortfm_log_severity
Definition AutoRTFM.h:77
@ autortfm_log_error
Definition AutoRTFM.h:81
@ autortfm_log_verbose
Definition AutoRTFM.h:78
@ autortfm_log_fatal
Definition AutoRTFM.h:82
@ autortfm_log_info
Definition AutoRTFM.h:79
@ autortfm_log_warn
Definition AutoRTFM.h:80
UE_AUTORTFM_CRITICAL_INLINE bool autortfm_is_retrying(void) AUTORTFM_NOEXCEPT
Definition AutoRTFM.h:207
UE_AUTORTFM_CRITICAL_INLINE void autortfm_on_abort(void(*work)(void *arg), void *arg) AUTORTFM_NOEXCEPT
Definition AutoRTFM.h:378
AUTORTFM_RESTORE_UNREACHABLE_CODE_WARNINGS UE_AUTORTFM_CRITICAL_INLINE void autortfm_record_open_write(void *Ptr, size_t Size) AUTORTFM_NOEXCEPT
Definition AutoRTFM.h:293
UE_AUTORTFM_CRITICAL_INLINE void * autortfm_did_allocate(void *ptr, size_t size) AUTORTFM_NOEXCEPT
Definition AutoRTFM.h:405
AUTORTFM_DISABLE_UNREACHABLE_CODE_WARNINGS UE_AUTORTFM_CRITICAL_INLINE autortfm_status autortfm_close(void(*UninstrumentedWork)(void *), void(*InstrumentedWork)(void *), void *Arg)
Definition AutoRTFM.h:279
UE_AUTORTFM_CRITICAL_INLINE void autortfm_pop_on_abort_handler(const void *key) AUTORTFM_NOEXCEPT
Definition AutoRTFM.h:396
UE_AUTORTFM_CRITICAL_INLINE void autortfm_unregister_open_to_closed_functions(autortfm_open_to_closed_table *Table) AUTORTFM_NOEXCEPT
Definition AutoRTFM.h:340
UE_AUTORTFM_CRITICAL_INLINE autortfm_result autortfm_transact(void(*UninstrumentedWork)(void *), void(*InstrumentedWork)(void *), void *Arg) AUTORTFM_EXCEPT
Definition AutoRTFM.h:216
autortfm_status
Definition AutoRTFM.h:62
@ autortfm_status_aborted_by_failed_lock_aquisition
Definition AutoRTFM.h:65
@ autortfm_status_aborted_by_cascading_abort
Definition AutoRTFM.h:69
@ autortfm_status_idle
Definition AutoRTFM.h:63
@ autortfm_status_ontrack
Definition AutoRTFM.h:64
@ autortfm_status_in_static_local_initializer
Definition AutoRTFM.h:71
@ autortfm_status_aborted_by_request
Definition AutoRTFM.h:67
@ autortfm_status_in_post_abort
Definition AutoRTFM.h:72
@ autortfm_status_committing
Definition AutoRTFM.h:68
@ autortfm_status_aborted_by_language
Definition AutoRTFM.h:66
@ autortfm_status_aborted_by_cascading_retry
Definition AutoRTFM.h:70
UE_AUTORTFM_CRITICAL_INLINE bool autortfm_is_committing_or_aborting(void) AUTORTFM_NOEXCEPT
Definition AutoRTFM.h:198
UE_AUTORTFM_CRITICAL_INLINE bool autortfm_is_closed(void) AUTORTFM_NOEXCEPT
Definition AutoRTFM.h:171
UE_AUTORTFM_CRITICAL_INLINE void autortfm_open_explicit_validation(autortfm_memory_validation_level, void(*work)(void *arg), void *arg, const void *)
Definition AutoRTFM.h:272
UE_AUTORTFM_CRITICAL_INLINE autortfm_result autortfm_transact_then_open(void(*UninstrumentedWork)(void *), void(*InstrumentedWork)(void *), void *Arg)
Definition AutoRTFM.h:227
autortfm_result
Definition AutoRTFM.h:51
@ autortfm_aborted_by_request
Definition AutoRTFM.h:52
@ autortfm_aborted_by_transact_during_abort
Definition AutoRTFM.h:56
@ autortfm_committed
Definition AutoRTFM.h:54
@ autortfm_aborted_by_transact_during_commit
Definition AutoRTFM.h:55
@ autortfm_aborted_by_language
Definition AutoRTFM.h:53
@ autortfm_aborted_by_cascade
Definition AutoRTFM.h:57
UE_AUTORTFM_CRITICAL_INLINE bool autortfm_is_on_current_transaction_stack(void *Ptr) AUTORTFM_NOEXCEPT
Definition AutoRTFM.h:349
UE_AUTORTFM_CRITICAL_INLINE bool autortfm_is_committing(void) AUTORTFM_NOEXCEPT
Definition AutoRTFM.h:189
UE_AUTORTFM_CRITICAL_INLINE void autortfm_push_on_abort_handler(const void *key, void(*work)(void *arg), void *arg) AUTORTFM_NOEXCEPT
Definition AutoRTFM.h:389
UE_AUTORTFM_CRITICAL_INLINE void autortfm_initialize(const autortfm_extern_api *ExternAPI) AUTORTFM_NOEXCEPT
Definition AutoRTFM.h:160
return Self
Definition CocoaThread.cpp:337
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
OnComplete(MoveTemp(Response))
const bool
Definition NetworkReplayStreaming.h:178
@ Unreachable
Object is not reachable on the object graph.
uint32 Size
Definition VulkanMemory.cpp:4034
bool CoinTossDisable()
Definition API.cpp:201
void SetInternalAbortAction(EAutoRTFMInternalAbortActionState State)
Definition API.cpp:229
bool GetMemoryValidationThrottlingEnabled()
Definition API.cpp:350
void SetEnsureOnInternalAbort(bool bEnabled)
Definition API.cpp:256
UE_AUTORTFM_ALWAYS_OPEN void DebugBreakIfMemoryValidationFails()
Definition API.cpp:400
EAutoRTFMRetryTransactionState GetRetryTransaction()
Definition API.cpp:281
void SetMemoryValidationStatisticsEnabled(bool bEnabled)
Definition API.cpp:384
void SetRetryTransaction(EAutoRTFMRetryTransactionState State)
Definition API.cpp:265
bool IsAutoRTFMRuntimeEnabledInternal()
Definition API.cpp:163
void SetAutoRTFMEnabledProbability(float Chance)
Definition API.cpp:182
bool GetMemoryValidationStatisticsEnabled()
Definition API.cpp:375
void SetMemoryValidationLevel(EMemoryValidationLevel Level)
Definition API.cpp:330
EMemoryValidationLevel GetMemoryValidationLevel()
Definition API.cpp:321
void SetMemoryValidationThrottlingEnabled(bool bEnabled)
Definition API.cpp:359
bool ShouldRetryNonNestedTransactions()
Definition API.cpp:290
bool SetAutoRTFMRuntime(EAutoRTFMEnabledState State)
Definition API.cpp:85
bool GetEnsureOnInternalAbort()
Definition API.cpp:247
EAutoRTFMInternalAbortActionState GetInternalAbortAction()
Definition API.cpp:238
bool ShouldRetryNestedTransactionsToo()
Definition API.cpp:306
float GetAutoRTFMEnabledProbability()
Definition API.cpp:192
GeometryCollection::Facades::FMuscleActivationData Data
Definition MuscleActivationConstraints.h:15
Type
Definition PawnAction_Move.h:11
@ Committed
Definition MemPro.h:149
FORCEINLINE T * Get(const FObjectPtr &ObjectPtr)
Definition ObjectPtr.h:426
@ deprecated
This class is deprecated and objects of this class won't be saved when serializing....
Definition ObjectMacros.h:847
UE_STRING_CLASS Result(Forward< LhsType >(Lhs), RhsLen)
Definition String.cpp.inl:732
Definition AutoRTFM.h:312
void * Open
Definition AutoRTFM.h:313
void * Closed
Definition AutoRTFM.h:314
Definition AutoRTFM.h:321
const struct autortfm_open_to_closed_mapping * Mappings
Definition AutoRTFM.h:323
struct autortfm_open_to_closed_table * Prev
Definition AutoRTFM.h:326
struct autortfm_open_to_closed_table * Next
Definition AutoRTFM.h:329