diff options
author | Aaron Giles <aaron@aarongiles.com> | 2021-03-19 08:46:15 -0700 |
---|---|---|
committer | Aaron Giles <aaron@aarongiles.com> | 2021-03-19 08:46:15 -0700 |
commit | 6e4f2e1103d2e515ce70dfca35fe0b7a8bb4bedc (patch) | |
tree | 9db951fa9fa4c8cd50466c23d07fc637e6f5c606 | |
parent | c8980150ca474e87cd299e7c8d246d685f9bf949 (diff) |
Split timeslice() into debugging and non-debugging versions to save a compare in the inner loop.
-rw-r--r-- | src/emu/machine.cpp | 12 | ||||
-rw-r--r-- | src/emu/schedule.cpp | 15 | ||||
-rw-r--r-- | src/emu/schedule.h | 2 |
3 files changed, 16 insertions, 13 deletions
diff --git a/src/emu/machine.cpp b/src/emu/machine.cpp index f17f6c47d49..4a7c01e1a43 100644 --- a/src/emu/machine.cpp +++ b/src/emu/machine.cpp @@ -380,10 +380,14 @@ int running_machine::run(bool quiet) { g_profiler.start(PROFILER_EXTRA); - // execute CPUs if not paused + // execute CPUs if not paused; otherwise, just pump video updates through if (!m_paused) - m_scheduler.timeslice(); - // otherwise, just pump video updates through + { + if ((debug_flags & DEBUG_FLAG_ENABLED) == 0) + m_scheduler.timeslice<false>(); + else + m_scheduler.timeslice<true>(); + } else m_video->frame_update(); @@ -1416,7 +1420,7 @@ void running_machine::emscripten_main_loop() while (!machine->m_paused && !machine->scheduled_event_pending() && scheduler->time() < stoptime) { - scheduler->timeslice(); + scheduler->timeslice<false>(); // handle save/load if (machine->m_saveload_schedule != saveload_schedule::NONE) { diff --git a/src/emu/schedule.cpp b/src/emu/schedule.cpp index 9306757a2e6..b31a9312f4a 100644 --- a/src/emu/schedule.cpp +++ b/src/emu/schedule.cpp @@ -430,10 +430,9 @@ inline void device_scheduler::apply_suspend_changes() // timeslice //------------------------------------------------- +template<bool Debugging> void device_scheduler::timeslice() { - bool call_debugger = ((machine().debug_flags & DEBUG_FLAG_ENABLED) != 0); - // build the execution list if we don't have one yet if (UNEXPECTED(m_execute_list == nullptr)) rebuild_execute_list(); @@ -489,14 +488,11 @@ void device_scheduler::timeslice() exec->m_cycles_stolen = 0; m_executing_device = exec; *exec->m_icountptr = exec->m_cycles_running; - if (!call_debugger) - exec->run(); - else - { + if (Debugging) exec->debugger_start_cpu_hook(attotime(m_basetime.seconds(), target) + attotime::zero); - exec->run(); + exec->run(); + if (Debugging) exec->debugger_stop_cpu_hook(); - } // adjust for any cycles we took back assert(ran >= *exec->m_icountptr); @@ -545,6 +541,9 @@ void device_scheduler::timeslice() execute_timers(); } +template void device_scheduler::timeslice<true>(); +template void device_scheduler::timeslice<false>(); + void device_scheduler::update_basetime() { diff --git a/src/emu/schedule.h b/src/emu/schedule.h index a6488942da5..e781748c7cf 100644 --- a/src/emu/schedule.h +++ b/src/emu/schedule.h @@ -211,7 +211,7 @@ public: bool can_save() const; // execution - void timeslice(); + template<bool Debugging> void timeslice(); void abort_timeslice(); void trigger(int trigid, const attotime &after = attotime::zero); void boost_interleave(const attotime ×lice_time, const attotime &boost_duration); |