Julian Seward [Thu, 12 May 2005 23:25:43 +0000 (23:25 +0000)]
Create a fast version of MC_(helperc_MAKE_STACK_UNINIT), so as not to
slow down call-return intensive amd64 programs too much. Revised
version is approximately 8 times faster than the naive version.
Julian Seward [Thu, 12 May 2005 17:55:01 +0000 (17:55 +0000)]
Add the beginnings of what might be a general mechanism to pass
ABI-specific knowledge through the IR compilation pipeline. This
entails a new IR construction, AbiHint.
Currently there is only one kind of hint, and it is generated by the
amd64 front end. This tells whoever wants to know that a function
call or return has happened, and so the 128 bytes below %rsp should be
considered undefined.
Julian Seward [Thu, 12 May 2005 09:04:06 +0000 (09:04 +0000)]
When constructing a LeakErr, the (Char*) .string field is abused to
carry an Int. This is confusing but works on 32-bit platforms; on
64-bit ones, gcc complains about the cast. This commit adds another
kludge to keep gcc quiet. Really this should be fixed properly. The
casting-abuse is 'undone' in case LeakErr in MAC_(pp_Shared_Error).
This should really be fixed properly. If this .string isn't always
a string, perhaps it should be renamed 'auxword' and turned into a
UWord which is guaranteed castable to/from pointer on any platform.
Cleaned up vg_messages.c and related printf stuff. vg_messages.c is now a
layer above the printf stuff in vg_mylibc.c, which is layered over
m_debuglog. This makes the module interfaces neater, more consistent, and
cuts 40 lines of code.
Julian Seward [Wed, 11 May 2005 23:16:13 +0000 (23:16 +0000)]
Allow reg-alloc to use %rbx. This is a callee-saved register and
therefore particularly valuable - bringing it into circulation reduces
the volume of code generated by memcheck by about 3%.
Julian Seward [Wed, 11 May 2005 22:55:08 +0000 (22:55 +0000)]
Ah, the joys of register allocation. You might think that giving
reg-alloc as many registers as possible maximises performance. You
would be wrong. Giving it more registers generates more spilling of
caller-saved regs around the innumerable helper calls created by
Memcheck. What we really need are zillions of callee-save registers,
but those are in short supply. Hmm, perhaps I should let it use %rbx
too -- that's listed as callee-save.
Anyway, the current arrangement allows reg-alloc to use 8
general-purpose regs and 10 xmm registers. The x87 registers are not
used at all. This seems to work fairly well.
Moved Vex's arch/subarch detection out of main() into VG_(translate)()'s
init routine. This meant that VG_(vex_arch) and VG_(vex_subarch) could be
made local to VG_(translate)().
Removed the obsolete client request numbers that were used in the old
libpthread. There seems to be no danger of old libpthread.so files causing
problems; I just tried installing a current Valgrind over a 2.2.0
installation and it worked fine.
Julian Seward [Wed, 11 May 2005 11:57:41 +0000 (11:57 +0000)]
Use hi-half xmm registers (REX.R, REX.B == 1) (%xmm8-%xmm15) in an
attempt to flush out any register-number bugs that might be lurking.
It would be nice to be able to do the same with the integer registers,
but gcc-3.3.4 is too stupid to understand asms with clobbered
registers "r8d", etc (plain "r8" etc is OK) and I am too ignorant of
perl to know how to mash r8b/r8w/r8d back into plain "r8" etc for the
clobbered registers list.
Modularised the core/tool interface ('details', 'needs' and VG_(tdict))
into a new module m_tooliface. Pretty straightforward. Touches a lot
of files because many files use this interface and so need to include
the headers for the new module.
Modularised the malloc/free stuff into two modules: m_mallocfree for the
malloc/free implementation, and m_replacemalloc with the stuff for the tools
that replace malloc with their own version. Previously these two areas of
functionality were mixed up somewhat.
Julian Seward [Mon, 9 May 2005 22:23:38 +0000 (22:23 +0000)]
Finish off amd64 MMX instructions before they finish me off (it's
either them or me). Honestly, the amd64 insn set has the most complex
encoding I have ever seen.
Helgrind:
- make nested function non-nested to avoid GCC 4.0 warnings
- replace archaic "eraser" names with "hg". And EraserErr type is now
RaceErr (although we still use "Eraser" in suppression files for backwards
compatibility).
Big clean-up: changed the core/tool interface to be mediated entirely
through the VG_(tdict) function dictionary, rather than using TL_(foo)
functions.
This facilitated the following changes:
- Removed the "TL_" prefix, which is no longer needed.
- Removed the auto-generated files vg_toolint.[ch], which were no longer
needed, which simplifies the build a great deal. Their (greatly
streamlined) contents went into core.h and vg_needs.h (and will soon
go into a new module defining the core/tool interface).
This also meant that tool.h.base reverted to tool.h (so no more
accidentally editing tool.h and not having the changes go into the
repo, hooray!) And gen_toolint.pl was removed. And toolfuncs.def was
removed.
- Removed VG_(missing_tool_func)(), no longer used.
- Bumped the core/tool interface major version number to 8. And I
killed the minor version number, which was never used. The layout
of the ToolInfo struct is such that this should not cause problems.
Moved mc_errcontext.c into mc_main.c, since it was very small and there was
no benefit in having it separate. This allows some exports to be removed
from mc_include.h.
Rename some _SIZE macros as _SZB to make their units clear. This change is
in response to a mixed-units (bytes and words) error we had involving
VGA_STACK_REDZONE_SIZE (which is now VGA_STACK_REDZONE_SZB).
Put all the system call stuff in a new module, m_syscalls. This
required moving a lot of stuff around. I deleted
VG_(set_return_from_syscall_shadow)() and VG_(get_exit_status_shadow)(),
which screwed up the modularity and weren't being used and can be
simulated in other ways with a bit of care.
What are the chances that I've added and moved all the files correctly
in this commit, and not broken the amd64 port?
- Got rid of SET_THREAD_REG and some of the related macros, hallelujah.
Replaced SET_SYSCALL_RETVAL with VGP_TRACK_SYSCALL_RETVAL, which avoids
the redundant resetting of the syscall's return value. The other
remaining two related macros, SET_CLREQ_RETVAL and SET_CLCALL_RETVAL, were
able to be moved to vg_scheduler.c rather than being global, hoorah.
- Passed the required syscall args to VG_(do_sys_sigaltstack)(), rather than
grabbing them from within, removing its reliance on SYSCALL_ARG[12].
It also makes the VG_(do_sys_sig*)() functions more consistent.
- As a result of these changes, was able to remove the SYSCALL_NUM,
SYSCALL_RET and SYSCALL_ARG[123456] macros, yay.
- Replaced the implementations of VG_(set_return_from_syscall_shadow)() and
VG_(get_exit_status_shadow)() with shorter ones that avoid using arch-state
offsets.
Cleared up some confusion and redundant actions involving the SET_RESULT and
SET_SYSCALL_RETVAL macros, and made the VG_(do_sys_*)() functions behave
more consistently.
Also deleted some code that's been commented out of vg_syscalls.c for a long
time.
Tom Hughes [Sat, 7 May 2005 17:57:39 +0000 (17:57 +0000)]
Rework signal stack handling to avoid doing arithmetic on void pointers
and to avoid trashing the red zone while delivering a signal on the main
stack on amd64 systems.