UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
VVMReturnSlot.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
10
11namespace Verse
12{
13struct VFrame;
14
15struct VReturnSlot
16{
17 enum class EReturnKind : uint8
18 {
20 Value,
21 };
22
23 template <typename ReturnSlotType>
24 VReturnSlot(FAllocationContext Context, ReturnSlotType ReturnSlot)
25 {
27 }
28
29 VValue Get(FAllocationContext Context)
30 {
31 if (Kind == EReturnKind::RestValue)
32 {
33 if (RestValue)
34 {
35 return RestValue->Get(Context);
36 }
37 else
38 {
39 return VValue();
40 }
41 }
42 else
43 {
44 return Value.Get();
45 }
46 }
47
48 void Set(FAllocationContext Context, VRestValue* InRestValue)
49 {
51 Kind = EReturnKind::RestValue;
52 }
53
54 void SetTransactionally(FAllocationContext Context, VRestValue* InRestValue)
55 {
56 AutoRTFM::RecordOpenWrite(&RestValue);
58 AutoRTFM::RecordOpenWrite(&Kind);
59 Kind = EReturnKind::RestValue;
60 }
61
62 void Set(FAllocationContext Context, VValue InValue)
63 {
64 Value.Set(Context, InValue);
65 Kind = EReturnKind::Value;
66 }
67
68 void SetTransactionally(FAllocationContext Context, VValue InValue)
69 {
70 Value.SetTransactionally(Context, InValue);
71 AutoRTFM::RecordOpenWrite(&Kind);
72 Kind = EReturnKind::Value;
73 }
74
75 void Reset()
76 {
77 EffectToken.Reset(0);
78 Kind = EReturnKind::RestValue;
79 RestValue = nullptr;
80 }
81
82 template <typename TVisitor>
83 friend void Visit(TVisitor& Visitor, VReturnSlot& Value)
84 {
85 Visitor.Visit(Value.EffectToken, TEXT("ReturnEffectToken"));
86 if (Value.Kind == EReturnKind::Value)
87 {
88 Visitor.Visit(Value.Value, TEXT("ReturnSlot"));
89 }
90 }
91
92 friend class FInterpreter;
93 friend struct VFrame;
94
95private:
97 union
98 {
99 // This points into Frame or the C++ stack, so we don't need to tell GC about it.
102 };
103 EReturnKind Kind;
104};
105} // namespace Verse
106
107#endif
#define TEXT(x)
Definition Platform.h:1272
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
uint8_t uint8
Definition binka_ue_file_header.h:8
@ Visitor
Definition XmppMultiUserChat.h:94
FORCEINLINE T * Get(const FObjectPtr &ObjectPtr)
Definition ObjectPtr.h:426
Definition Archive.h:36