UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
VVMStrongCellRegistry.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#if WITH_VERSE_VM || defined(__INTELLISENSE__)
6
8#include "Containers/Map.h"
9#include "CoreTypes.h"
10#include "VVMCell.h"
11#include "VVMGlobalHeapRoot.h"
12
13namespace Verse
14{
15
16// A global registry that prevents cells from getting GC'ed
18{
20
21 // Adds a VCell reference to the set and returns reference count for the VCell after adding
23 {
25
26 // We are the mutator thread so we can read the map without locking
29 {
30 // We can also mutate the counter without lock because GC does not look at that
31 return ++*ExistingRefCounter;
32 }
33
34 AddInternal(Context, Cell);
35 return 1;
36 }
37
38 // Removes a VCell reference from the set and returns reference count for the VCell after removing
40 {
41 // We are the mutator thread so we can read the map without locking
43 V_DIE_UNLESS(ExistingId.IsValidId());
45 // We can also mutate the counter without lock because GC does not look at that
46 uint32 NewRefCount = --Entry.Value;
47 if (NewRefCount == 0)
48 {
50 }
51 return NewRefCount;
52 }
53
54private:
55 void Visit(FMarkStackVisitor& Visitor) override;
56 void Visit(FAbstractVisitor& Visitor) override;
57
58 template <class VisitorType>
59 void VisitImpl(VisitorType& Visitor);
60
63
66};
67
68} // namespace Verse
69#endif // WITH_VERSE_VM
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
decltype(auto) Visit(Func &&Callable, Variants &&... Args)
Definition TVariant.h:271
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition SetUtilities.h:95
Definition UnrealString.h.inl:34
Definition Mutex.h:18
UE::FRecursiveMutex Mutex
Definition MeshPaintVirtualTexture.cpp:164
void RemoveInternal(const uint32 Index, const uint32 Key, IndexType *HashData, const uint32 HashCount, IndexType *NextIndexData, const uint32 NextIndexCount)
Definition CompactHashTable.h:35
decltype(auto) VisitImpl(SIZE_T EncodedIndex, Func &&Callable, TIntegerSequence< SIZE_T, EncodedIndices... > &&, TIntegerSequence< SIZE_T, VariantIndices... > &&VariantIndicesSeq, Variants &&... Args)
Definition TVariantMeta.h:377
Definition Archive.h:36
Definition Tuple.h:652