memory: add early bail out from cpu_physical_memory_set_dirty_range

This condition is true in the common case, so we can cut out the body of
the function. In addition, this makes it easier for the compiler to do
at least partial inlining, even if it decides that fully inlining the
function is unreasonable.

Backports commit 8bafcb21643a39a5b29109f8bd5ee5a6f0f6850b from qemu
This commit is contained in:
Paolo Bonzini 2018-02-20 08:31:58 -05:00 committed by Lioncash
parent a268815478
commit cbc56b3ceb
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -108,6 +108,10 @@ static inline void cpu_physical_memory_set_dirty_range(struct uc_struct *uc, ram
unsigned long end, page;
unsigned long **d = uc->ram_list.dirty_memory;
if (!mask && !xen_enabled()) {
return;
}
end = TARGET_PAGE_ALIGN(start + length) >> TARGET_PAGE_BITS;
page = start >> TARGET_PAGE_BITS;
if (unlikely(mask & (1 << DIRTY_MEMORY_CODE))) {