Skip to content

Commit

Permalink
Reverted do_cycles change, as it caused a performance loss under JIT
Browse files Browse the repository at this point in the history
  • Loading branch information
midwan committed Jan 23, 2021
1 parent b78367f commit 32152dd
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
21 changes: 20 additions & 1 deletion src/events.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ static bool event_check_vsync(void)
return false;
}

void do_cycles_slow(unsigned long cycles_to_add)
void do_cycles_cpu_fastest(uae_u32 cycles_to_add)
{
if (!currprefs.cpu_thread) {
if ((pissoff -= cycles_to_add) >= 0)
Expand Down Expand Up @@ -284,12 +284,31 @@ void do_cycles_slow(unsigned long cycles_to_add)
}
}
events_schedule ();
}
currcycle += cycles_to_add;
}

void do_cycles_cpu_norm(uae_u32 cycles_to_add)
{
while ((nextevent - currcycle) <= cycles_to_add)
{
cycles_to_add -= (nextevent - currcycle);
currcycle = nextevent;

for (auto& i : eventtab)
{
if (i.active && i.evtime == currcycle)
{
(*i.handler)();
}
}
events_schedule();
}
currcycle += cycles_to_add;
}

do_cycles_func do_cycles = do_cycles_cpu_norm;

void MISC_handler (void)
{
static bool dorecheck;
Expand Down
4 changes: 2 additions & 2 deletions src/include/events.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ typedef void (*evfunc2)(uae_u32);

typedef void (*do_cycles_func)(uae_u32);
extern do_cycles_func do_cycles;
void do_cycles_slow(unsigned long cycles_to_add);
void do_cycles_cpu_fastest(uae_u32 cycles_to_add);
void do_cycles_cpu_norm(uae_u32 cycles_to_add);

typedef unsigned long int evt;

Expand Down Expand Up @@ -71,7 +72,6 @@ extern int pissoff_value;
extern uae_s32 pissoff;

#define countdown pissoff
#define do_cycles do_cycles_slow

extern struct ev eventtab[ev_max];
extern struct ev2 eventtab2[ev2_max];
Expand Down
5 changes: 5 additions & 0 deletions src/newcpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,11 @@ static void update_68k_cycles(void)
}
}

if (currprefs.m68k_speed < 0 || currprefs.cachesize > 0)
do_cycles = do_cycles_cpu_fastest;
else
do_cycles = do_cycles_cpu_norm;

set_config_changed();
}

Expand Down

0 comments on commit 32152dd

Please sign in to comment.