diff options
author | 2018-07-30 00:17:07 +0900 | |
---|---|---|
committer | 2018-07-30 00:17:07 +0900 | |
commit | ebb49e8f0bb4764ea6e2c33f3090ec85f54681c0 (patch) | |
tree | c4cd1bd81fa1bf2adeef8268613395a3499416c5 /src/emu/schedule.cpp | |
parent | fe8b1c978b5da5206c0091a60b02328723b19cd6 (diff) | |
parent | c70d3cf470f805a751799a3dd77870a2dff826ae (diff) |
Merge remote-tracking branch 'upstream/master' into ymf278_envelope
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
Diffstat (limited to 'src/emu/schedule.cpp')
-rw-r--r-- | src/emu/schedule.cpp | 57 |
1 files changed, 30 insertions, 27 deletions
diff --git a/src/emu/schedule.cpp b/src/emu/schedule.cpp index ba6c5e79302..e2b1497995f 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(); @@ -465,36 +460,44 @@ void device_scheduler::timeslice() delta += ATTOSECONDS_PER_SECOND; assert(delta == (target - exec->m_localtime).as_attoseconds()); + if (exec->m_attoseconds_per_cycle == 0) + { + exec->m_localtime = target; + } // if we have enough for at least 1 cycle, do the math - if (delta >= exec->m_attoseconds_per_cycle) + else if (delta >= exec->m_attoseconds_per_cycle) { // compute how many cycles we want to execute 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; |