so as to avoid a GSP-changed check in the common case. See vex r2155.
(amd64-darwin and x86-darwin are now temporarily unbuildable.)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11786
/* fall into main loop (the right one) */
cmpq $0, %rsi
- je VG_(run_innerloop__dispatch_unprofiled)
- jmp VG_(run_innerloop__dispatch_profiled)
+ je VG_(run_innerloop__dispatch_unassisted_unprofiled)
+ jmp VG_(run_innerloop__dispatch_unassisted_profiled)
/*NOTREACHED*/
/*----------------------------------------------------*/
/*----------------------------------------------------*/
.align 16
-.global VG_(run_innerloop__dispatch_unprofiled)
-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. */
- testq $1, %rbp
- jnz gsp_changed
+.global VG_(run_innerloop__dispatch_unassisted_unprofiled)
+VG_(run_innerloop__dispatch_unassisted_unprofiled):
+ /* AT ENTRY: %rax is next guest addr, %rbp is the
+ unmodified guest state ptr */
/* save the jump address in the guest state */
movq %rax, OFFSET_amd64_RIP(%rbp)
/* Found a match. Jump to .host. */
jmp *%r11
ud2 /* persuade insn decoders not to speculate past here */
- /* generated code should run, then jump back to
- VG_(run_innerloop__dispatch_unprofiled). */
+ /* generated code should run, then jump back to either
+ VG_(run_innerloop__dispatch_unassisted_unprofiled)
+ VG_(run_innerloop__dispatch_assisted_unprofiled). */
+ /*NOTREACHED*/
+
+.align 16
+.global VG_(run_innerloop__dispatch_assisted_unprofiled)
+VG_(run_innerloop__dispatch_assisted_unprofiled):
+ /* AT ENTRY: %rax is next guest addr, %rbp is the
+ modified guest state ptr */
+ /* We know the guest state pointer has been modified.
+ So jump directly to gsp_changed. */
+ jmp gsp_changed
+ ud2
/*NOTREACHED*/
/*----------------------------------------------------*/
/*----------------------------------------------------*/
.align 16
-.global VG_(run_innerloop__dispatch_profiled)
-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. */
- testq $1, %rbp
- jnz gsp_changed
+.global VG_(run_innerloop__dispatch_unassisted_profiled)
+VG_(run_innerloop__dispatch_unassisted_profiled):
+ /* AT ENTRY: %rax is next guest addr, %rbp is the
+ unmodified guest state ptr */
/* save the jump address in the guest state */
movq %rax, OFFSET_amd64_RIP(%rbp)
jnz fast_lookup_failed
/* increment bb profile counter */
- movq VG_(tt_fastN)@GOTPCREL(%rip), %rdx
+ movabsq $VG_(tt_fastN), %rdx
shrq $1, %rbx /* entry# * sizeof(UInt*) */
movq (%rdx,%rbx,1), %rdx
addl $1, (%rdx)
/* Found a match. Jump to .host. */
jmp *%r11
ud2 /* persuade insn decoders not to speculate past here */
- /* generated code should run, then jump back to
- VG_(run_innerloop__dispatch_profiled). */
+ /* generated code should run, then jump back to either
+ VG_(run_innerloop__dispatch_unassisted_profiled)
+ VG_(run_innerloop__dispatch_assisted_profiled). */
+ /*NOTREACHED*/
+
+.align 16
+.global VG_(run_innerloop__dispatch_assisted_profiled)
+VG_(run_innerloop__dispatch_assisted_profiled):
+ /* AT ENTRY: %rax is next guest addr, %rbp is the
+ modified guest state ptr */
+
+ /* Well, we know the guest state pointer has been modified.
+ So jump directly to gsp_changed. */
+ jmp gsp_changed
+ ud2
/*NOTREACHED*/
/*----------------------------------------------------*/
/* fall into main loop (the right one) */
cmpl $0, 32(%esp) /* do_profiling */
- je VG_(run_innerloop__dispatch_unprofiled)
- jmp VG_(run_innerloop__dispatch_profiled)
+ je VG_(run_innerloop__dispatch_unassisted_unprofiled)
+ jmp VG_(run_innerloop__dispatch_unassisted_profiled)
/*NOTREACHED*/
/*----------------------------------------------------*/
/*----------------------------------------------------*/
.align 16
-.global VG_(run_innerloop__dispatch_unprofiled)
-VG_(run_innerloop__dispatch_unprofiled):
- /* AT ENTRY: %eax is next guest addr, %ebp is possibly
- modified guest state ptr */
-
- /* Has the guest state pointer been messed with? If yes, exit. */
- testl $1, %ebp
- jnz gsp_changed
+.global VG_(run_innerloop__dispatch_unassisted_unprofiled)
+VG_(run_innerloop__dispatch_unassisted_unprofiled):
+ /* AT ENTRY: %eax is next guest addr, %ebp is the
+ unmodified guest state ptr */
/* save the jump address in the guest state */
movl %eax, OFFSET_x86_EIP(%ebp)
/* Found a match. Jump to .host. */
jmp *%edi
ud2 /* persuade insn decoders not to speculate past here */
- /* generated code should run, then jump back to
- VG_(run_innerloop__dispatch_unprofiled). */
+ /* generated code should run, then jump back to either
+ VG_(run_innerloop__dispatch_unassisted_unprofiled) or
+ VG_(run_innerloop__dispatch_assisted_unprofiled). */
+ /*NOTREACHED*/
+
+.align 16
+.global VG_(run_innerloop__dispatch_assisted_unprofiled)
+VG_(run_innerloop__dispatch_assisted_unprofiled):
+ /* AT ENTRY: %eax is next guest addr, %ebp is the
+ modified guest state ptr */
+ /* We know the guest state pointer has been modified.
+ So jump directly to gsp_changed. */
+ jmp gsp_changed
+ ud2
/*NOTREACHED*/
/*----------------------------------------------------*/
/*----------------------------------------------------*/
.align 16
-.global VG_(run_innerloop__dispatch_profiled)
-VG_(run_innerloop__dispatch_profiled):
- /* AT ENTRY: %eax is next guest addr, %ebp is possibly
- modified guest state ptr */
-
- /* Has the guest state pointer been messed with? If yes, exit. */
- testl $1, %ebp
- jnz gsp_changed
+.global VG_(run_innerloop__dispatch_unassisted_profiled)
+VG_(run_innerloop__dispatch_unassisted_profiled):
+ /* AT ENTRY: %eax is next guest addr, %ebp is the
+ unmodified guest state ptr */
/* save the jump address in the guest state */
movl %eax, OFFSET_x86_EIP(%ebp)
/* Found a match. Jump to .host. */
jmp *%edi
ud2 /* persuade insn decoders not to speculate past here */
- /* generated code should run, then jump back to
- VG_(run_innerloop__dispatch_profiled). */
+ /* generated code should run, then jump back to either
+ VG_(run_innerloop__dispatch_unassisted_profiled) or
+ VG_(run_innerloop__dispatch_assisted_profiled). */
+ /*NOTREACHED*/
+
+.align 16
+.global VG_(run_innerloop__dispatch_assisted_profiled)
+VG_(run_innerloop__dispatch_assisted_profiled):
+ /* AT ENTRY: %eax is next guest addr, %ebp is the
+ modified guest state ptr */
+ /* We know the guest state pointer has been modified.
+ So jump directly to gsp_changed. */
+ jmp gsp_changed
+ ud2
/*NOTREACHED*/
/*----------------------------------------------------*/
/* Set up the dispatch-return info. For archs without a link
register, vex generates a jump back to the specified dispatch
address. Else, it just generates a branch-to-LR. */
+
# if defined(VGA_x86) || defined(VGA_amd64)
- vta.dispatch
- = (!allow_redirection)
- ? /* It's a no-redir translation. Will be run with the nonstandard
- dispatcher VG_(run_a_noredir_translation)
- and so needs a nonstandard return point. */
- (void*) &VG_(run_a_noredir_translation__return_point)
-
- : /* normal translation. Uses VG_(run_innerloop). Return
- point depends on whether we're profiling bbs or not. */
- VG_(clo_profile_flags) > 0
- ? (void*) &VG_(run_innerloop__dispatch_profiled)
- : (void*) &VG_(run_innerloop__dispatch_unprofiled);
+ if (!allow_redirection) {
+ /* It's a no-redir translation. Will be run with the
+ nonstandard dispatcher VG_(run_a_noredir_translation) and so
+ needs a nonstandard return point. */
+ vta.dispatch_assisted
+ = (void*) &VG_(run_a_noredir_translation__return_point);
+ vta.dispatch_unassisted
+ = vta.dispatch_assisted;
+ }
+ else
+ if (VG_(clo_profile_flags) > 0) {
+ /* normal translation; although we're profiling. */
+ vta.dispatch_assisted
+ = (void*) &VG_(run_innerloop__dispatch_assisted_profiled);
+ vta.dispatch_unassisted
+ = (void*) &VG_(run_innerloop__dispatch_unassisted_profiled);
+ }
+ else {
+ /* normal translation and we're not profiling (the normal case) */
+ vta.dispatch_assisted
+ = (void*) &VG_(run_innerloop__dispatch_assisted_unprofiled);
+ vta.dispatch_unassisted
+ = (void*) &VG_(run_innerloop__dispatch_unassisted_unprofiled);
+ }
+
# elif defined(VGA_ppc32) || defined(VGA_ppc64) \
|| defined(VGA_arm) || defined(VGA_s390x)
/* See comment libvex.h; machine has link register --> dipatch = NULL */
vta.dispatch = NULL;
+
# else
# error "Unknown arch"
# endif
following somewhat bogus decls. At least on x86 and amd64. ppc32
and ppc64 use straightforward bl-blr to get from dispatcher to
translation and back and so do not need these labels. */
-extern Addr VG_(run_innerloop__dispatch_unprofiled);
-extern Addr VG_(run_innerloop__dispatch_profiled);
+extern Addr VG_(run_innerloop__dispatch_unassisted_unprofiled);
+extern Addr VG_(run_innerloop__dispatch_assisted_unprofiled);
+extern Addr VG_(run_innerloop__dispatch_unassisted_profiled);
+extern Addr VG_(run_innerloop__dispatch_assisted_profiled);
#endif