Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
BranchLabel.cs
Go to the documentation of this file.
1
using
System.Collections.Generic
;
2
3
namespace
System.Linq.Expressions.Interpreter
;
4
5
internal
sealed
class
BranchLabel
6
{
7
private
int
_targetIndex
=
int
.MinValue;
8
9
private
int
_stackDepth
=
int
.MinValue;
10
11
private
int
_continuationStackDepth
=
int
.MinValue;
12
13
private
List<int>
_forwardBranchFixups
;
14
15
internal
int
LabelIndex
{
get
;
set
; } =
int
.MinValue;
16
17
18
internal
bool
HasRuntimeLabel
=>
LabelIndex
!=
int
.MinValue;
19
20
internal
int
TargetIndex
=>
_targetIndex
;
21
22
internal
RuntimeLabel
ToRuntimeLabel
()
23
{
24
return
new
RuntimeLabel
(
_targetIndex
,
_continuationStackDepth
,
_stackDepth
);
25
}
26
27
internal
void
Mark
(
InstructionList
instructions
)
28
{
29
_stackDepth
=
instructions
.CurrentStackDepth;
30
_continuationStackDepth
=
instructions
.CurrentContinuationsDepth;
31
_targetIndex
=
instructions
.
Count
;
32
if
(
_forwardBranchFixups
==
null
)
33
{
34
return
;
35
}
36
foreach
(
int
forwardBranchFixup
in
_forwardBranchFixups
)
37
{
38
FixupBranch
(
instructions
,
forwardBranchFixup
);
39
}
40
_forwardBranchFixups
=
null
;
41
}
42
43
internal
void
AddBranch
(
InstructionList
instructions
,
int
branchIndex
)
44
{
45
if
(
_targetIndex
==
int
.MinValue)
46
{
47
if
(
_forwardBranchFixups
==
null
)
48
{
49
_forwardBranchFixups
=
new
List<int>
();
50
}
51
_forwardBranchFixups
.
Add
(
branchIndex
);
52
}
53
else
54
{
55
FixupBranch
(
instructions
,
branchIndex
);
56
}
57
}
58
59
internal
void
FixupBranch
(
InstructionList
instructions
,
int
branchIndex
)
60
{
61
instructions
.FixupBranch(
branchIndex
,
_targetIndex
-
branchIndex
);
62
}
63
}
System.Collections.Generic.Dictionary.Count
int Count
Definition
Dictionary.cs:682
System.Collections.Generic.Dictionary
Definition
Dictionary.cs:14
System.Collections.Generic.List.Add
void Add(T item)
Definition
List.cs:236
System.Linq.Expressions.Interpreter.BranchLabel.TargetIndex
int TargetIndex
Definition
BranchLabel.cs:20
System.Linq.Expressions.Interpreter.BranchLabel.ToRuntimeLabel
RuntimeLabel ToRuntimeLabel()
Definition
BranchLabel.cs:22
System.Linq.Expressions.Interpreter.BranchLabel.FixupBranch
void FixupBranch(InstructionList instructions, int branchIndex)
Definition
BranchLabel.cs:59
System.Linq.Expressions.Interpreter.BranchLabel.HasRuntimeLabel
bool HasRuntimeLabel
Definition
BranchLabel.cs:18
System.Linq.Expressions.Interpreter.BranchLabel._targetIndex
int _targetIndex
Definition
BranchLabel.cs:7
System.Linq.Expressions.Interpreter.BranchLabel._stackDepth
int _stackDepth
Definition
BranchLabel.cs:9
System.Linq.Expressions.Interpreter.BranchLabel.LabelIndex
int LabelIndex
Definition
BranchLabel.cs:15
System.Linq.Expressions.Interpreter.BranchLabel.Mark
void Mark(InstructionList instructions)
Definition
BranchLabel.cs:27
System.Linq.Expressions.Interpreter.BranchLabel._forwardBranchFixups
List< int > _forwardBranchFixups
Definition
BranchLabel.cs:13
System.Linq.Expressions.Interpreter.BranchLabel._continuationStackDepth
int _continuationStackDepth
Definition
BranchLabel.cs:11
System.Linq.Expressions.Interpreter.BranchLabel.AddBranch
void AddBranch(InstructionList instructions, int branchIndex)
Definition
BranchLabel.cs:43
System.Linq.Expressions.Interpreter.BranchLabel
Definition
BranchLabel.cs:6
System.Linq.Expressions.Interpreter.InstructionList
Definition
InstructionList.cs:11
System.Collections.Generic
Definition
IHashKeyCollection.cs:1
System.Linq.Expressions.Interpreter
Definition
ActionCallInstruction.cs:3
System.Linq.Expressions.Interpreter.RuntimeLabel
Definition
RuntimeLabel.cs:7
source
System.Linq.Expressions
System.Linq.Expressions.Interpreter
BranchLabel.cs
Generated by
1.10.0