]> granicus.if.org Git - strace/commit
Cache tcp->u_nargs in a local variable for for() loops
authorDenys Vlasenko <dvlasenk@redhat.com>
Tue, 23 Aug 2011 11:32:38 +0000 (13:32 +0200)
committerDenys Vlasenko <dvlasenk@redhat.com>
Tue, 23 Aug 2011 11:32:38 +0000 (13:32 +0200)
commit4b887a5a9a9892f064b238c8672fb89f42c8d5e0
tree43b0d24711d00e064a062df0dae55ac8fa6471f2
parentafc64037e22cc7cafadba766286e32550d9e8feb
Cache tcp->u_nargs in a local variable for for() loops

Loops of the form "for (i = 0; i < tcp->u_nargs; i++) ..."
need to fetch tcp->u_nargs from memory on every iteration
if "..." part has a function call (gcc doesn't know that
tcp->u_nargs won't change). This can be sped up
by putting tcp->u_nargs in a local variable, which might
go into a CPU register.

* syscall.c (decode_subcall): Cache tcp->u_nargs in a local variable
as for() loop limit value.
(syscall_enter): Likewise.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
syscall.c