misc: chore: Fix object creation in ARMeilleure
This commit is contained in:
@@ -47,8 +47,8 @@ namespace ARMeilleure.Translation
|
||||
{
|
||||
RemoveUnreachableBlocks(Blocks);
|
||||
|
||||
HashSet<BasicBlock> visited = new HashSet<BasicBlock>();
|
||||
Stack<BasicBlock> blockStack = new Stack<BasicBlock>();
|
||||
HashSet<BasicBlock> visited = new();
|
||||
Stack<BasicBlock> blockStack = new();
|
||||
|
||||
Array.Resize(ref _postOrderBlocks, Blocks.Count);
|
||||
Array.Resize(ref _postOrderMap, Blocks.Count);
|
||||
@@ -88,8 +88,8 @@ namespace ARMeilleure.Translation
|
||||
|
||||
private void RemoveUnreachableBlocks(IntrusiveList<BasicBlock> blocks)
|
||||
{
|
||||
HashSet<BasicBlock> visited = new HashSet<BasicBlock>();
|
||||
Queue<BasicBlock> workQueue = new Queue<BasicBlock>();
|
||||
HashSet<BasicBlock> visited = new();
|
||||
Queue<BasicBlock> workQueue = new();
|
||||
|
||||
visited.Add(Entry);
|
||||
workQueue.Enqueue(Entry);
|
||||
|
||||
@@ -750,7 +750,7 @@ namespace ARMeilleure.Translation.PTC
|
||||
UnwindInfo unwindInfo,
|
||||
bool highCq)
|
||||
{
|
||||
CompiledFunction cFunc = new CompiledFunction(code, unwindInfo, RelocInfo.Empty);
|
||||
CompiledFunction cFunc = new(code, unwindInfo, RelocInfo.Empty);
|
||||
GuestFunction gFunc = cFunc.MapWithPointer<GuestFunction>(out nint gFuncPointer);
|
||||
|
||||
return new TranslatedFunction(gFunc, gFuncPointer, callCounter, guestSize, highCq);
|
||||
@@ -945,7 +945,7 @@ namespace ARMeilleure.Translation.PTC
|
||||
WriteCode(code.AsSpan());
|
||||
|
||||
// WriteReloc.
|
||||
using BinaryWriter relocInfoWriter = new BinaryWriter(_relocsStream, EncodingCache.UTF8NoBOM, true);
|
||||
using BinaryWriter relocInfoWriter = new(_relocsStream, EncodingCache.UTF8NoBOM, true);
|
||||
|
||||
foreach (RelocEntry entry in relocInfo.Entries)
|
||||
{
|
||||
@@ -955,7 +955,7 @@ namespace ARMeilleure.Translation.PTC
|
||||
}
|
||||
|
||||
// WriteUnwindInfo.
|
||||
using BinaryWriter unwindInfoWriter = new BinaryWriter(_unwindInfosStream, EncodingCache.UTF8NoBOM, true);
|
||||
using BinaryWriter unwindInfoWriter = new(_unwindInfosStream, EncodingCache.UTF8NoBOM, true);
|
||||
|
||||
unwindInfoWriter.Write(unwindInfo.PushEntries.Length);
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ namespace ARMeilleure.Translation.PTC
|
||||
|
||||
public ConcurrentQueue<(ulong address, FuncProfile funcProfile)> GetProfiledFuncsToTranslate(TranslatorCache<TranslatedFunction> funcs)
|
||||
{
|
||||
ConcurrentQueue<(ulong address, FuncProfile funcProfile)> profiledFuncsToTranslate = new ConcurrentQueue<(ulong address, FuncProfile funcProfile)>();
|
||||
ConcurrentQueue<(ulong address, FuncProfile funcProfile)> profiledFuncsToTranslate = new();
|
||||
|
||||
foreach (KeyValuePair<ulong, FuncProfile> profiledFunc in ProfiledFuncs)
|
||||
{
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace ARMeilleure.Translation
|
||||
// This is required because we have a implicit context load at the start of the function,
|
||||
// but if there is a jump to the start of the function, the context load would trash the modified values.
|
||||
// Here we insert a new entry block that will jump to the existing entry block.
|
||||
BasicBlock newEntry = new BasicBlock(cfg.Blocks.Count);
|
||||
BasicBlock newEntry = new(cfg.Blocks.Count);
|
||||
|
||||
cfg.UpdateEntry(newEntry);
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace ARMeilleure.Translation
|
||||
DefMap[] globalDefs = new DefMap[cfg.Blocks.Count];
|
||||
Operand[] localDefs = new Operand[cfg.LocalsCount + RegisterConsts.TotalCount];
|
||||
|
||||
Queue<BasicBlock> dfPhiBlocks = new Queue<BasicBlock>();
|
||||
Queue<BasicBlock> dfPhiBlocks = new();
|
||||
|
||||
for (BasicBlock block = cfg.Blocks.First; block != null; block = block.ListNext)
|
||||
{
|
||||
|
||||
@@ -222,7 +222,7 @@ namespace ARMeilleure.Translation
|
||||
|
||||
internal TranslatedFunction Translate(ulong address, ExecutionMode mode, bool highCq, bool singleStep = false)
|
||||
{
|
||||
ArmEmitterContext context = new ArmEmitterContext(
|
||||
ArmEmitterContext context = new(
|
||||
Memory,
|
||||
CountTable,
|
||||
FunctionTable,
|
||||
|
||||
@@ -142,7 +142,7 @@ namespace ARMeilleure.Translation
|
||||
/// <returns>Generated <see cref="DispatchStub"/></returns>
|
||||
private nint GenerateDispatchStub()
|
||||
{
|
||||
EmitterContext context = new EmitterContext();
|
||||
EmitterContext context = new();
|
||||
|
||||
Operand lblFallback = Label();
|
||||
Operand lblEnd = Label();
|
||||
@@ -200,7 +200,7 @@ namespace ARMeilleure.Translation
|
||||
/// <returns>Generated <see cref="SlowDispatchStub"/></returns>
|
||||
private nint GenerateSlowDispatchStub()
|
||||
{
|
||||
EmitterContext context = new EmitterContext();
|
||||
EmitterContext context = new();
|
||||
|
||||
// Load the target guest address from the native context.
|
||||
Operand nativeContext = context.LoadArgument(OperandType.I64, 0);
|
||||
@@ -251,7 +251,7 @@ namespace ARMeilleure.Translation
|
||||
/// <returns><see cref="DispatchLoop"/> function</returns>
|
||||
private DispatcherFunction GenerateDispatchLoop()
|
||||
{
|
||||
EmitterContext context = new EmitterContext();
|
||||
EmitterContext context = new();
|
||||
|
||||
Operand beginLbl = Label();
|
||||
Operand endLbl = Label();
|
||||
@@ -292,7 +292,7 @@ namespace ARMeilleure.Translation
|
||||
/// <returns><see cref="ContextWrapper"/> function</returns>
|
||||
private WrapperFunction GenerateContextWrapper()
|
||||
{
|
||||
EmitterContext context = new EmitterContext();
|
||||
EmitterContext context = new();
|
||||
|
||||
Operand nativeContext = context.LoadArgument(OperandType.I64, 0);
|
||||
Operand guestMethod = context.LoadArgument(OperandType.I64, 1);
|
||||
|
||||
Reference in New Issue
Block a user