LightningJit: Add a limit on the number of instructions per function for Arm64 (#6328)
This commit is contained in:
parent
103e7cb021
commit
42340fc743
1 changed files with 5 additions and 3 deletions
|
@ -8,7 +8,7 @@ namespace Ryujinx.Cpu.LightningJit.Arm64.Target.Arm64
|
||||||
{
|
{
|
||||||
static class Decoder
|
static class Decoder
|
||||||
{
|
{
|
||||||
private const int MaxInstructionsPerBlock = 1000;
|
private const int MaxInstructionsPerFunction = 10000;
|
||||||
|
|
||||||
private const uint NzcvFlags = 0xfu << 28;
|
private const uint NzcvFlags = 0xfu << 28;
|
||||||
private const uint CFlag = 0x1u << 29;
|
private const uint CFlag = 0x1u << 29;
|
||||||
|
@ -22,10 +22,11 @@ namespace Ryujinx.Cpu.LightningJit.Arm64.Target.Arm64
|
||||||
|
|
||||||
bool hasHostCall = false;
|
bool hasHostCall = false;
|
||||||
bool hasMemoryInstruction = false;
|
bool hasMemoryInstruction = false;
|
||||||
|
int totalInsts = 0;
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
Block block = Decode(cpuPreset, memoryManager, address, ref useMask, ref hasHostCall, ref hasMemoryInstruction);
|
Block block = Decode(cpuPreset, memoryManager, address, ref totalInsts, ref useMask, ref hasHostCall, ref hasMemoryInstruction);
|
||||||
|
|
||||||
if (!block.IsTruncated && TryGetBranchTarget(block, out ulong targetAddress))
|
if (!block.IsTruncated && TryGetBranchTarget(block, out ulong targetAddress))
|
||||||
{
|
{
|
||||||
|
@ -230,6 +231,7 @@ namespace Ryujinx.Cpu.LightningJit.Arm64.Target.Arm64
|
||||||
CpuPreset cpuPreset,
|
CpuPreset cpuPreset,
|
||||||
IMemoryManager memoryManager,
|
IMemoryManager memoryManager,
|
||||||
ulong address,
|
ulong address,
|
||||||
|
ref int totalInsts,
|
||||||
ref RegisterMask useMask,
|
ref RegisterMask useMask,
|
||||||
ref bool hasHostCall,
|
ref bool hasHostCall,
|
||||||
ref bool hasMemoryInstruction)
|
ref bool hasMemoryInstruction)
|
||||||
|
@ -272,7 +274,7 @@ namespace Ryujinx.Cpu.LightningJit.Arm64.Target.Arm64
|
||||||
|
|
||||||
uint tempGprUseMask = gprUseMask | instGprReadMask | instGprWriteMask;
|
uint tempGprUseMask = gprUseMask | instGprReadMask | instGprWriteMask;
|
||||||
|
|
||||||
if (CalculateAvailableTemps(tempGprUseMask) < CalculateRequiredGprTemps(tempGprUseMask) || insts.Count >= MaxInstructionsPerBlock)
|
if (CalculateAvailableTemps(tempGprUseMask) < CalculateRequiredGprTemps(tempGprUseMask) || totalInsts++ >= MaxInstructionsPerFunction)
|
||||||
{
|
{
|
||||||
isTruncated = true;
|
isTruncated = true;
|
||||||
address -= 4UL;
|
address -= 4UL;
|
||||||
|
|
Reference in a new issue