Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#17 CPU emulation cleanup/reorganization patch

closed-duplicate
nobody
None
5
2005-11-18
2005-09-13
Andrew Church
No

This patch is intended to be applied on top of my
previous patch (#1287942). It (1) moves the ARM and
Thumb emulation code directly into the new GBA-arm.cpp
and GBA-thumb.cpp (eliminating arm-new.h and thumb.h),
and (2) splits the monolithic "switch(opcode)" blocks
into tables of functions. The switch blocks were
already implemented as a jump table, at least when
compiled with GCC, so the only penalty is saving and
restoring registers in the opcode functions; I did 10
sample runs both before and after, and the difference
in average speed (with -fomit-frame-pointer) was only
0.3%, well within the range of statistical noise. I've
verified through assembly listings that the Thumb
emulation is unaltered, save for stack offset and
register selection changes; the ARM code is too bulky
for a direct check, but a couple hours of playing with
the patch applied have convinced me it's fine as well
(most of the reorganization was done with scripts
anyway). The new code is, IMHO, much more
maintainable--I've already obtained about a 5% speedup
from preliminary optimization--and as a side effect
takes much less time and memory to compile.

Discussion

  • Andrew Church
    Andrew Church
    2005-09-15

    Patch (long, gzipped)

     
  • Andrew Church
    Andrew Church
    2005-09-15

    Logged In: YES
    user_id=527960

    Fixed typo in patch (stray break causing minor performance
    degradation).

     
  • Andrew Church
    Andrew Church
    2005-11-18

    • status: open --> closed-duplicate
     
  • Andrew Church
    Andrew Church
    2005-11-18

    Logged In: YES
    user_id=527960

    Marking as a duplicate, since the final patch (1292942) now
    includes this patch as well.