changeset 1324:2fc444b69351

Minor optimization to avoid invalidating translated code when the bank has not actually changed. Makes a nasty edge case in the 68K debugger slightly less severe when dealing with code that uses banking
author Michael Pavone <pavone@retrodev.com>
date Fri, 21 Apr 2017 01:19:40 -0700
parents c9dc2603b087
children 58bfbed6cdb5
files romdb.c
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/romdb.c	Thu Apr 20 22:28:58 2017 -0700
+++ b/romdb.c	Fri Apr 21 01:19:40 2017 -0700
@@ -296,8 +296,11 @@
 			}
 		}
 	} else {
-		m68k_invalidate_code_range(gen->m68k, address * 0x80000, (address + 1) * 0x80000);
-		context->mem_pointers[gen->mapper_start_index + address] = gen->cart + 0x40000*value;
+		void *new_ptr = gen->cart + 0x40000*value;
+		if (context->mem_pointers[gen->mapper_start_index + address] != new_ptr) {
+			m68k_invalidate_code_range(gen->m68k, address * 0x80000, (address + 1) * 0x80000);
+			context->mem_pointers[gen->mapper_start_index + address] = new_ptr;
+		}
 	}
 	return context;
 }