summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/schedule.cpp
diff options
context:
space:
mode:
author Olivier Galibert <galibert@pobox.com>2018-07-29 13:07:56 +0200
committer Olivier Galibert <galibert@pobox.com>2018-07-29 13:07:56 +0200
commit64afd77e7c7ae7399373dcdff6ecb20ee8d50532 (patch)
tree13e90800561204f0b041d75d62d87c35e27df60c /src/emu/schedule.cpp
parenta74434167a2ef96508ef5b3f79f281d5d6f9ffc6 (diff)
Revert part of 20b5f5d0e6f73b9ce6fffa4fc5dbe3f2b83d2a27
This is damn sensitive code, and generates differences all over the place we don't really explain. The changes should be justified by themselves and tested in collaboration with Tafoid to ensure the differences are not a problem.
Diffstat (limited to 'src/emu/schedule.cpp')
-rw-r--r--src/emu/schedule.cpp51
1 files changed, 25 insertions, 26 deletions
diff --git a/src/emu/schedule.cpp b/src/emu/schedule.cpp
index ba6c5e79302..d281446d6c6 100644
--- a/src/emu/schedule.cpp
+++ b/src/emu/schedule.cpp
@@ -452,12 +452,7 @@ void device_scheduler::timeslice()
{
// only process if this CPU is executing or truly halted (not yielding)
// and if our target is later than the CPU's current time (coarse check)
- if (exec->m_suspend != 0)
- {
- if (exec->m_eatcycles)
- exec->m_localtime = target;
- }
- else if (target.seconds() >= exec->m_localtime.seconds())
+ if (EXPECTED((exec->m_suspend == 0 || exec->m_eatcycles) && target.seconds() >= exec->m_localtime.seconds()))
{
// compute how many attoseconds to execute this CPU
attoseconds_t delta = target.attoseconds() - exec->m_localtime.attoseconds();
@@ -472,29 +467,33 @@ void device_scheduler::timeslice()
int ran = exec->m_cycles_running = divu_64x32(u64(delta) >> exec->m_divshift, exec->m_divisor);
LOG((" cpu '%s': %d (%d cycles)\n", exec->device().tag(), delta, exec->m_cycles_running));
- g_profiler.start(exec->m_profiler);
-
- // note that this global variable cycles_stolen can be modified
- // via the call to cpu_execute
- exec->m_cycles_stolen = 0;
- m_executing_device = exec;
- *exec->m_icountptr = exec->m_cycles_running;
- if (!call_debugger)
- exec->run();
- else
+ // if we're not suspended, actually execute
+ if (exec->m_suspend == 0)
{
- exec->debugger_start_cpu_hook(target);
- exec->run();
- exec->debugger_stop_cpu_hook();
+ g_profiler.start(exec->m_profiler);
+
+ // note that this global variable cycles_stolen can be modified
+ // via the call to cpu_execute
+ exec->m_cycles_stolen = 0;
+ m_executing_device = exec;
+ *exec->m_icountptr = exec->m_cycles_running;
+ if (!call_debugger)
+ exec->run();
+ else
+ {
+ exec->debugger_start_cpu_hook(target);
+ exec->run();
+ exec->debugger_stop_cpu_hook();
+ }
+
+ // adjust for any cycles we took back
+ assert(ran >= *exec->m_icountptr);
+ ran -= *exec->m_icountptr;
+ assert(ran >= exec->m_cycles_stolen);
+ ran -= exec->m_cycles_stolen;
+ g_profiler.stop();
}
- // adjust for any cycles we took back
- assert(ran >= *exec->m_icountptr);
- ran -= *exec->m_icountptr;
- assert(ran >= exec->m_cycles_stolen);
- ran -= exec->m_cycles_stolen;
- g_profiler.stop();
-
// account for these cycles
exec->m_totalcycles += ran;