Julian Seward [Wed, 16 Jan 2013 21:10:01 +0000 (21:10 +0000)]
Fix up the s390 back end to be in sync with infrastructural changes
w.r.t. conditional dirty helpers that return values. Does not
actually handle such cases since the s390 front end does not generate
them. Further ahead, it would be more general to redo this by
incorporating a RetLoc as part of the helper_call struct. This change
is OK for now, though.
Julian Seward [Wed, 16 Jan 2013 14:56:06 +0000 (14:56 +0000)]
ppc32/64 equivalents to r2636: fix up the ppc back end to be in sync
with infrastructural changes w.r.t. conditional dirty helpers that
return values. Does not actually handle such cases since the ppc
front end does not generate them.
Julian Seward [Wed, 16 Jan 2013 09:29:37 +0000 (09:29 +0000)]
x86 equivalent to r2636: fix up the x86 back end to be in sync with
infrastructural changes w.r.t. conditional dirty helpers that return
values. Does not actually handle such cases since the x86 front end
does not generate them.
Julian Seward [Tue, 15 Jan 2013 22:30:39 +0000 (22:30 +0000)]
Fix up the amd64 back end to be in sync with infrastructural changes
w.r.t. conditional dirty helpers that return values. Does not
actually handle such cases since the amd64 front end does not generat
them.
Avoid to record execontext used for origin tracking when --trac-origins=no
All calls to VG_(unknown_SP_update) were recording an execontext
of one IP, useful only for track origin.
This patch implements splits VG_(unknown_SP_update)
in two different functions VG_(unknown_SP_update_w_ECU)
(doing origin tracking) and VG_(unknown_SP_update) (not doing origin tracking).
Florian Krohm [Sun, 13 Jan 2013 02:29:05 +0000 (02:29 +0000)]
s390: Support insns to convert between DFP values and signed/unsigned
integers. Patch by Maran Pakkirisamy (maranp@linux.vnet.ibm.com).
Part of fixing BZ 307113.
Florian Krohm [Sat, 12 Jan 2013 22:04:00 +0000 (22:04 +0000)]
Add memcheck support for the IROps added in VEX r2631.
Adapt vbit-tester.
Patch by Maran Pakkirisamy (maranp@linux.vnet.ibm.com).
Part of fixing BZ 307113.
Florian Krohm [Sat, 12 Jan 2013 22:02:07 +0000 (22:02 +0000)]
Add 12 IROps for converting betwen DFP values and signed/unsigned integers.
Patch by Maran Pakkirisamy (maranp@linux.vnet.ibm.com).
Part of fixing BZ 307113.
The option --keep-stacktraces controls which stack trace(s) to keep for
malloc'd and/or free'd blocks. This can be used to obtain more information
for 'use after free' errors or to decrease Valgrind memory and/or cpu usage
by recording less information for heap blocks.
This fixes 312913 Dangling pointers error should also report the alloc
stack trace.
Addition of GDB server monitor command 'v.info execontext' that shows
information about the stack traces recorded by Valgrind.
This can be used to analyse one possible cause of Valgrind high
memory usage for some programs.
At work, a big set of regression tests crashed out of memory under Valgrind.
Two main causes for out of memory were identified:
1. big memory usage for stacktrace (exe contexts) recording by Valgrind
2. big number of partially initialised bytes.
This patch adds a gdbsrv monitor command that output (very) detailed
information about all the recorded exe context.
This has been used to analyse the problem 1. above,
showing the following identified causes for a (too) big nr of execontexts:
A. When the JIT handles an unknown SP update, even when --track-origins=no,
an execontext is (uselessly) created and recorded
to track the (never used) origin of some uninitialised stack memory.
This creates a whole bunch of 'one IP' execontexts.
B. same problem in handling some system calls (at least the brk system
calls always records an origin, even when --track-origins=yes).
C. The Valgrind unwinder cannot properly unwind some stack traces.
It unwinds a few frames, then go bezerk and stops at a "random" IP.
This then causes the same "logical" stacktrace to be truncated
and records thousands of times with this "differentiating" last IP.
For problem cause 2 above ( a lot of partially initialised bytes),
the idea is to similarly add another gdbsrv commands that will output
statistics about which stack traces are causing a lot of uninitialised bytes.
Julian Seward [Tue, 8 Jan 2013 14:09:04 +0000 (14:09 +0000)]
Get rid of selectable default (return) values in conditional dirty
calls, as introduced in r2594. It is overkill -- unnecessary
complexity. Instead have a pre-assumed default bit pattern of 0101010
(0x55..) to be returned in such cases.
Carl Love [Thu, 3 Jan 2013 23:34:18 +0000 (23:34 +0000)]
The call to set the rounding mode for DFP iops: Iop_AddD128, Iop_SubD128,
Iop_MulD128, Iop_DivD128, and Iop_D128toI64 is wrong. The call being used is
set_FPU_rounding_mode(). This call is used to set the two rounding mode bits
for the Floating point instructions. The call set_FPU_DFP_rounding_mode()
should have been used to set the three rounding mode bits for the DFP
instructions.
This patch changes the call to the correct function to set the DFP
rounding mode bits.
Florian Krohm [Sun, 30 Dec 2012 18:17:18 +0000 (18:17 +0000)]
Improve handling of dirty helper calls when building trees in ado_treebuild_BB.
This function took an overly conservative approach and always assumed
that calling a dirty helper would modify both guest state and memory. This
patch introduces two new functions dirty_helper_stores and dirty_helper_puts,
to determine the actual side effets of a helper call. Using these functions
increases precision and allows the tree builder to move a GET past a dirty
helper call.
Julian Seward [Fri, 28 Dec 2012 09:12:14 +0000 (09:12 +0000)]
Improvements to the built-in profiling infrastructure:
--profile-flags=00000000 now prints summary statistics, one line per
profiled block, but with no translation details. Previously it had
no effect.
--profile-interval=<number> is a new flag that causes the profile data
to be dumped and zeroed every <number> event checks. This makes it
possible to get profile data without waiting for runs to end, and to
get profile data which depends on the current workload etc. If
--profile-interval=0 or is unset, the profile is printed only once, at
the end of the run, as before.
--profile-flags=XXXXXXXX (for at least one nonzero X) prints the
summary lines both at the start and end of the profile, so you don't
have to scroll back up to the top to see the summary.
Florian Krohm [Thu, 27 Dec 2012 20:14:03 +0000 (20:14 +0000)]
s390: Support the "test data class/group" and "extract significance"
insns. Patch by Maran Pakkirisamy (maranp@linux.vnet.ibm.com).
This is part of fixing BZ 307113.
Florian Krohm [Thu, 27 Dec 2012 00:59:43 +0000 (00:59 +0000)]
s390: Do not waste a register when assigning a constant to a memory
location. If available, use MVHI and friends. If those are not available,
load the constant value into register r0 and store that. r0 is not visible
to register allocation and therefore using it does not increase register
pressure.
Remove S390_INSN_MZERO and replace it with S390_INSN_MIMM. Assigning zero
is just a special case..
Saves between 0.9% and 2.4% of insns as measured with the perf regression
bucket.
Florian Krohm [Wed, 26 Dec 2012 17:48:46 +0000 (17:48 +0000)]
valgrind side changes to support Iop_CmpExpD64 and Iop_CmpExpD128.
VEX buddy patch is r2617.
Enhance testcase for CEDTR and CEXTR. Adapt vbit tester.
Patch by Maran Pakkirisamy (maranp@linux.vnet.ibm.com).
This is part of fixing BZ 307113.
Florian Krohm [Wed, 26 Dec 2012 17:47:19 +0000 (17:47 +0000)]
s390x: Support "compare biased exponent" insns CEDTR, CEXTR.
To do that properly, two new IROps are needed: Iop_CmpExpD64 and
Iop_CmpExpD128. It might seem that extracting the exponents using
Iop_ExtractExpD64/D128 and comparing the values could be used here.
But that only works for finite DFP values. Hence, the new IROps.
Patch by Maran Pakkirisamy (maranp@linux.vnet.ibm.com).
This is part of fixing BZ 307113.
Florian Krohm [Mon, 24 Dec 2012 00:14:31 +0000 (00:14 +0000)]
s390: New file s390_defs.h to contain definitions that are
neither guest nor host specific, but just s390 specific. These
definitions formerly resided in host_s390_defs.h
Florian Krohm [Sun, 23 Dec 2012 16:17:18 +0000 (16:17 +0000)]
s390: Add testcases for CDTR, CXTR, LDETR. LXDTR, LEDTR, LDXTR.
This is part of fixing BZ 307113.
Patch by Maran Pakkirisamy (maranp@linux.vnet.ibm.com).
Florian Krohm [Sun, 23 Dec 2012 01:09:16 +0000 (01:09 +0000)]
s390: Simplify the optimisation for PUTs to tracked registers.
There is no need to treat the guest IA register specially. The first
assignment in a SB to any tracked register will always assign the full value
and not do an incremental update. Therefore, maintaining
env->first_IA_assignment is redundant. Interestingly, the old code
forgot to mark the tracking state as valid when first_IA_assignment was
true, resulting in an inefficiency (in the order of 0.8% of insns).
Also, when a tracked register already contains the value that it is
being assigned, there is not need to
(a) check whether that register requires precise memory exceptions and
(b) if so, assign the new value.
By definition, the register is up-to-date and reassigning the new value
which is also the old value is meaningless. No idea, what I was thinking
at the time.
Florian Krohm [Sat, 22 Dec 2012 15:01:04 +0000 (15:01 +0000)]
s390: Reduce the size of an s390_insn from 48 bytes to 32 bytes by
- adding one level of indirection for CDAS and DFP binops
- rearranging and tweaking the variant for helper calls
- using seperate insns kinds for signed and unsigned multiplication
and division.
Add an assert to make sure the size stays at 32 bytes.
Florian Krohm [Sat, 22 Dec 2012 02:28:25 +0000 (02:28 +0000)]
s390: Generalise S390_INSN_GADD which only worked on the guest
state to S390_INSN_MADD which works for any memory location
addressable with base reg + 20-bit displacement.
Florian Krohm [Fri, 21 Dec 2012 21:05:17 +0000 (21:05 +0000)]
s390: Distinguish between conversion to/from IRCmpFxxResult and
IRCmpDxxResult, even though the encodings are currently the same.
Rename convert_s390_fpcc_to_vex to convert_s390_to_vex_bfpcc.
Add convert_s390_to_vex_dfpcc and convert_vex_dfpcc_to_s390.
Florian Krohm [Fri, 21 Dec 2012 18:34:48 +0000 (18:34 +0000)]
Companion patch to VEX r2605. Adds a few testcases and adapts the vbit
tester. This is part of fixing BZ #307113.
Patch by Maran Pakkirisamy (maranp@linux.vnet.ibm.com).
Florian Krohm [Fri, 21 Dec 2012 17:32:12 +0000 (17:32 +0000)]
Add support for these DFP insns:
AXTRA, CDTR, CXTR, DXTRA, LDETR, LXDTR, LDXTR, LEDTR, LTXTR, MXTRA, SXTRA
This is part of fixing BZ #307113.
Patch by Maran Pakkirisamy (maranp@linux.vnet.ibm.com) with some minor
mods.
Petar Jovanovic [Thu, 20 Dec 2012 19:02:17 +0000 (19:02 +0000)]
Use different incorrect value in pth_detached3
The test pth_detached3 will crash on MIPS platform if the value passed to
pthread_detach is not correctly aligned. Thus, we change the value to be still
invalid but aligned.
This fixes the failure of drd/tests/pth_detached3 on MIPS32.
Petar Jovanovic [Thu, 20 Dec 2012 18:56:57 +0000 (18:56 +0000)]
Introduce DISABLE_PTHREAD_SPINLOCK_INTERCEPT flag
The flag DISABLE_PTHREAD_SPINLOCK_INTERCEPT is set only for MIPS32, and it is
used in DRD and Helgrind as a workaround for the issue #311690.
In short, pthread_spin_lock implementation has local branches to the start of
the function which interferes with the redirection system in Valgrind that
assumes it has to redirect each call/branch to a particular address.
Florian Krohm [Thu, 20 Dec 2012 16:58:52 +0000 (16:58 +0000)]
s390: Fix IR generation for DDTR and MDTR. These insns do not modify
the condition code.
Spotted and fixed by Maran Pakkirisamy (maranp@linux.vnet.ibm.com).
Julian Seward [Mon, 17 Dec 2012 21:56:58 +0000 (21:56 +0000)]
Instrumentation of guarded loads and stores: annotate helper calls
with the required IRDefault (guarded-dirty-call default return result
specifications).
Julian Seward [Mon, 17 Dec 2012 21:54:10 +0000 (21:54 +0000)]
IR: add the ability to specify the call-didn't-happen ("default")
return value for conditional dirty helper calls returning values. The
default value can be either all-zeroes or all-ones.
Florian Krohm [Sun, 16 Dec 2012 22:49:05 +0000 (22:49 +0000)]
Fix an assert in s390 disassembly. Eliminate a few magic array
width constants and use S390_MAX_MNEMONIC_LEN instead.
New function "mnemonic" to construct a mnemonic string padded with
blanks for alignment.