mirror of
https://github.com/kanjitalk755/macemu.git
synced 2025-01-12 16:30:44 +00:00
Optimize invalidate_cache_range() for short ranges.
This commit is contained in:
parent
ff172bd87d
commit
efa32be9ec
@ -82,7 +82,7 @@ block_cache< block_info, block_allocator >::block_cache()
|
|||||||
}
|
}
|
||||||
|
|
||||||
template< class block_info, template<class T> class block_allocator >
|
template< class block_info, template<class T> class block_allocator >
|
||||||
inline block_cache< block_info, block_allocator >::~block_cache()
|
block_cache< block_info, block_allocator >::~block_cache()
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
@ -117,21 +117,40 @@ void block_cache< block_info, block_allocator >::clear()
|
|||||||
}
|
}
|
||||||
|
|
||||||
template< class block_info, template<class T> class block_allocator >
|
template< class block_info, template<class T> class block_allocator >
|
||||||
inline void block_cache< block_info, block_allocator >::clear_range(uintptr start, uintptr end)
|
void block_cache< block_info, block_allocator >::clear_range(uintptr start, uintptr end)
|
||||||
{
|
{
|
||||||
if (!active)
|
if (!active)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
entry *q;
|
entry *p, *q;
|
||||||
entry *p = active;
|
if (cacheline(start) < cacheline(end - 1)) {
|
||||||
while (p) {
|
// Optimize for short ranges flush
|
||||||
q = p;
|
const int end_cl = cacheline(end - 1);
|
||||||
p = p->next;
|
for (int cl = cacheline(start); cl <= end_cl; cl++) {
|
||||||
if (q->intersect(start, end)) {
|
p = cache_tags[cl];
|
||||||
q->invalidate();
|
while (p) {
|
||||||
remove_from_cl_list(q);
|
q = p;
|
||||||
remove_from_list(q);
|
p = p->next_same_cl;
|
||||||
delete_blockinfo(q);
|
if (q->intersect(start, end)) {
|
||||||
|
q->invalidate();
|
||||||
|
remove_from_cl_list(q);
|
||||||
|
remove_from_list(q);
|
||||||
|
delete_blockinfo(q);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
p = active;
|
||||||
|
while (p) {
|
||||||
|
q = p;
|
||||||
|
p = p->next;
|
||||||
|
if (q->intersect(start, end)) {
|
||||||
|
q->invalidate();
|
||||||
|
remove_from_cl_list(q);
|
||||||
|
remove_from_list(q);
|
||||||
|
delete_blockinfo(q);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -790,7 +790,7 @@ void powerpc_cpu::invalidate_cache()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void powerpc_block_info::invalidate()
|
void powerpc_block_info::invalidate()
|
||||||
{
|
{
|
||||||
#if PPC_DECODE_CACHE
|
#if PPC_DECODE_CACHE
|
||||||
// Don't do anything if this is a predecoded block
|
// Don't do anything if this is a predecoded block
|
||||||
|
Loading…
x
Reference in New Issue
Block a user