forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGcTransition.cs
More file actions
96 lines (83 loc) · 2.95 KB
/
Copy pathGcTransition.cs
File metadata and controls
96 lines (83 loc) · 2.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection.PortableExecutable;
using System.Text;
namespace ILCompiler.Reflection.ReadyToRun.Amd64
{
public struct InterruptibleRange
{
public uint Index { get; set; }
public uint StartOffset { get; set; }
public uint StopOffset { get; set; }
public InterruptibleRange(uint index, uint start, uint stop)
{
Index = index;
Debug.Assert(start <= stop);
StartOffset = start;
StopOffset = stop;
}
}
public class GcTransition : BaseGcTransition
{
public int SlotId { get; set; }
public bool IsLive { get; set; }
public int ChunkId { get; set; }
public string SlotState { get; set; }
public GcTransition() { }
public GcTransition(int codeOffset, int slotId, bool isLive, int chunkId, GcSlotTable slotTable, Machine machine)
{
CodeOffset = codeOffset;
SlotId = slotId;
IsLive = isLive;
ChunkId = chunkId;
SlotState = GetSlotState(slotTable, machine);
}
public override string ToString()
{
return SlotState;
}
public string GetSlotState(GcSlotTable slotTable, Machine machine)
{
GcSlotTable.GcSlot slot = slotTable.GcSlots[SlotId];
string slotStr = "";
if (slot.StackSlot == null)
{
Type regType;
switch (machine)
{
case Machine.ArmThumb2:
regType = typeof(Arm.Registers);
break;
case Machine.Arm64:
regType = typeof(Arm64.Registers);
break;
case Machine.Amd64:
regType = typeof(Amd64.Registers);
break;
case Machine.LoongArch64:
regType = typeof(LoongArch64.Registers);
break;
case Machine.RiscV64:
regType = typeof(RiscV64.Registers);
break;
case WasmMachine.Wasm32:
throw new NotImplementedException($"No implementation for machine type Wasm32.");
default:
throw new NotImplementedException();
}
slotStr = Enum.GetName(regType, slot.RegisterNumber);
}
else
{
slotStr = $"sp{slot.StackSlot.SpOffset:+#;-#;+0}";
}
string isLiveStr = "live";
if (!IsLive)
isLiveStr = "dead";
return $"{slotStr} is {isLiveStr}";
}
}
}