mirror of
https://github.com/momo5502/emulator.git
synced 2026-01-20 04:03:57 +00:00
introducing reflection concept into core components
the idea is to allow as much internal information into inner components. to not burden all builds, the reflection level can be controlled via the MOMO_REFLECTION_LEVEL (where 0 means no reflection code is included). more reflection variables will be introduced as needed. for now, the memory manager's layout version is used to track whether the memory layout is changed or not (at the lowest level). the API consumer can use this to decide to refresh or not expensive computations
This commit is contained in:
@@ -214,6 +214,11 @@ bool memory_manager::protect_memory(const uint64_t address, const size_t size, c
|
||||
}
|
||||
|
||||
merge_regions(committed_regions);
|
||||
|
||||
#if MOMO_REFLECTION_LEVEL > 0
|
||||
inc_memory_layout_state_ver();
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -237,6 +242,10 @@ bool memory_manager::allocate_mmio(const uint64_t address, const size_t size, mm
|
||||
|
||||
entry->second.committed_regions[address] = committed_region{size, memory_permission::read_write};
|
||||
|
||||
#if MOMO_REFLECTION_LEVEL > 0
|
||||
inc_memory_layout_state_ver();
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -261,6 +270,10 @@ bool memory_manager::allocate_memory(const uint64_t address, const size_t size,
|
||||
entry->second.committed_regions[address] = committed_region{size, memory_permission::read_write};
|
||||
}
|
||||
|
||||
#if MOMO_REFLECTION_LEVEL > 0
|
||||
inc_memory_layout_state_ver();
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -320,6 +333,11 @@ bool memory_manager::commit_memory(const uint64_t address, const size_t size, co
|
||||
}
|
||||
|
||||
merge_regions(committed_regions);
|
||||
|
||||
#if MOMO_REFLECTION_LEVEL > 0
|
||||
inc_memory_layout_state_ver();
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -366,6 +384,10 @@ bool memory_manager::decommit_memory(const uint64_t address, const size_t size)
|
||||
++i;
|
||||
}
|
||||
|
||||
#if MOMO_REFLECTION_LEVEL > 0
|
||||
inc_memory_layout_state_ver();
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -418,6 +440,10 @@ bool memory_manager::release_memory(const uint64_t address, size_t size)
|
||||
}
|
||||
|
||||
this->reserved_regions_.erase(entry);
|
||||
|
||||
#if MOMO_REFLECTION_LEVEL > 0
|
||||
inc_memory_layout_state_ver();
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user