mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
memory: inline some performance-sensitive accessors
These accessors are called from inlined functions, and the call sequence is much more expensive than just inlining the access. Move the struct declaration to memory-internal.h so that exec.c and memory.c can both use an inline function. Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
80d2b933f9
commit
785a507ec7
3 changed files with 30 additions and 35 deletions
|
@ -21,7 +21,15 @@
|
|||
#define MEMORY_INTERNAL_H
|
||||
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
typedef struct AddressSpaceDispatch AddressSpaceDispatch;
|
||||
static inline AddressSpaceDispatch *flatview_to_dispatch(FlatView *fv)
|
||||
{
|
||||
return fv->dispatch;
|
||||
}
|
||||
|
||||
static inline AddressSpaceDispatch *address_space_to_dispatch(AddressSpace *as)
|
||||
{
|
||||
return flatview_to_dispatch(address_space_to_flatview(as));
|
||||
}
|
||||
|
||||
extern const MemoryRegionOps unassigned_mem_ops;
|
||||
|
||||
|
@ -31,9 +39,6 @@ bool memory_region_access_valid(MemoryRegion *mr, hwaddr addr,
|
|||
void flatview_add_to_dispatch(FlatView *fv, MemoryRegionSection *section);
|
||||
AddressSpaceDispatch *address_space_dispatch_new(FlatView *fv);
|
||||
void address_space_dispatch_compact(AddressSpaceDispatch *d);
|
||||
|
||||
AddressSpaceDispatch *address_space_to_dispatch(AddressSpace *as);
|
||||
AddressSpaceDispatch *flatview_to_dispatch(FlatView *fv);
|
||||
void address_space_dispatch_free(AddressSpaceDispatch *d);
|
||||
|
||||
void mtree_print_dispatch(fprintf_function mon, void *f,
|
||||
|
|
|
@ -326,7 +326,27 @@ struct AddressSpace {
|
|||
QTAILQ_ENTRY(AddressSpace) address_spaces_link;
|
||||
};
|
||||
|
||||
FlatView *address_space_to_flatview(AddressSpace *as);
|
||||
typedef struct AddressSpaceDispatch AddressSpaceDispatch;
|
||||
typedef struct FlatRange FlatRange;
|
||||
|
||||
/* Flattened global view of current active memory hierarchy. Kept in sorted
|
||||
* order.
|
||||
*/
|
||||
struct FlatView {
|
||||
struct rcu_head rcu;
|
||||
unsigned ref;
|
||||
FlatRange *ranges;
|
||||
unsigned nr;
|
||||
unsigned nr_allocated;
|
||||
struct AddressSpaceDispatch *dispatch;
|
||||
MemoryRegion *root;
|
||||
};
|
||||
|
||||
static inline FlatView *address_space_to_flatview(AddressSpace *as)
|
||||
{
|
||||
return atomic_rcu_read(&as->current_map);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* MemoryRegionSection: describes a fragment of a #MemoryRegion
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue