From 0f1457559271bb7b823c20d49b029a1856729c52 Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Sun, 3 May 2015 22:53:03 -0700 Subject: [PATCH] Shrinking debug info. --- src/xenia/cpu/backend/x64/x64_assembler.cc | 4 ++-- src/xenia/cpu/backend/x64/x64_emitter.cc | 2 +- src/xenia/cpu/debug_info.cc | 4 ++-- src/xenia/cpu/debug_info.h | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/xenia/cpu/backend/x64/x64_assembler.cc b/src/xenia/cpu/backend/x64/x64_assembler.cc index 28e9fa019..831fa9d1c 100644 --- a/src/xenia/cpu/backend/x64/x64_assembler.cc +++ b/src/xenia/cpu/backend/x64/x64_assembler.cc @@ -104,8 +104,8 @@ void X64Assembler::DumpMachineCode(DebugInfo* debug_info, void* machine_code, uint64_t prev_source_offset = 0; while (disasm.EIP < eip_end) { // Look up source offset. - auto map_entry = - debug_info->LookupCodeOffset(disasm.EIP - (BE::UIntPtr)machine_code); + auto map_entry = debug_info->LookupCodeOffset( + static_cast(disasm.EIP - (BE::UIntPtr)machine_code)); if (map_entry) { if (map_entry->source_offset == prev_source_offset) { str->Append(" "); diff --git a/src/xenia/cpu/backend/x64/x64_emitter.cc b/src/xenia/cpu/backend/x64/x64_emitter.cc index f71654f23..5207cddc8 100644 --- a/src/xenia/cpu/backend/x64/x64_emitter.cc +++ b/src/xenia/cpu/backend/x64/x64_emitter.cc @@ -211,7 +211,7 @@ void X64Emitter::MarkSourceOffset(const Instr* i) { auto entry = source_map_arena_.Alloc(); entry->source_offset = static_cast(i->src1.offset); entry->hir_offset = uint32_t(i->block->ordinal << 16) | i->ordinal; - entry->code_offset = getSize(); + entry->code_offset = static_cast(getSize()); source_map_count_++; } diff --git a/src/xenia/cpu/debug_info.cc b/src/xenia/cpu/debug_info.cc index a0a540a4f..8df03b4c9 100644 --- a/src/xenia/cpu/debug_info.cc +++ b/src/xenia/cpu/debug_info.cc @@ -49,7 +49,7 @@ SourceMapEntry* DebugInfo::LookupSourceOffset(uint32_t offset) { return nullptr; } -SourceMapEntry* DebugInfo::LookupHIROffset(uint64_t offset) { +SourceMapEntry* DebugInfo::LookupHIROffset(uint32_t offset) { // TODO(benvanik): binary search? We know the list is sorted by code order. for (size_t n = 0; n < source_map_count_; n++) { auto entry = &source_map_[n]; @@ -60,7 +60,7 @@ SourceMapEntry* DebugInfo::LookupHIROffset(uint64_t offset) { return nullptr; } -SourceMapEntry* DebugInfo::LookupCodeOffset(uint64_t offset) { +SourceMapEntry* DebugInfo::LookupCodeOffset(uint32_t offset) { // TODO(benvanik): binary search? We know the list is sorted by code order. for (int64_t n = source_map_count_ - 1; n >= 0; n--) { auto entry = &source_map_[n]; diff --git a/src/xenia/cpu/debug_info.h b/src/xenia/cpu/debug_info.h index f75265540..d6b129e6c 100644 --- a/src/xenia/cpu/debug_info.h +++ b/src/xenia/cpu/debug_info.h @@ -29,8 +29,8 @@ enum DebugInfoFlags { typedef struct SourceMapEntry_s { uint32_t source_offset; // Original source address/offset. - uint64_t hir_offset; // Block ordinal (16b) | Instr ordinal (16b) - uint64_t code_offset; // Offset from emitted code start. + uint32_t hir_offset; // Block ordinal (16b) | Instr ordinal (16b) + uint32_t code_offset; // Offset from emitted code start. } SourceMapEntry; class DebugInfo { @@ -49,8 +49,8 @@ class DebugInfo { void InitializeSourceMap(size_t source_map_count, SourceMapEntry* source_map); SourceMapEntry* LookupSourceOffset(uint32_t offset); - SourceMapEntry* LookupHIROffset(uint64_t offset); - SourceMapEntry* LookupCodeOffset(uint64_t offset); + SourceMapEntry* LookupHIROffset(uint32_t offset); + SourceMapEntry* LookupCodeOffset(uint32_t offset); private: char* source_disasm_;