mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2025-08-08 18:52:34 -07:00
Add PPTC support
This commit is contained in:
@@ -141,7 +141,7 @@ namespace ARMeilleure.Translation
|
||||
if (Ptc.State == PtcState.Enabled)
|
||||
{
|
||||
Debug.Assert(_funcs.Count == 0);
|
||||
Ptc.LoadTranslations(_funcs, _memory, _jumpTable);
|
||||
Ptc.LoadTranslations(_funcs, _memory, _jumpTable, CountTable);
|
||||
Ptc.MakeAndSaveTranslations(_funcs, _memory, _jumpTable, CountTable);
|
||||
}
|
||||
|
||||
@@ -256,9 +256,11 @@ namespace ARMeilleure.Translation
|
||||
|
||||
Logger.StartPass(PassName.Translation);
|
||||
|
||||
Counter counter = null;
|
||||
|
||||
if (!context.HighCq)
|
||||
{
|
||||
EmitRejitCheck(context);
|
||||
EmitRejitCheck(context, out counter);
|
||||
}
|
||||
|
||||
EmitSynchronization(context);
|
||||
@@ -303,7 +305,7 @@ namespace ARMeilleure.Translation
|
||||
Ptc.WriteInfoCodeRelocUnwindInfo(address, funcSize, highCq, ptcInfo);
|
||||
}
|
||||
|
||||
return new TranslatedFunction(func, funcSize, highCq);
|
||||
return new TranslatedFunction(func, counter, funcSize, highCq);
|
||||
}
|
||||
|
||||
internal static void PreparePool(int groupId = 0)
|
||||
@@ -413,9 +415,9 @@ namespace ARMeilleure.Translation
|
||||
return context.GetControlFlowGraph();
|
||||
}
|
||||
|
||||
internal static void EmitRejitCheck(ArmEmitterContext context)
|
||||
internal static void EmitRejitCheck(ArmEmitterContext context, out Counter counter)
|
||||
{
|
||||
if (!context.CountTable.TryAllocate(out int index))
|
||||
if (!Counter.TryCreate(context.CountTable, out counter))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -424,8 +426,7 @@ namespace ARMeilleure.Translation
|
||||
Operand lblAdd = Label();
|
||||
Operand lblEnd = Label();
|
||||
|
||||
// TODO: PPTC.
|
||||
Operand address = Const(ref context.CountTable.GetValue(index));
|
||||
Operand address = Const(ref counter.Value, Ptc.CountTableIndex);
|
||||
Operand count = context.Load8(address);
|
||||
context.BranchIf(lblAdd, count, Const(100), Comparison.LessUI);
|
||||
context.BranchIf(lblRejit, count, Const(100), Comparison.Equal);
|
||||
@@ -511,9 +512,9 @@ namespace ARMeilleure.Translation
|
||||
{
|
||||
while (_backgroundStack.TryPop(out var request))
|
||||
{
|
||||
if (_funcs.TryGetValue(request.Address, out var func))
|
||||
if (_funcs.TryGetValue(request.Address, out var func) && func.CallCounter != null)
|
||||
{
|
||||
func.ResetCallCount();
|
||||
Volatile.Write(ref func.CallCounter.Value, 0);
|
||||
}
|
||||
|
||||
_backgroundSet.TryRemove(request.Address, out _);
|
||||
|
Reference in New Issue
Block a user