mirror of
https://github.com/kanjitalk755/macemu.git
synced 2025-03-03 20:30:11 +00:00
Implement lazy icache range invalidation. Disable for now until it shows
a real benefit over only 2%
This commit is contained in:
parent
1af0362296
commit
45df157a5e
@ -81,7 +81,7 @@ using std::string;
|
||||
#include "sigsegv.h"
|
||||
|
||||
#if USE_JIT
|
||||
extern void (*flush_icache)(int); // from compemu_support.cpp
|
||||
extern void flush_icache_range(uint32 start, uint32 size); // from compemu_support.cpp
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_MON
|
||||
@ -773,7 +773,7 @@ void FlushCodeCache(void *start, uint32 size)
|
||||
{
|
||||
#if USE_JIT
|
||||
if (UseJIT)
|
||||
flush_icache(-1);
|
||||
flush_icache_range((uintptr)start, size);
|
||||
#endif
|
||||
#if !EMULATED_68K && defined(__NetBSD__)
|
||||
m68k_sync_icache(start, size);
|
||||
|
@ -80,6 +80,9 @@ union cacheline {
|
||||
#define USE_CHECKSUM_INFO 1
|
||||
#endif
|
||||
|
||||
/* Does flush_icache_range() only check for blocks falling in the requested range? */
|
||||
#define LAZY_FLUSH_ICACHE_RANGE 0
|
||||
|
||||
#define USE_F_ALIAS 1
|
||||
#define USE_OFFSET 1
|
||||
#define COMP_DEBUG 1
|
||||
|
@ -122,7 +122,7 @@ static bool JITDebug = false; // Enable runtime disassemblers through mon?
|
||||
const bool JITDebug = false; // Don't use JIT debug mode at all
|
||||
#endif
|
||||
|
||||
const uae_u32 MIN_CACHE_SIZE = 2048; // Minimal translation cache size (2048 KB)
|
||||
const uae_u32 MIN_CACHE_SIZE = 1024; // Minimal translation cache size (1 MB)
|
||||
static uae_u32 cache_size = 0; // Size of total cache allocated for compiled blocks
|
||||
static uae_u32 current_cache_size = 0; // Cache grows upwards: how much has been consumed already
|
||||
static bool lazy_flush = true; // Flag: lazy translation cache invalidation
|
||||
@ -6299,6 +6299,39 @@ static inline void flush_icache_lazy(int n)
|
||||
active=NULL;
|
||||
}
|
||||
|
||||
void flush_icache_range(uae_u32 start, uae_u32 length)
|
||||
{
|
||||
if (!active)
|
||||
return;
|
||||
|
||||
#if LAZY_FLUSH_ICACHE_RANGE
|
||||
uae_u8 *start_p = get_real_address(start);
|
||||
blockinfo *bi = active;
|
||||
while (bi) {
|
||||
#if USE_CHECKSUM_INFO
|
||||
bool invalidate = false;
|
||||
for (checksum_info *csi = bi->csi; csi && !invalidate; csi = csi->next)
|
||||
invalidate = (((start_p - csi->start_p) < csi->length) ||
|
||||
((csi->start_p - start_p) < length));
|
||||
#else
|
||||
// Assume system is consistent and would invalidate the right range
|
||||
const bool invalidate = (bi->pc_p - start_p) < length;
|
||||
#endif
|
||||
if (invalidate) {
|
||||
uae_u32 cl = cacheline(bi->pc_p);
|
||||
if (bi == cache_tags[cl + 1].bi)
|
||||
cache_tags[cl].handler = (cpuop_func *)popall_execute_normal;
|
||||
bi->handler_to_use = (cpuop_func *)popall_execute_normal;
|
||||
set_dhtu(bi, bi->direct_pen);
|
||||
bi->status = BI_NEED_RECOMP;
|
||||
}
|
||||
bi = bi->next;
|
||||
}
|
||||
return;
|
||||
#endif
|
||||
flush_icache(-1);
|
||||
}
|
||||
|
||||
static void catastrophe(void)
|
||||
{
|
||||
abort();
|
||||
|
Loading…
x
Reference in New Issue
Block a user