mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-09-07 04:33:24 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2411bf060b |
+17
-16
@@ -17,25 +17,26 @@ namespace Core {
|
||||
namespace Symbols {
|
||||
|
||||
struct ModuleHeaderLocation {
|
||||
u32 version;
|
||||
u32 header_offset;
|
||||
u32 version_offset;
|
||||
u32_le version;
|
||||
u32_le header_offset;
|
||||
u32_le version_offset;
|
||||
};
|
||||
static_assert(sizeof(ModuleHeaderLocation) == 0x0C);
|
||||
struct ModuleHeader {
|
||||
u32 signature;
|
||||
u32 dynamic_offset;
|
||||
u32 bss_start_offset;
|
||||
u32 bss_end_offset;
|
||||
u32 exception_info_start_offset;
|
||||
u32 exception_info_end_offset;
|
||||
u32 module_offset;
|
||||
u32 relro_start_offset;
|
||||
u32 full_relro_end_offset;
|
||||
u32 nx_debug_link_start_offset;
|
||||
u32 nx_debug_link_end_offset;
|
||||
u32 note_gnu_build_id_start_offset;
|
||||
u32 note_gnu_build_id_end_offset;
|
||||
u32_le signature;
|
||||
u32_le dynamic_offset;
|
||||
u32_le bss_start_offset;
|
||||
u32_le bss_end_offset;
|
||||
// https://github.com/Atmosphere-NX/Atmosphere/pull/2835/changes
|
||||
s32_le exception_info_start_offset;
|
||||
s32_le exception_info_end_offset;
|
||||
u32_le module_offset;
|
||||
u32_le relro_start_offset;
|
||||
u32_le full_relro_end_offset;
|
||||
u32_le nx_debug_link_start_offset;
|
||||
u32_le nx_debug_link_end_offset;
|
||||
u32_le note_gnu_build_id_start_offset;
|
||||
u32_le note_gnu_build_id_end_offset;
|
||||
};
|
||||
static_assert(sizeof(ModuleHeader) == 0x34);
|
||||
|
||||
|
||||
@@ -63,8 +63,9 @@ struct ModHeader {
|
||||
u32_le dynamic_offset;
|
||||
u32_le bss_start_offset;
|
||||
u32_le bss_end_offset;
|
||||
u32_le unwind_start_offset;
|
||||
u32_le unwind_end_offset;
|
||||
// https://github.com/Atmosphere-NX/Atmosphere/pull/2835/changes
|
||||
s32_le unwind_start_offset;
|
||||
s32_le unwind_end_offset;
|
||||
u32_le module_offset; // Offset to runtime-generated module object. typically equal to .bss base
|
||||
};
|
||||
static_assert(sizeof(ModHeader) == 0x1c, "ModHeader has incorrect size.");
|
||||
|
||||
@@ -35,8 +35,9 @@ struct MODHeader {
|
||||
u32_le dynamic_offset;
|
||||
u32_le bss_start_offset;
|
||||
u32_le bss_end_offset;
|
||||
u32_le eh_frame_hdr_start_offset;
|
||||
u32_le eh_frame_hdr_end_offset;
|
||||
// https://github.com/Atmosphere-NX/Atmosphere/pull/2835/changes
|
||||
s32_le eh_frame_hdr_start_offset;
|
||||
s32_le eh_frame_hdr_end_offset;
|
||||
u32_le module_offset; // Offset to runtime-generated module object. typically equal to .bss base
|
||||
};
|
||||
static_assert(sizeof(MODHeader) == 0x1c, "MODHeader has incorrect size.");
|
||||
|
||||
@@ -39,8 +39,16 @@ Block::iterator Block::PrependNewInst(iterator insertion_point, Opcode opcode, s
|
||||
// just pool it!!! - reason why there is an inline buffer is because many small blocks are created
|
||||
// with few instructions due to subpar optimisations on other passes... plus branch-heavy code will
|
||||
// hugely benefit from the coherency of faster allocations...
|
||||
inlined_inst.emplace_back(opcode);
|
||||
auto* inst = &inlined_inst[inlined_inst.size() - 1];
|
||||
IR::Inst* inst;
|
||||
if (inlined_inst.size() < inlined_inst.max_size()) {
|
||||
inlined_inst.emplace_back(opcode);
|
||||
inst = &inlined_inst[inlined_inst.size() - 1];
|
||||
} else {
|
||||
if (pooled_inst.empty() || pooled_inst.back().size() == pooled_inst.back().max_size())
|
||||
pooled_inst.emplace_back();
|
||||
pooled_inst.back().emplace_back(opcode);
|
||||
inst = &pooled_inst.back()[pooled_inst.back().size() - 1];
|
||||
}
|
||||
DEBUG_ASSERT(args.size() == inst->NumArgs());
|
||||
std::for_each(args.begin(), args.end(), [&inst, index = size_t(0)](const auto& arg) mutable {
|
||||
inst->SetArg(index, arg);
|
||||
@@ -53,6 +61,7 @@ void Block::Reset(LocationDescriptor location_) noexcept {
|
||||
mcl::intrusive_list<IR::Inst> tmp = {};
|
||||
instructions.swap(tmp);
|
||||
inlined_inst.clear();
|
||||
pooled_inst.clear();
|
||||
cond_failed.reset();
|
||||
location = location_;
|
||||
end_location = location_;
|
||||
|
||||
@@ -142,9 +142,11 @@ public:
|
||||
}
|
||||
|
||||
/// "Hot cache" for small blocks so we don't call global allocator
|
||||
boost::container::static_vector<Inst, 4096> inlined_inst = {};
|
||||
boost::container::static_vector<Inst, 30> inlined_inst;
|
||||
/// List of instructions in this block.
|
||||
instruction_list_type instructions;
|
||||
/// "Long/far" memory pool
|
||||
boost::container::stable_vector<boost::container::static_vector<Inst, 32>> pooled_inst;
|
||||
/// Block to execute next if `cond` did not pass.
|
||||
std::optional<LocationDescriptor> cond_failed = {};
|
||||
/// Description of the starting location of this block
|
||||
@@ -160,7 +162,7 @@ public:
|
||||
/// Number of cycles this block takes to execute.
|
||||
size_t cycle_count = 0;
|
||||
};
|
||||
//static_assert(sizeof(Block) == 4096);
|
||||
static_assert(sizeof(Block) == 4096);
|
||||
|
||||
/// Returns a string representation of the contents of block. Intended for debugging.
|
||||
std::string DumpBlock(const IR::Block& block) noexcept;
|
||||
|
||||
Reference in New Issue
Block a user