Move DwarfCfaInfo::kTable from data.rel.ro to rodata
Pages in .data.rel.ro are always dirty. Move whatever we can to .rodata so that we reduce memory pressure. The size of rodata, text, and data.rel.ro sections of linker64 on cuttlefish before/after this change: rodata: 0x170e4 -> 0x17964 (+2176 bytes) text: 0xec919 -> 0xec919 (no change) data.rel.ro: 0x9cf0 -> 0x98f0 (-1024 bytes) Test: Boot cuttlefish Change-Id: Ib2fd2bb0afb50208d441731d8c31bc8f287272c3
This commit is contained in:
parent
42c9e7e393
commit
80aba5494a
2 changed files with 47 additions and 40 deletions
|
@ -204,7 +204,7 @@ template <typename AddressType>
|
|||
bool DwarfCfa<AddressType>::LogInstruction(uint32_t indent, uint64_t cfa_offset, uint8_t op,
|
||||
uint64_t* cur_pc) {
|
||||
const auto* cfa = &DwarfCfaInfo::kTable[op];
|
||||
if (cfa->name == nullptr) {
|
||||
if (cfa->name[0] == '\0') {
|
||||
log(indent, "Illegal");
|
||||
log(indent, "Raw Data: 0x%02x", op);
|
||||
return true;
|
||||
|
@ -677,29 +677,29 @@ const DwarfCfaInfo::Info DwarfCfaInfo::kTable[64] = {
|
|||
{DW_EH_PE_uleb128, DW_EH_PE_block},
|
||||
{DWARF_DISPLAY_REGISTER, DWARF_DISPLAY_EVAL_BLOCK},
|
||||
},
|
||||
{nullptr, 0, 0, {}, {}}, // 0x17 illegal cfa
|
||||
{nullptr, 0, 0, {}, {}}, // 0x18 illegal cfa
|
||||
{nullptr, 0, 0, {}, {}}, // 0x19 illegal cfa
|
||||
{nullptr, 0, 0, {}, {}}, // 0x1a illegal cfa
|
||||
{nullptr, 0, 0, {}, {}}, // 0x1b illegal cfa
|
||||
{nullptr, 0, 0, {}, {}}, // 0x1c DW_CFA_lo_user (Treat as illegal)
|
||||
{nullptr, 0, 0, {}, {}}, // 0x1d illegal cfa
|
||||
{nullptr, 0, 0, {}, {}}, // 0x1e illegal cfa
|
||||
{nullptr, 0, 0, {}, {}}, // 0x1f illegal cfa
|
||||
{nullptr, 0, 0, {}, {}}, // 0x20 illegal cfa
|
||||
{nullptr, 0, 0, {}, {}}, // 0x21 illegal cfa
|
||||
{nullptr, 0, 0, {}, {}}, // 0x22 illegal cfa
|
||||
{nullptr, 0, 0, {}, {}}, // 0x23 illegal cfa
|
||||
{nullptr, 0, 0, {}, {}}, // 0x24 illegal cfa
|
||||
{nullptr, 0, 0, {}, {}}, // 0x25 illegal cfa
|
||||
{nullptr, 0, 0, {}, {}}, // 0x26 illegal cfa
|
||||
{nullptr, 0, 0, {}, {}}, // 0x27 illegal cfa
|
||||
{nullptr, 0, 0, {}, {}}, // 0x28 illegal cfa
|
||||
{nullptr, 0, 0, {}, {}}, // 0x29 illegal cfa
|
||||
{nullptr, 0, 0, {}, {}}, // 0x2a illegal cfa
|
||||
{nullptr, 0, 0, {}, {}}, // 0x2b illegal cfa
|
||||
{nullptr, 0, 0, {}, {}}, // 0x2c illegal cfa
|
||||
{nullptr, 0, 0, {}, {}}, // 0x2d DW_CFA_GNU_window_save (Treat as illegal)
|
||||
{"", 0, 0, {}, {}}, // 0x17 illegal cfa
|
||||
{"", 0, 0, {}, {}}, // 0x18 illegal cfa
|
||||
{"", 0, 0, {}, {}}, // 0x19 illegal cfa
|
||||
{"", 0, 0, {}, {}}, // 0x1a illegal cfa
|
||||
{"", 0, 0, {}, {}}, // 0x1b illegal cfa
|
||||
{"", 0, 0, {}, {}}, // 0x1c DW_CFA_lo_user (Treat as illegal)
|
||||
{"", 0, 0, {}, {}}, // 0x1d illegal cfa
|
||||
{"", 0, 0, {}, {}}, // 0x1e illegal cfa
|
||||
{"", 0, 0, {}, {}}, // 0x1f illegal cfa
|
||||
{"", 0, 0, {}, {}}, // 0x20 illegal cfa
|
||||
{"", 0, 0, {}, {}}, // 0x21 illegal cfa
|
||||
{"", 0, 0, {}, {}}, // 0x22 illegal cfa
|
||||
{"", 0, 0, {}, {}}, // 0x23 illegal cfa
|
||||
{"", 0, 0, {}, {}}, // 0x24 illegal cfa
|
||||
{"", 0, 0, {}, {}}, // 0x25 illegal cfa
|
||||
{"", 0, 0, {}, {}}, // 0x26 illegal cfa
|
||||
{"", 0, 0, {}, {}}, // 0x27 illegal cfa
|
||||
{"", 0, 0, {}, {}}, // 0x28 illegal cfa
|
||||
{"", 0, 0, {}, {}}, // 0x29 illegal cfa
|
||||
{"", 0, 0, {}, {}}, // 0x2a illegal cfa
|
||||
{"", 0, 0, {}, {}}, // 0x2b illegal cfa
|
||||
{"", 0, 0, {}, {}}, // 0x2c illegal cfa
|
||||
{"", 0, 0, {}, {}}, // 0x2d DW_CFA_GNU_window_save (Treat as illegal)
|
||||
{
|
||||
"DW_CFA_GNU_args_size", // 0x2e DW_CFA_GNU_args_size
|
||||
2,
|
||||
|
@ -714,21 +714,21 @@ const DwarfCfaInfo::Info DwarfCfaInfo::kTable[64] = {
|
|||
{DW_EH_PE_uleb128, DW_EH_PE_uleb128},
|
||||
{DWARF_DISPLAY_REGISTER, DWARF_DISPLAY_NUMBER},
|
||||
},
|
||||
{nullptr, 0, 0, {}, {}}, // 0x31 illegal cfa
|
||||
{nullptr, 0, 0, {}, {}}, // 0x32 illegal cfa
|
||||
{nullptr, 0, 0, {}, {}}, // 0x33 illegal cfa
|
||||
{nullptr, 0, 0, {}, {}}, // 0x34 illegal cfa
|
||||
{nullptr, 0, 0, {}, {}}, // 0x35 illegal cfa
|
||||
{nullptr, 0, 0, {}, {}}, // 0x36 illegal cfa
|
||||
{nullptr, 0, 0, {}, {}}, // 0x37 illegal cfa
|
||||
{nullptr, 0, 0, {}, {}}, // 0x38 illegal cfa
|
||||
{nullptr, 0, 0, {}, {}}, // 0x39 illegal cfa
|
||||
{nullptr, 0, 0, {}, {}}, // 0x3a illegal cfa
|
||||
{nullptr, 0, 0, {}, {}}, // 0x3b illegal cfa
|
||||
{nullptr, 0, 0, {}, {}}, // 0x3c illegal cfa
|
||||
{nullptr, 0, 0, {}, {}}, // 0x3d illegal cfa
|
||||
{nullptr, 0, 0, {}, {}}, // 0x3e illegal cfa
|
||||
{nullptr, 0, 0, {}, {}}, // 0x3f DW_CFA_hi_user (Treat as illegal)
|
||||
{"", 0, 0, {}, {}}, // 0x31 illegal cfa
|
||||
{"", 0, 0, {}, {}}, // 0x32 illegal cfa
|
||||
{"", 0, 0, {}, {}}, // 0x33 illegal cfa
|
||||
{"", 0, 0, {}, {}}, // 0x34 illegal cfa
|
||||
{"", 0, 0, {}, {}}, // 0x35 illegal cfa
|
||||
{"", 0, 0, {}, {}}, // 0x36 illegal cfa
|
||||
{"", 0, 0, {}, {}}, // 0x37 illegal cfa
|
||||
{"", 0, 0, {}, {}}, // 0x38 illegal cfa
|
||||
{"", 0, 0, {}, {}}, // 0x39 illegal cfa
|
||||
{"", 0, 0, {}, {}}, // 0x3a illegal cfa
|
||||
{"", 0, 0, {}, {}}, // 0x3b illegal cfa
|
||||
{"", 0, 0, {}, {}}, // 0x3c illegal cfa
|
||||
{"", 0, 0, {}, {}}, // 0x3d illegal cfa
|
||||
{"", 0, 0, {}, {}}, // 0x3e illegal cfa
|
||||
{"", 0, 0, {}, {}}, // 0x3f DW_CFA_hi_user (Treat as illegal)
|
||||
};
|
||||
|
||||
// Explicitly instantiate DwarfCfa.
|
||||
|
|
|
@ -49,7 +49,14 @@ class DwarfCfaInfo {
|
|||
};
|
||||
|
||||
struct Info {
|
||||
const char* name;
|
||||
// It may seem cleaner to just change the type of 'name' to 'const char *'.
|
||||
// However, having a pointer here would require relocation at runtime,
|
||||
// causing 'kTable' to be placed in data.rel.ro section instead of rodata
|
||||
// section, adding memory pressure to the system. Note that this is only
|
||||
// safe because this is only used in C++ code. C++ standard, unlike C
|
||||
// standard, mandates the array size to be large enough to hold the NULL
|
||||
// terminator when initialized with a string literal.
|
||||
const char name[36];
|
||||
uint8_t supported_version;
|
||||
uint8_t num_operands;
|
||||
uint8_t operands[2];
|
||||
|
|
Loading…
Reference in a new issue