mirror of
https://github.com/holub/mame
synced 2025-05-20 20:58:51 +03:00
Minor speed improvement to the e132xs core - don't pass opcode parameter when calling instruction handlers [Christophe Jaillet]
> -----Original Message----- > From: Christophe Jaillet [mailto:christophe.jaillet@wanadoo.fr] > Sent: Saturday, October 17, 2009 9:00 AM > To: submit@mamedev.org > Subject: Speed up emu\cpu\e132xs > > Hi, > > this patch speeds up the emulation of the CPU e132xs. > > For the emulation of this CPU, two structures are used : > - '_hyperstone_state' which keep track of the state of the > processor > - 'regs_decode' which is used when decoding the opcode being > executed > > Both of these structures have a field 'op' but only the one of > 'regs_decode' > is actually used. > > The emulation of the CPU is done this way : > - read the opcode > - call the corresponding function which emulate this opcode. Two > parameters are passed : > o a pointer to hyperstone_state > o the opcode itself > - the opcode is then stored in the relevant field of a local stack > stored 'regs_decode' structure. > > The field 'op' of '_hyperstone_state' is never used. > > > So the proposed patch does the following : > - use the 'op' field of '_hyperstone_state' instead of the one of > 'regs_decode' > - initialise this 'op' field before calling the function which > emulate > this opcode > - remove the need of the second parameter ('opcode') of these > functions > - remove the now useless 'op' field of the structure 'regs_decode' > > Doing so removes the need of pushing a parameter on the stack for each > opcode simulated and give a average speed up of 1 % or 2 % of the > emulation. > > Hope this help. > Best regards, > > CJ
This commit is contained in:
parent
0279e10c26
commit
8b28c00872
@ -349,7 +349,6 @@ struct regs_decode
|
||||
UINT8 same_src_dst;
|
||||
UINT8 same_src_dstf;
|
||||
UINT8 same_srcf_dst;
|
||||
UINT16 op;
|
||||
};
|
||||
|
||||
static void check_interrupts(hyperstone_state *cpustate);
|
||||
@ -360,7 +359,6 @@ static void check_interrupts(hyperstone_state *cpustate);
|
||||
#define DREGF (decode)->next_dst_value
|
||||
#define EXTRA_U (decode)->extra.u
|
||||
#define EXTRA_S (decode)->extra.s
|
||||
#define OP (decode)->op
|
||||
|
||||
#define SET_SREG( _data_ ) ((decode)->src_is_local ? set_local_register(cpustate, (decode)->src, _data_) : set_global_register(cpustate, (decode)->src, _data_))
|
||||
#define SET_SREGF( _data_ ) ((decode)->src_is_local ? set_local_register(cpustate, (decode)->src + 1, _data_) : set_global_register(cpustate, (decode)->src + 1, _data_))
|
||||
@ -500,6 +498,7 @@ static void hyperstone_set_trap_entry(hyperstone_state *cpustate, int which)
|
||||
}
|
||||
}
|
||||
|
||||
#define OP cpustate->op
|
||||
#define PPC cpustate->ppc //previous pc
|
||||
#define PC cpustate->global_regs[0] //Program Counter
|
||||
#define SR cpustate->global_regs[1] //Status Register
|
||||
@ -4671,18 +4670,17 @@ static CPU_EXECUTE( hyperstone )
|
||||
do
|
||||
{
|
||||
UINT32 oldh = SR & 0x00000020;
|
||||
UINT16 opcode;
|
||||
|
||||
PPC = PC; /* copy PC to previous PC */
|
||||
debugger_instruction_hook(device, PC);
|
||||
|
||||
opcode = READ_OP(cpustate, PC);
|
||||
OP = READ_OP(cpustate, PC);
|
||||
PC += 2;
|
||||
|
||||
cpustate->instruction_length = 1;
|
||||
|
||||
/* execute opcode */
|
||||
(*hyperstone_op[(opcode & 0xff00) >> 8])(cpustate, opcode);
|
||||
(*hyperstone_op[(OP & 0xff00) >> 8])(cpustate);
|
||||
|
||||
/* clear the H state if it was previously set */
|
||||
SR ^= oldh;
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user