Jens von der Heydt
2006-04-26 12:37:06 UTC
Jitc produces code like this:
mov [r3], edx
mov eax, [current_code_base]
add eax, 00000064
mov [lr], eax
mov eax, 00000078
call ppc_heartbeat_ext_rel_asm
mov eax, 00000078
call ppc_new_pc_this_page_asm
nop
in some branch conditions.
Notice the double loading of EAX. This makes sence if we take
ppc_heartbeat_ext_rel_asm to destroy EAX.
It does in some conditions but then it will never return, I gather
from its sources. Correct me if I'm wrong !
Therefore I think that the second LOAD of eax is not needed here.
See below the
corrected version from ppc_opc.cc. I commented out the second gen of
Load EAX.
I tested this and benchmarked again. Combined with my previous post
to this list
I get an XBench estimate of 18.424 Points (tested with 5 test runs).
Not bad
If I look at the score of 7.484 without the 2 patches I did.
static inline void ppc_opc_gen_set_pc_rel(uint32 li)
{
li += gJITC.pc;
if (li < 4096) {
/*
* We assure here 7+6+5+5 bytes, to have enough
space for
* four instructions (since we want to modify
them)
*/
jitcEmitAssure(7+6+5+5);
asmMOVRegImm_NoFlags(EAX, li);
asmCALL((NativeAddress)ppc_heartbeat_ext_rel_asm);
// asmMOVRegImm_NoFlags(EAX, li);
asmCALL((NativeAddress)ppc_new_pc_this_page_asm);
asmNOP(3);
} else {
asmALURegImm(X86_MOV, EAX, li);
asmJMP((NativeAddress)ppc_new_pc_rel_asm);
}
}
The only change I did to the above function is to remark that one
line. So pardon me for not creating a patch.
Please comment.
Jens
mov [r3], edx
mov eax, [current_code_base]
add eax, 00000064
mov [lr], eax
mov eax, 00000078
call ppc_heartbeat_ext_rel_asm
mov eax, 00000078
call ppc_new_pc_this_page_asm
nop
in some branch conditions.
Notice the double loading of EAX. This makes sence if we take
ppc_heartbeat_ext_rel_asm to destroy EAX.
It does in some conditions but then it will never return, I gather
from its sources. Correct me if I'm wrong !
Therefore I think that the second LOAD of eax is not needed here.
See below the
corrected version from ppc_opc.cc. I commented out the second gen of
Load EAX.
I tested this and benchmarked again. Combined with my previous post
to this list
I get an XBench estimate of 18.424 Points (tested with 5 test runs).
Not bad
If I look at the score of 7.484 without the 2 patches I did.
static inline void ppc_opc_gen_set_pc_rel(uint32 li)
{
li += gJITC.pc;
if (li < 4096) {
/*
* We assure here 7+6+5+5 bytes, to have enough
space for
* four instructions (since we want to modify
them)
*/
jitcEmitAssure(7+6+5+5);
asmMOVRegImm_NoFlags(EAX, li);
asmCALL((NativeAddress)ppc_heartbeat_ext_rel_asm);
// asmMOVRegImm_NoFlags(EAX, li);
asmCALL((NativeAddress)ppc_new_pc_this_page_asm);
asmNOP(3);
} else {
asmALURegImm(X86_MOV, EAX, li);
asmJMP((NativeAddress)ppc_new_pc_rel_asm);
}
}
The only change I did to the above function is to remark that one
line. So pardon me for not creating a patch.
Please comment.
Jens