Move PPUProgramCompiler to vector

This commit is contained in:
Lioncash 2014-04-02 07:59:20 -04:00
parent c294f5318f
commit b3e0441940
2 changed files with 132 additions and 129 deletions

View file

@ -59,7 +59,7 @@ s64 FindOp(const std::string& text, const std::string& op, s64 from)
return -1; return -1;
} }
ArrayF<SectionInfo> sections_list; std::vector<SectionInfo*> sections_list;
u32 section_name_offs = 0; u32 section_name_offs = 0;
u32 section_offs = 0; u32 section_offs = 0;
@ -68,7 +68,8 @@ SectionInfo::SectionInfo(const std::string& _name)
name = _name; name = _name;
memset(&shdr, 0, sizeof(Elf64_Shdr)); memset(&shdr, 0, sizeof(Elf64_Shdr));
section_num = sections_list.Add(this); sections_list.push_back(this);
section_num = sections_list.size() - 1;
shdr.sh_offset = section_offs; shdr.sh_offset = section_offs;
shdr.sh_name = section_name_offs; shdr.sh_name = section_name_offs;
@ -81,37 +82,37 @@ void SectionInfo::SetDataSize(u32 size, u32 align)
if(align) shdr.sh_addralign = align; if(align) shdr.sh_addralign = align;
if(shdr.sh_addralign) size = Memory.AlignAddr(size, shdr.sh_addralign); if(shdr.sh_addralign) size = Memory.AlignAddr(size, shdr.sh_addralign);
if(code.GetCount()) if(!code.empty())
{ {
for(u32 i=section_num + 1; i<sections_list.GetCount(); ++i) for(u32 i=section_num + 1; i<sections_list.size(); ++i)
{ {
sections_list[i].shdr.sh_offset -= code.GetCount(); sections_list[i]->shdr.sh_offset -= code.size();
} }
section_offs -= code.GetCount(); section_offs -= code.size();
} }
code.SetCount(size); code.resize(size);
section_offs += size; section_offs += size;
for(u32 i=section_num + 1; i<sections_list.GetCount(); ++i) for(u32 i=section_num + 1; i<sections_list.size(); ++i)
{ {
sections_list[i].shdr.sh_offset += size; sections_list[i]->shdr.sh_offset += size;
} }
} }
SectionInfo::~SectionInfo() SectionInfo::~SectionInfo()
{ {
sections_list.RemoveFAt(section_num); sections_list.erase(sections_list.begin() + section_num);
for(u32 i=section_num + 1; i<sections_list.GetCount(); ++i) for(u32 i=section_num + 1; i<sections_list.size(); ++i)
{ {
sections_list[i].shdr.sh_offset -= code.GetCount(); sections_list[i]->shdr.sh_offset -= code.size();
sections_list[i].shdr.sh_name -= name.length(); sections_list[i]->shdr.sh_name -= name.length();
} }
section_offs -= code.GetCount(); section_offs -= code.size();
section_name_offs -= name.length(); section_name_offs -= name.length();
} }
@ -371,9 +372,9 @@ void CompilePPUProgram::DetectArgInfo(Arg& arg)
if(str.length() > 1) if(str.length() > 1)
{ {
for(u32 i=0; i<m_branches.GetCount(); ++i) for(const Branch& branch : m_branches)
{ {
if(str != m_branches[i].m_name) if(str != branch.m_name)
continue; continue;
arg.type = ARG_BRANCH; arg.type = ARG_BRANCH;
@ -515,30 +516,33 @@ void CompilePPUProgram::DetectArgInfo(Arg& arg)
void CompilePPUProgram::LoadArgs() void CompilePPUProgram::LoadArgs()
{ {
m_args.Clear(); m_args.clear();
m_cur_arg = 0; m_cur_arg = 0;
std::string str; std::string str;
while(int r = GetArg(str)) while(int r = GetArg(str))
{ {
Arg* arg = new Arg(str); m_args.emplace_back(str);
DetectArgInfo(*arg); DetectArgInfo(m_args[m_args.size() -1]);
m_args.Add(arg);
if(r == -1) break; if(r == -1)
break;
} }
m_end_args = m_args.GetCount() > 0; m_end_args = m_args.size() > 0;
} }
u32 CompilePPUProgram::GetBranchValue(const std::string& branch) u32 CompilePPUProgram::GetBranchValue(const std::string& branch_name)
{ {
for(u32 i=0; i<m_branches.GetCount(); ++i) for(const Branch& branch : m_branches)
{ {
if(branch != m_branches[i].m_name) if(branch_name != branch.m_name)
continue; continue;
if(m_branches[i].m_pos >= 0) return m_text_addr + m_branches[i].m_pos * 4;
return m_branches[i].m_addr; if(branch.m_pos >= 0)
return m_text_addr + branch.m_pos * 4;
return branch.m_addr;
} }
return 0; return 0;
@ -548,7 +552,7 @@ bool CompilePPUProgram::SetNextArgType(u32 types, bool show_err)
{ {
if(m_error) return false; if(m_error) return false;
if(m_cur_arg >= m_args.GetCount()) if(m_cur_arg >= m_args.size())
{ {
if(show_err) if(show_err)
{ {
@ -581,7 +585,7 @@ bool CompilePPUProgram::SetNextArgBranch(u8 aa, bool show_err)
const u32 pos = m_cur_arg; const u32 pos = m_cur_arg;
const bool ret = SetNextArgType(ARG_BRANCH | ARG_IMM, show_err); const bool ret = SetNextArgType(ARG_BRANCH | ARG_IMM, show_err);
if(!aa && pos < m_args.GetCount()) if(!aa && pos < m_args.size())
{ {
switch(m_args[pos].type) switch(m_args[pos].type)
{ {
@ -665,11 +669,12 @@ bool CompilePPUProgram::IsSpOp(const std::string& op)
CompilePPUProgram::Branch& CompilePPUProgram::GetBranch(const std::string& name) CompilePPUProgram::Branch& CompilePPUProgram::GetBranch(const std::string& name)
{ {
for(u32 i=0; i<m_branches.GetCount(); ++i) for(Branch& branch : m_branches)
{ {
if(name != m_branches[i].m_name) continue; if(name != branch.m_name)
continue;
return m_branches[i]; return branch;
} }
return m_branches[0]; return m_branches[0];
@ -679,17 +684,18 @@ void CompilePPUProgram::SetSp(const std::string& name, u32 addr, bool create)
{ {
if(create) if(create)
{ {
m_branches.Move(new Branch(name, -1, addr)); m_branches.emplace_back(name, -1, addr);
return; return;
} }
GetBranch(name); GetBranch(name);
for(u32 i=0; i<m_branches.GetCount(); ++i) for(Branch& branch : m_branches)
{ {
if(name != m_branches[i].m_name) if(name != branch.m_name)
continue; continue;
m_branches[i].m_addr = addr;
branch.m_addr = addr;
} }
} }
@ -736,8 +742,8 @@ void CompilePPUProgram::LoadSp(const std::string& op, Elf64_Shdr& s_opd)
case ARG_ERR: case ARG_ERR:
{ {
m_branches.Move(new Branch("", -1, 0)); //TODO: allocated with new, deleted with free() m_branches.emplace_back("", -1, 0);
dst_branch = &m_branches[m_branches.GetCount() - 1]; dst_branch = &m_branches[m_branches.size() - 1];
} }
break; break;
} }
@ -805,17 +811,19 @@ void CompilePPUProgram::LoadSp(const std::string& op, Elf64_Shdr& s_opd)
src1 = src1.substr(1, src1.length()-2); src1 = src1.substr(1, src1.length()-2);
bool founded = false; bool founded = false;
for(u32 i=0; i<m_sp_string.GetCount(); ++i) for(const SpData& sp_str : m_sp_string)
{ {
if(src1 != m_sp_string[i].m_data) continue; if(src1 != sp_str.m_data)
*dst_branch = Branch(dst, -1, m_sp_string[i].m_addr); continue;
*dst_branch = Branch(dst, -1, sp_str.m_addr);
founded = true; founded = true;
} }
if(!founded) if(!founded)
{ {
const u32 addr = s_opd.sh_addr + s_opd.sh_size; const u32 addr = s_opd.sh_addr + s_opd.sh_size;
m_sp_string.Move(new SpData(src1, addr)); //TODO: new and free mixed m_sp_string.emplace_back(src1, addr);
s_opd.sh_size += src1.length() + 1; s_opd.sh_size += src1.length() + 1;
*dst_branch = Branch(dst, -1, addr); *dst_branch = Branch(dst, -1, addr);
} }
@ -827,11 +835,11 @@ void CompilePPUProgram::LoadSp(const std::string& op, Elf64_Shdr& s_opd)
case ARG_TXT: *dst_branch = Branch(dst, -1, src1.length() - 2); break; case ARG_TXT: *dst_branch = Branch(dst, -1, src1.length() - 2); break;
case ARG_BRANCH: case ARG_BRANCH:
{ {
for(u32 i=0; i<m_sp_string.GetCount(); ++i) for(const SpData& sp_str : m_sp_string)
{ {
if(m_sp_string[i].m_addr == a_src1.value) if(sp_str.m_addr == a_src1.value)
{ {
*dst_branch = Branch(dst, -1, m_sp_string[i].m_data.length()); *dst_branch = Branch(dst, -1, sp_str.m_data.length());
break; break;
} }
} }
@ -957,14 +965,8 @@ void CompilePPUProgram::Compile()
m_hex_list->Clear(); m_hex_list->Clear();
} }
m_code.Clear(); m_code.clear();
m_branches.clear();
for(u32 i=0; i<m_branches.GetCount(); ++i)
{
m_branches[i].m_name.clear();
}
m_branches.Clear();
u32 text_size = 0; u32 text_size = 0;
while(!IsEnd()) while(!IsEnd())
@ -1015,7 +1017,7 @@ void CompilePPUProgram::Compile()
struct Module struct Module
{ {
std::string m_name; std::string m_name;
Array<u32> m_imports; std::vector<u32> m_imports;
Module(const std::string& name, u32 import) : m_name(name) Module(const std::string& name, u32 import) : m_name(name)
{ {
@ -1024,17 +1026,17 @@ void CompilePPUProgram::Compile()
void Add(u32 import) void Add(u32 import)
{ {
m_imports.AddCpy(import); m_imports.push_back(import);
} }
void Clear() void Clear()
{ {
m_name.clear(); m_name.clear();
m_imports.Clear(); m_imports.clear();
} }
}; };
Array<Module> modules; std::vector<Module> modules;
FirstChar(); FirstChar();
while(!IsEnd()) while(!IsEnd())
@ -1049,9 +1051,9 @@ void CompilePPUProgram::Compile()
while(p > 0 && m_asm[(size_t)p] != '[') p--; while(p > 0 && m_asm[(size_t)p] != '[') p--;
p++; p++;
std::string module, name, id; std::string module_name, name, id;
if(!GetArg(module)) if(!GetArg(module_name))
{ {
WriteError("module not found. style: [module, name, id]"); WriteError("module not found. style: [module, name, id]");
m_error = true; m_error = true;
@ -1059,7 +1061,7 @@ void CompilePPUProgram::Compile()
continue; continue;
} }
Arg a_module(module); Arg a_module(module_name);
DetectArgInfo(a_module); DetectArgInfo(a_module);
if(~ARG_ERR & a_module.type) if(~ARG_ERR & a_module.type)
@ -1118,26 +1120,28 @@ void CompilePPUProgram::Compile()
if(!CheckEnd()) continue; if(!CheckEnd()) continue;
m_branches.Move(new Branch(name, a_id.value, 0)); //TODO: HACK: new and free() mixed m_branches.emplace_back(name, a_id.value, 0);
const u32 import = m_branches.GetCount() - 1; const u32 import = m_branches.size() - 1;
bool founded = false; bool founded = false;
for(u32 i=0; i<modules.GetCount(); ++i) for(Module& module : modules)
{ {
if(modules[i].m_name.compare(module) != 0) continue; if(module.m_name != module_name)
continue;
founded = true; founded = true;
modules[i].Add(import); module.Add(import);
break; break;
} }
if(!founded) modules.Move(new Module(module, import)); if(!founded) modules.emplace_back(module_name, import);
} }
u32 imports_count = 0; u32 imports_count = 0;
for(u32 m=0; m < modules.GetCount(); ++m) for(const Module& module : modules)
{ {
imports_count += modules[m].m_imports.GetCount(); imports_count += module.m_imports.size();
} }
Elf64_Shdr s_sceStub_text; Elf64_Shdr s_sceStub_text;
@ -1154,11 +1158,13 @@ void CompilePPUProgram::Compile()
section_name_offset += std::string(".sceStub.text").length() + 1; section_name_offset += std::string(".sceStub.text").length() + 1;
section_offset += s_sceStub_text.sh_size; section_offset += s_sceStub_text.sh_size;
for(u32 m=0, pos=0; m<modules.GetCount(); ++m) for(const Module& module : modules)
{ {
for(u32 i=0; i<modules[m].m_imports.GetCount(); ++i, ++pos) u32 pos = 0;
for(const u32& import : module.m_imports)
{ {
m_branches[modules[m].m_imports[i]].m_addr = s_sceStub_text.sh_addr + sceStub_text_block * pos; m_branches[import].m_addr = s_sceStub_text.sh_addr + sceStub_text_block * pos;
++pos;
} }
} }
@ -1184,7 +1190,7 @@ void CompilePPUProgram::Compile()
s_lib_stub.sh_offset = section_offset; s_lib_stub.sh_offset = section_offset;
s_lib_stub.sh_addr = section_offset + 0x10000; s_lib_stub.sh_addr = section_offset + 0x10000;
s_lib_stub.sh_flags = 2; s_lib_stub.sh_flags = 2;
s_lib_stub.sh_size = sizeof(Elf64_StubHeader) * modules.GetCount(); s_lib_stub.sh_size = sizeof(Elf64_StubHeader) * modules.size();
sections_names.push_back(".lib.stub"); sections_names.push_back(".lib.stub");
section_name_offset += std::string(".lib.stub").length() + 1; section_name_offset += std::string(".lib.stub").length() + 1;
section_offset += s_lib_stub.sh_size; section_offset += s_lib_stub.sh_size;
@ -1226,9 +1232,9 @@ void CompilePPUProgram::Compile()
s_rodata_sceResident.sh_addr = section_offset + 0x10000; s_rodata_sceResident.sh_addr = section_offset + 0x10000;
s_rodata_sceResident.sh_flags = 2; s_rodata_sceResident.sh_flags = 2;
s_rodata_sceResident.sh_size = 4; s_rodata_sceResident.sh_size = 4;
for(u32 i=0; i<modules.GetCount(); ++i) for(const Module& module : modules)
{ {
s_rodata_sceResident.sh_size += modules[i].m_name.length() + 1; s_rodata_sceResident.sh_size += module.m_name.length() + 1;
} }
s_rodata_sceResident.sh_size = Memory.AlignAddr(s_rodata_sceResident.sh_size, s_rodata_sceResident.sh_addralign); s_rodata_sceResident.sh_size = Memory.AlignAddr(s_rodata_sceResident.sh_size, s_rodata_sceResident.sh_addralign);
sections_names.push_back(".rodata.sceResident"); sections_names.push_back(".rodata.sceResident");
@ -1337,9 +1343,11 @@ void CompilePPUProgram::Compile()
{ {
const std::string& name = op.substr(0, op.length() - 1); const std::string& name = op.substr(0, op.length() - 1);
for(u32 i=0; i<m_branches.GetCount(); ++i) for(const Branch& branch : m_branches)
{ {
if(name != m_branches[i].m_name) continue; if(name != branch.m_name)
continue;
WriteError(fmt::Format("'%s' already declared", name.c_str())); WriteError(fmt::Format("'%s' already declared", name.c_str()));
m_error = true; m_error = true;
break; break;
@ -1356,7 +1364,7 @@ void CompilePPUProgram::Compile()
if(m_error) break; if(m_error) break;
m_branches.Move(new Branch(name, m_branch_pos)); //TODO: HACK: free() and new mixed m_branches.emplace_back(name, m_branch_pos);
CheckEnd(); CheckEnd();
continue; continue;
@ -1367,23 +1375,23 @@ void CompilePPUProgram::Compile()
} }
bool has_entry = false; bool has_entry = false;
for(u32 i=0; i<m_branches.GetCount(); ++i) for(const Branch& branch : m_branches)
{ {
if(m_branches[i].m_name != "entry") if(branch.m_name != "entry")
continue; continue;
has_entry = true; has_entry = true;
break; break;
} }
if(!has_entry) m_branches.Move(new Branch("entry", 0)); //TODO: HACK: new and free() mixed if(!has_entry) m_branches.emplace_back("entry", 0);
if(m_analyze) m_error = false; if(m_analyze) m_error = false;
FirstChar(); FirstChar();
while(!IsEnd()) while(!IsEnd())
{ {
m_args.Clear(); m_args.clear();
m_end_args = false; m_end_args = false;
std::string op; std::string op;
@ -1453,7 +1461,7 @@ void CompilePPUProgram::Compile()
{ {
Array<u32> args; Array<u32> args;
args.SetCount(m_args.GetCount()); args.SetCount(m_args.size());
for(uint i=0; i<args.GetCount(); ++i) for(uint i=0; i<args.GetCount(); ++i)
{ {
args[i] = m_args[i].value; args[i] = m_args[i].value;
@ -1464,7 +1472,7 @@ void CompilePPUProgram::Compile()
if(m_analyze) WriteHex(fmt::Format("0x%08x\n", code)); if(m_analyze) WriteHex(fmt::Format("0x%08x\n", code));
if(!m_analyze) m_code.AddCpy(code); if(!m_analyze) m_code.push_back(code);
m_branch_pos++; m_branch_pos++;
} }
@ -1505,11 +1513,11 @@ void CompilePPUProgram::Compile()
u8* opd_data = new u8[s_opd.sh_size]; u8* opd_data = new u8[s_opd.sh_size];
u32 entry_point = s_text.sh_addr; u32 entry_point = s_text.sh_addr;
for(u32 i=0; i<m_branches.GetCount(); ++i) for(const Branch& branch : m_branches)
{ {
if(m_branches[i].m_name == "entry") if(branch.m_name == "entry")
{ {
entry_point += m_branches[i].m_pos * 4; entry_point += branch.m_pos * 4;
break; break;
} }
} }
@ -1551,11 +1559,14 @@ void CompilePPUProgram::Compile()
WriteShdr(f, s_shstrtab); WriteShdr(f, s_shstrtab);
f.Seek(s_text.sh_offset); f.Seek(s_text.sh_offset);
for(u32 i=0; i<m_code.GetCount(); ++i) Write32(f, m_code[i]); for(const u32& code : m_code)
{
Write32(f, code);
}
f.Seek(s_opd.sh_offset); f.Seek(s_opd.sh_offset);
f.Write(opd_data, 8); f.Write(opd_data, 8);
for(u32 i=0; i<m_sp_string.GetCount(); ++i) for(u32 i=0; i<m_sp_string.size(); ++i)
{ {
f.Seek(s_opd.sh_offset + (m_sp_string[i].m_addr - s_opd.sh_addr)); f.Seek(s_opd.sh_offset + (m_sp_string[i].m_addr - s_opd.sh_addr));
f.Write(&m_sp_string[i].m_data[0], m_sp_string[i].m_data.length() + 1); f.Write(&m_sp_string[i].m_data[0], m_sp_string[i].m_data.length() + 1);
@ -1579,7 +1590,7 @@ void CompilePPUProgram::Compile()
f.Seek(s_lib_stub_top.sh_size, wxFromCurrent); f.Seek(s_lib_stub_top.sh_size, wxFromCurrent);
f.Seek(s_lib_stub.sh_offset); f.Seek(s_lib_stub.sh_offset);
for(u32 i=0, nameoffs=4, dataoffs=0; i<modules.GetCount(); ++i) for(u32 i=0, nameoffs=4, dataoffs=0; i<modules.size(); ++i)
{ {
Elf64_StubHeader stub; Elf64_StubHeader stub;
memset(&stub, 0, sizeof(Elf64_StubHeader)); memset(&stub, 0, sizeof(Elf64_StubHeader));
@ -1590,9 +1601,9 @@ void CompilePPUProgram::Compile()
stub.s_modulename = re32(s_rodata_sceResident.sh_addr + nameoffs); stub.s_modulename = re32(s_rodata_sceResident.sh_addr + nameoffs);
stub.s_nid = re32(s_rodata_sceFNID.sh_addr + dataoffs); stub.s_nid = re32(s_rodata_sceFNID.sh_addr + dataoffs);
stub.s_text = re32(s_data_sceFStub.sh_addr + dataoffs); stub.s_text = re32(s_data_sceFStub.sh_addr + dataoffs);
stub.s_imports = re16(modules[i].m_imports.GetCount()); stub.s_imports = re16(modules[i].m_imports.size());
dataoffs += modules[i].m_imports.GetCount() * 4; dataoffs += modules[i].m_imports.size() * 4;
f.Write(&stub, sizeof(Elf64_StubHeader)); f.Write(&stub, sizeof(Elf64_StubHeader));
nameoffs += modules[i].m_name.length() + 1; nameoffs += modules[i].m_name.length() + 1;
@ -1602,25 +1613,25 @@ void CompilePPUProgram::Compile()
f.Seek(s_lib_stub_btm.sh_size, wxFromCurrent); f.Seek(s_lib_stub_btm.sh_size, wxFromCurrent);
f.Seek(s_data_sceFStub.sh_offset); f.Seek(s_data_sceFStub.sh_offset);
for(u32 m=0; m<modules.GetCount(); ++m) for(const Module& module : modules)
{ {
for(u32 i=0; i<modules[m].m_imports.GetCount(); ++i) for(const u32& import : module.m_imports)
{ {
Write32(f, m_branches[modules[m].m_imports[i]].m_addr); Write32(f, m_branches[import].m_addr);
} }
} }
f.Seek(s_rodata_sceFNID.sh_offset); f.Seek(s_rodata_sceFNID.sh_offset);
for(u32 m=0; m<modules.GetCount(); ++m) for(const Module& module : modules)
{ {
for(u32 i=0; i<modules[m].m_imports.GetCount(); ++i) for(const u32& import : module.m_imports)
{ {
Write32(f, m_branches[modules[m].m_imports[i]].m_id); Write32(f, m_branches[import].m_id);
} }
} }
f.Seek(s_rodata_sceResident.sh_offset + 4); f.Seek(s_rodata_sceResident.sh_offset + 4);
for(u32 i=0; i<modules.GetCount(); ++i) for(u32 i=0; i<modules.size(); ++i)
{ {
f.Write(&modules[i].m_name[0], modules[i].m_name.length() + 1); f.Write(&modules[i].m_name[0], modules[i].m_name.length() + 1);
} }
@ -1702,21 +1713,13 @@ void CompilePPUProgram::Compile()
sections_names.clear(); sections_names.clear();
delete[] opd_data; delete[] opd_data;
for(u32 i=0; i<modules.GetCount(); ++i) modules[i].Clear(); modules.clear();
modules.Clear();
} }
for(u32 i=0; i<m_branches.GetCount(); ++i) m_branches.clear();
{ m_code.clear();
m_branches[i].m_name.clear(); m_args.clear();
} m_sp_string.clear();
m_branches.Clear();
m_code.Clear();
m_args.Clear();
m_sp_string.Clear();
if(m_err_list) m_err_list->Thaw(); if(m_err_list) m_err_list->Thaw();

View file

@ -1,20 +1,21 @@
#pragma once #pragma once
#include <vector>
#include "PPUInstrTable.h" #include "PPUInstrTable.h"
#include "Loader/ELF64.h" #include "Loader/ELF64.h"
enum ArgType enum ArgType
{ {
ARG_ERR = 0, ARG_ERR = 0,
ARG_NUM = 1 << 0, ARG_NUM = 1 << 0,
ARG_NUM16 = 1 << 1, ARG_NUM16 = 1 << 1,
ARG_TXT = 1 << 2, ARG_TXT = 1 << 2,
ARG_REG_R = 1 << 3, ARG_REG_R = 1 << 3,
ARG_REG_F = 1 << 4, ARG_REG_F = 1 << 4,
ARG_REG_V = 1 << 5, ARG_REG_V = 1 << 5,
ARG_REG_CR = 1 << 6, ARG_REG_CR = 1 << 6,
ARG_BRANCH = 1 << 7, ARG_BRANCH = 1 << 7,
ARG_INSTR = 1 << 8, ARG_INSTR = 1 << 8,
ARG_IMM = ARG_NUM | ARG_NUM16 | ARG_BRANCH, ARG_IMM = ARG_NUM | ARG_NUM16 | ARG_BRANCH,
}; };
struct Arg struct Arg
@ -35,7 +36,7 @@ struct SectionInfo
{ {
Elf64_Shdr shdr; Elf64_Shdr shdr;
std::string name; std::string name;
Array<u8> code; std::vector<u8> code;
u32 section_num; u32 section_num;
SectionInfo(const std::string& name); SectionInfo(const std::string& name);
@ -46,14 +47,13 @@ struct SectionInfo
struct ProgramInfo struct ProgramInfo
{ {
Array<u8> code; std::vector<u8> code;
Elf64_Phdr phdr; Elf64_Phdr phdr;
bool is_preload; bool is_preload;
ProgramInfo() ProgramInfo()
{ {
is_preload = false; is_preload = false;
code.Clear();
memset(&phdr, 0, sizeof(Elf64_Phdr)); memset(&phdr, 0, sizeof(Elf64_Phdr));
} }
}; };
@ -92,9 +92,9 @@ class CompilePPUProgram
wxTextCtrl* m_hex_list; wxTextCtrl* m_hex_list;
wxTextCtrl* m_err_list; wxTextCtrl* m_err_list;
bool m_error; bool m_error;
Array<u32> m_code; std::vector<u32> m_code;
bool m_end_args; bool m_end_args;
Array<Branch> m_branches; std::vector<Branch> m_branches;
s32 m_branch_pos; s32 m_branch_pos;
u32 m_text_addr; u32 m_text_addr;
std::string m_file_path; std::string m_file_path;
@ -111,8 +111,8 @@ class CompilePPUProgram
} }
}; };
Array<SpData> m_sp_string; std::vector<SpData> m_sp_string;
Array<Arg> m_args; std::vector<Arg> m_args;
u32 m_cur_arg; u32 m_cur_arg;
public: public: