mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Reduce disassembler memory usage
This commit is contained in:
parent
274632f304
commit
33da416a82
2 changed files with 19 additions and 8 deletions
|
@ -416,6 +416,15 @@ void DisassemblyFunction::generateBranchLines()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DisassemblyFunction::addOpcodeSequence(u32 start, u32 end)
|
||||||
|
{
|
||||||
|
DisassemblyOpcode* opcode = new DisassemblyOpcode(start,(end-start)/4);
|
||||||
|
entries[start] = opcode;
|
||||||
|
for (u32 pos = start; pos < end; pos += 4)
|
||||||
|
{
|
||||||
|
lineAddresses.push_back(pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DisassemblyFunction::load()
|
void DisassemblyFunction::load()
|
||||||
{
|
{
|
||||||
|
@ -440,6 +449,7 @@ void DisassemblyFunction::load()
|
||||||
u32 funcPos = address;
|
u32 funcPos = address;
|
||||||
u32 funcEnd = address+size;
|
u32 funcEnd = address+size;
|
||||||
|
|
||||||
|
u32 opcodeSequenceStart = funcPos;
|
||||||
while (funcPos < funcEnd)
|
while (funcPos < funcEnd)
|
||||||
{
|
{
|
||||||
MIPSAnalyst::MipsOpcodeInfo opInfo = MIPSAnalyst::GetOpcodeInfo(cpu,funcPos);
|
MIPSAnalyst::MipsOpcodeInfo opInfo = MIPSAnalyst::GetOpcodeInfo(cpu,funcPos);
|
||||||
|
@ -449,11 +459,6 @@ void DisassemblyFunction::load()
|
||||||
// skip branches and their delay slots
|
// skip branches and their delay slots
|
||||||
if (opInfo.isBranch)
|
if (opInfo.isBranch)
|
||||||
{
|
{
|
||||||
DisassemblyOpcode* opcode = new DisassemblyOpcode(opAddress,2);
|
|
||||||
entries[opAddress] = opcode;
|
|
||||||
lineAddresses.push_back(opAddress);
|
|
||||||
lineAddresses.push_back(opAddress+4);
|
|
||||||
|
|
||||||
funcPos += 4;
|
funcPos += 4;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -517,21 +522,26 @@ void DisassemblyFunction::load()
|
||||||
|
|
||||||
if (macro != NULL)
|
if (macro != NULL)
|
||||||
{
|
{
|
||||||
|
if (opcodeSequenceStart != opAddress)
|
||||||
|
addOpcodeSequence(opcodeSequenceStart,opAddress);
|
||||||
|
|
||||||
entries[opAddress] = macro;
|
entries[opAddress] = macro;
|
||||||
for (int i = 0; i < macro->getNumLines(); i++)
|
for (int i = 0; i < macro->getNumLines(); i++)
|
||||||
{
|
{
|
||||||
lineAddresses.push_back(macro->getLineAddress(i));
|
lineAddresses.push_back(macro->getLineAddress(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
opcodeSequenceStart = funcPos;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// just a normal opcode
|
// just a normal opcode
|
||||||
DisassemblyOpcode* opcode = new DisassemblyOpcode(opAddress,1);
|
|
||||||
entries[opAddress] = opcode;
|
|
||||||
lineAddresses.push_back(opAddress);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (opcodeSequenceStart != funcPos)
|
||||||
|
addOpcodeSequence(opcodeSequenceStart,funcPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisassemblyFunction::clear()
|
void DisassemblyFunction::clear()
|
||||||
|
|
|
@ -74,6 +74,7 @@ private:
|
||||||
void generateBranchLines();
|
void generateBranchLines();
|
||||||
void load();
|
void load();
|
||||||
void clear();
|
void clear();
|
||||||
|
void addOpcodeSequence(u32 start, u32 end);
|
||||||
|
|
||||||
u32 address;
|
u32 address;
|
||||||
u32 size;
|
u32 size;
|
||||||
|
|
Loading…
Add table
Reference in a new issue