From: Julian Seward Date: Sat, 28 May 2011 17:07:53 +0000 (+0000) Subject: dispatch-x86-linux.S: X-Git-Tag: svn/VALGRIND_3_7_0~452 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3a131dc867996d9f9a303b818f994dec0578a8a4;p=thirdparty%2Fvalgrind.git dispatch-x86-linux.S: use test-based detection of GSP pointer changes. Saves one load per SB. dispatch-amd64-linux.S: ditto dispatch-amd64-linux.S: use movabsq to get &VG_(tt_fast) into a register, instead of an rsp-relative load from a constant pool. Saves a second load per SB. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11785 --- diff --git a/coregrind/m_dispatch/dispatch-amd64-linux.S b/coregrind/m_dispatch/dispatch-amd64-linux.S index b125a573fb..82a77bd66a 100644 --- a/coregrind/m_dispatch/dispatch-amd64-linux.S +++ b/coregrind/m_dispatch/dispatch-amd64-linux.S @@ -121,12 +121,9 @@ VG_(run_innerloop__dispatch_unprofiled): /* AT ENTRY: %rax is next guest addr, %rbp is possibly modified guest state ptr */ - /* Has the guest state pointer been messed with? If yes, exit. - Also, set %rcx to be &VG_(tt_fast), some insns before it is - used, in the hope of getting it off the critical path. This - location seems to be optimal on 2.2GHz Athlon64. */ - cmpq 8(%rsp), %rbp - movq VG_(tt_fast)@GOTPCREL(%rip), %rcx + /* Has the guest state pointer been messed with? If yes, + exit. */ + testq $1, %rbp jnz gsp_changed /* save the jump address in the guest state */ @@ -137,6 +134,7 @@ VG_(run_innerloop__dispatch_unprofiled): jz counter_is_zero /* try a fast lookup in the translation cache */ + movabsq $VG_(tt_fast), %rcx movq %rax, %rbx /* next guest addr */ andq $VG_TT_FAST_MASK, %rbx /* entry# */ shlq $4, %rbx /* entry# * sizeof(FastCacheEntry) */ @@ -162,12 +160,9 @@ VG_(run_innerloop__dispatch_profiled): /* AT ENTRY: %rax is next guest addr, %rbp is possibly modified guest state ptr */ - /* Has the guest state pointer been messed with? If yes, exit. - Also, set %rcx to be &VG_(tt_fast), some insns before it is - used, in the hope of getting it off the critical path. This - location seems to be optimal on 2.2GHz Athlon64. */ - cmpq 8(%rsp), %rbp - movq VG_(tt_fast)@GOTPCREL(%rip), %rcx + /* Has the guest state pointer been messed with? If yes, + exit. */ + testq $1, %rbp jnz gsp_changed /* save the jump address in the guest state */ @@ -178,6 +173,7 @@ VG_(run_innerloop__dispatch_profiled): jz counter_is_zero /* try a fast lookup in the translation cache */ + movabsq $VG_(tt_fast), %rcx movq %rax, %rbx andq $VG_TT_FAST_MASK, %rbx /* entry# */ shlq $4, %rbx /* entry# * sizeof(FastCacheEntry) */ diff --git a/coregrind/m_dispatch/dispatch-x86-linux.S b/coregrind/m_dispatch/dispatch-x86-linux.S index 774aa8ae52..c719e010ac 100644 --- a/coregrind/m_dispatch/dispatch-x86-linux.S +++ b/coregrind/m_dispatch/dispatch-x86-linux.S @@ -111,7 +111,7 @@ VG_(run_innerloop__dispatch_unprofiled): modified guest state ptr */ /* Has the guest state pointer been messed with? If yes, exit. */ - cmpl 28(%esp), %ebp + testl $1, %ebp jnz gsp_changed /* save the jump address in the guest state */ @@ -147,7 +147,7 @@ VG_(run_innerloop__dispatch_profiled): modified guest state ptr */ /* Has the guest state pointer been messed with? If yes, exit. */ - cmpl 28(%esp), %ebp + testl $1, %ebp jnz gsp_changed /* save the jump address in the guest state */