UDocumentation
UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
VVMWeakKeyMap.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
7
#include "Containers/Map.h"
8
9
namespace
Verse
10
{
11
12
struct
FMarkStack
;
13
struct
VCell
;
14
15
// This is a collection of "transposed" weak maps.
16
//
17
// A transposed weak map maps maps to values. I.e. while a weak map is a Key -> Value map, a transposed weak map
18
// is a Map -> Value map.
19
//
20
// A weak key map is a collection of transposed weak maps keyed by key. I.e. a weak key map is a Key -> Map -> Value
21
// map.
22
//
23
// For every weak map entry in the world of the form Key -> Value where Map is the owning map (the one that would do
24
// the logic in VisitReferences that says "if Key is marked then mark Value"), there must be a weak key map entry
25
// of the form Key -> Map -> Value. This ensures that if Key is not yet marked before the Map runs its
26
// VisitReferences, then the weak key map that owns the Key will do the marking by running "if Map is marked then
27
// mark Value" logic.
28
//
29
// You could imagine there being one FWeakKeyMap globally for the whole GC. That would work. But we hang FWeakKeyMap
30
// off libpas's verse_heap_page_header (aka Verse::FHeapPageHeader). There is one of those per "page" for objects
31
// in segregated storage, and one globally for all large objects. Libpas manages the synchronization that protects
32
// these maps.
33
//
34
// Most of this is "owned" by VCell. VCell accesses this via FWeakKeyMapGuard.
35
struct
FWeakKeyMap
final
36
{
37
FWeakKeyMap
();
38
~FWeakKeyMap
();
39
40
bool
IsEmpty
()
const
41
{
42
return
InternalMap
.IsEmpty();
43
}
44
45
// This is just to support testing.
46
bool
HasEntriesForKey
(
VCell
* Key)
const
;
47
48
void
Add
(
VCell
* Key,
VCell
*
Map
,
VCell
*
Value
);
49
void
Remove
(
VCell
* Key,
VCell
*
Map
);
50
51
template
<
typename
TVisitor>
52
void
Visit
(
VCell
* Key,
TVisitor
& Visitor);
53
54
void
ConductCensus
();
55
56
size_t
GetAllocatedSize
()
const
57
{
58
return
InternalMap
.GetAllocatedSize();
59
}
60
61
private
:
62
TMap<VCell*, TMap<VCell*, VCell*>
>
InternalMap
;
63
};
64
65
}
// namespace Verse
66
#endif
// WITH_VERSE_VM
EModifyCurveApplyMode::Add
@ Add
ECborCode::Map
@ Map
StaticCastSharedRef
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition
SharedPointer.h:127
EUniqueIdEncodingFlags::IsEmpty
@ IsEmpty
EOverriddenPropertyOperation::Remove
@ Remove
EColorPickerChannels::Value
@ Value
Visit
decltype(auto) Visit(Func &&Callable, Variants &&... Args)
Definition
TVariant.h:271
TMap
Definition
UnrealString.h.inl:34
ManagedArrayTypeSize::GetAllocatedSize
SIZE_T GetAllocatedSize(const T &Value)
Definition
ManagedArray.h:93
Verse
Definition
Archive.h:36
Engine
Source
Runtime
CoreUObject
Public
VerseVM
VVMWeakKeyMap.h
Generated by
1.9.8