722 Commits

Author SHA1 Message Date
Julian Seward
0510a0bb1d This test should actually elicit a (false) warning from memcheck,
so the .stderr.exp should reflect that.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1379
2002-12-15 02:59:03 +00:00
Julian Seward
e73082b7f7 Also update this for new code manager.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1378
2002-12-15 02:51:21 +00:00
Julian Seward
51428efac5 Fix regression failure caused by different messages from new code
management stuff.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1377
2002-12-15 02:36:48 +00:00
Julian Seward
4e2c182834 Also diff the U (undefined) symbols.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1376
2002-12-15 02:05:02 +00:00
Julian Seward
277b0de249 Message cosmetics.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1375
2002-12-15 02:00:41 +00:00
Julian Seward
57904b2cb1 Change default state of the private-stacks optimisation to off, to be
on the conservative side.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1374
2002-12-15 01:56:17 +00:00
Julian Seward
8f0c7d1477 Remove comment line referring to old LRU stuff.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1373
2002-12-15 01:47:05 +00:00
Julian Seward
7c457ab003 whitespace change
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1372
2002-12-15 01:44:47 +00:00
Julian Seward
9bd3d362a5 Get rid of the --check-addrVs flag and everything to do with it.
It no longer makes much sense now we have a seperate addrcheck skin.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1371
2002-12-15 01:42:22 +00:00
Julian Seward
a8c2b4c7de Merge patch from JeremyF:
66-illegal-instr

When translation encounters an illegal instruction, emit a call to an
illegal instruction rather than giving up altogether. Some programs
check for CPU capabilities by actually trying them out, so we want to
match a dumb Pentium's behaviour a little better.

It still prints the message, so it won't hide actual illegal or
mis-parsed instructions.  I was hoping this might make the Nvidia
drivers realize they're running on a pre-MMX P5, but apparently they
just won't take that as an answer.  It does make the virtual CPU
behave a little more like a real CPU though.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1370
2002-12-14 23:59:09 +00:00
Julian Seward
9719de3342 Merge patch from JeremyF:
71-linux-2.5

There doesn't seem to be any problem supporting Linux 2.5 (and one
presumes 2.6 when it appears).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1369
2002-12-14 23:49:42 +00:00
Julian Seward
2340d0cc7f VG_(handle_esp_assignment): merge two conditional jumps into one on
common path.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1368
2002-12-14 23:18:06 +00:00
Julian Seward
fdba56f00f whitespace and __inline__ trivial changes
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1367
2002-12-14 23:11:35 +00:00
Julian Seward
f9d4a371e1 Merge patch from JeremyF:
75-simple-jle

Another pattern to test for Jle/Jnle. The observation is that EFLAGS
looks like this:

----O--+SZ------

with Z in bit 6, S in 7 and O in 11. Therefore RORL $7, %eflags will
result in:

Z------+-------+-------+---O---S

Since parity is only computed on the lower 8 bits, testing on P will
determine whether O==S, and since Z is in the MSB, it can be tested
with S.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1366
2002-12-12 23:54:47 +00:00
Julian Seward
32c4a39bae Tighten up assertion in VG_(target_forward).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1365
2002-12-12 23:50:22 +00:00
Julian Seward
9b619594c2 Merge patch from JeremyF:
72-jump

Add some codegen infrastructure to make it easier to generate local
jumps. If you want to generate a local backwards jump, use
VG_(init_target)(&tgt) to initialize the target descriptor, then
VG_(emit_target_back)(&tgt) just before emitting the target
instruction. Then, when emitting the delta for the jump, call
VG_(emit_delta)(&tgt).

Forward jumps are analogous, except that you call VG_(emit_delta)()
then VG_(emit_target_forward)().

The new emit function, VG_(emit_jcondshort_target)() takes a target
pointer rather than a delta.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1364
2002-12-12 23:42:48 +00:00
Julian Seward
b3f6f7bb83 Merge patch from JeremyF. This is a fixed version of the original
69-simple-jlo, which takes account of the fact that the P flag is set
only from the lowest 8 bits of the result, a problem causing the
original version of this patch not to work right.

Also fixes a call to new_emit.

69-simple-jlo

For Jlo and Jnlo, which test S == O or S != O, when generating special
test sequences which don't require the simulated flags in the real
flags, generate a test and parity test to see if both bits are equal
(even parity) or not equal (odd parity).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1363
2002-12-12 23:13:21 +00:00
Julian Seward
e0f01080d5 Merge (from 1_0_BRANCH) rev 1.16.2.4 of the old vg_cachesim.c:
Make file_err() not abort the current process; recover and keep
going instead.  This fixes a problem running OpenOffice on cachegrind.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1362
2002-12-11 00:45:42 +00:00
Julian Seward
baa63bdc6d Back out rev 1.27 since this seems to be causing mozilla-1.2.1 to loop
on memcheck on R H 6.2.  Don't know why.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1361
2002-12-10 23:44:17 +00:00
Julian Seward
c4f1a5ab3b VG_(saneUInstr): relax CCf so as to allow insns which read ZCP -- the
floating point conditional moves.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1360
2002-12-10 22:24:03 +00:00
Julian Seward
a9a9769680 Make it build on R H 6.2 (with egcs-2.91.66).
Jeremy, can you just cast your eye over this (sanity check) ?  Thx -- J


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1359
2002-12-09 23:32:58 +00:00
Julian Seward
d9557b868d synth_jcond_lit: Handle simd cases for CondO / CondNO.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1358
2002-12-09 22:44:00 +00:00
Julian Seward
54a2d8b7d5 Merge patch from JeremyF:
69-simple-jlo

For Jlo and Jnlo, which test S == O or S != O, when generating special
test sequences which don't require the simulated flags in the real
flags, generate a test and parity test to see if both bits are equal
(even parity) or not equal (odd parity).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1357
2002-12-09 19:20:00 +00:00
Julian Seward
e873eeb4a7 NULLify the destructor field when a thread key is deleted. This
allegedly fixes the following (haven't tested it myself):

valgrind: vg_scheduler.c:3454 (scheduler_sanity): Assertion
`vg_thread_keys[i].destructor == ((void *)0)' failed.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1356
2002-12-09 19:07:59 +00:00
Julian Seward
1c1de878a1 Implement (nop, but that's OK according to POSIX) pthread_set_concurrency.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1355
2002-12-08 23:51:32 +00:00
Julian Seward
a3feec4235 Implement (as a nop) pthread_rwlockattr_destroy.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1354
2002-12-08 23:42:17 +00:00
Julian Seward
2294e2af37 Clarify 65-fix-ldt (comment-only change).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1353
2002-12-08 23:27:21 +00:00
Julian Seward
0386474428 Fix for the following (line number for 1.0.X series):
valgrind: vg_scheduler.c:3446 (scheduler_sanity): Assertion
`vgPlain_kisemptysigset( & vgPlain_threads[i].sigs_waited_for)' failed.

Test case is:

#include <pthread.h>
#include <signal.h>
#include <stdio.h>
#include <unistd.h>

sigset_t intr;

void *
waiter (void *arg)
{
  int signum;
  printf ("Waiter started\n");

  sigwait (&intr, &signum);

  printf ("Waiter got signal %d (nothing will happen though)\n", signum);
  return 0;
}

int main ()
{
  pthread_t waiter_id;
  void *status;

  sigemptyset (&intr);
  sigaddset (&intr, SIGINT);
  pthread_sigmask (SIG_BLOCK, &intr, 0);

  printf ("Starting the sigwait thread\n");

  pthread_create (&waiter_id, 0, waiter, 0);

  sleep (2);
  printf ("Canceling the sigwait thread\n");

  pthread_cancel (waiter_id);
  pthread_join (waiter_id, &status);

  printf ("All done\n");
  return 0;
}


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1352
2002-12-08 23:24:18 +00:00
Julian Seward
685745d038 Get rid of the flag --fast-jcc; it's wired-on by default. Assumes that
pushf/popf is catastrophically expensive on most target CPUs, which is
certainly true for P3 and Athlon and I assume (but not checked) P4.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1351
2002-12-08 22:24:59 +00:00
Julian Seward
e44ce0f395 Merge patch from JeremyF:
67-dist

Fixes to various places Makefile.am to generate proper distributions.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1350
2002-12-08 22:19:04 +00:00
Julian Seward
7ebb2d05b5 Merge patch from JeremyF:
55-ac-clientreq

ADDRCHECK: implement some client requests


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1349
2002-12-08 22:16:58 +00:00
Julian Seward
4fdd3defd4 Merge patch from JeremyF:
65-fix-ldt

Fix LDT handling in threaded programs. do__apply_in_new_thread() was
failing to set up the child thread's LDT inherited from the parent,
and was triggering an assert in VG_(save_thread_state)() when trying
to copy the parent's thread state to the child.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1348
2002-12-08 22:14:11 +00:00
Julian Seward
6562f9ae23 Re-add the NP case in synth_jcond_lit.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1347
2002-12-08 19:50:36 +00:00
Julian Seward
9903164536 Merge patches from JeremyF, to do lazy eflags updating:
- D flag is seperated from the rest (OSZCAP)

- Minimise transfers between real and simulated %eflags since these
  are very expensive.

61-special-d

Make the D flag special. Store it separately in the baseblock rather
than in EFLAGs. This is because it is used almost completely unlike
the other flags, and mashing them together just makes maintaining
eflags hard.

62-lazy-eflags

Implements lazy eflags save and restore. Helps a lot.

Hopefully more documentation to follow.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1346
2002-12-08 18:20:01 +00:00
Nicholas Nethercote
983cd1a2d6 Added the new 'detail' details_avg_translation_sizeB which was missing. It now
works again.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1345
2002-12-04 15:31:36 +00:00
Julian Seward
29d68f3caa VG_(switch_to_real_CPU): Apparently we can't reload the %cs register
in untrusted mode.  Strange.  I thought I fixed this a couple of
months back.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1344
2002-12-03 00:38:59 +00:00
Julian Seward
a162e85544 Change the way INCEIP is done. Instead of emitting add insns, keep
track of the current %EIP value and write it to memory at an INCEIP.
Uses JeremyF's idea of only writing the lowest 8 bits if the upper 24
are unchanged since the previous write.  [might this cause probls
to do with write combining on high-performance CPUs?  To be checked
out.]

On a simple program running a small inner loop, this gets about 2/3
the benefits of removing INCEIPs altogether, compared with the add-insn
scheme.

I tried a much more complex scheme too, in which we do analysis to
remove as many INCEIPs as possible if it is possible to show that
there will be no EIP reads in between them.  This seemed to make
almost no improvement on real programs (kate, xedit) and adds some
code and slows down the code generator, so I don't think it's worth
the hassle.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1343
2002-12-01 19:40:49 +00:00
Julian Seward
9545356102 Merge patch (bug fix) from Jeremy F:
59-fix-readv-writev

Fix error returns for readv and writev (and select).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1342
2002-12-01 10:25:53 +00:00
Julian Seward
ca2f7bac2a Take into account TCEntry and alignment overheads when calculating TC
sector sizes.  Also, recalibrate all skins against mozilla-1.0.1.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1341
2002-12-01 02:55:46 +00:00
Julian Seward
21e9daa5d6 Merge patch from JeremyF:
56-chained-accounting

Fix accounting for chained blocks, by only counting real unchain
events, rather than the unchains used to establish the initial call to
VG_(patch_me) at the jump site.

Also a minor cleanup of the jump delta calculation in synth_jcond_lit.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1340
2002-12-01 02:07:08 +00:00
Julian Seward
bf0d5036da Merge patch from JeremyF:
50-fast-cond

Implement Julian's idea for fast conditional jumps. Rather than fully
restoring the eflags register with an expensive push-popf pair, just
test the flag bits directly out of the base block. Faster, and smaller
code too!


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1339
2002-11-30 15:01:01 +00:00
Julian Seward
ae37920280 Comment out unused function.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1338
2002-11-30 14:04:45 +00:00
Julian Seward
f7a957606f Merge patch from Jeremy F:
46-fix-writeable_or_erring-proto

Prototype fix for wait_for_fd_to_be_writable_or_erring(). (bugfix for
43-nonblock-readwritev)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1337
2002-11-30 14:02:53 +00:00
Julian Seward
dd1838f1f5 Merge in a somewhat modified patch version of Jeremy Fitzhardinge's
translation chaining patch.

47-chained-bb

This implements basic-block chaining. Rather than always going through
the dispatch loop, a BB may jump directly to a successor BB if it is
present in the translation cache.

When the BB's code is first generated, the jumps to the successor BBs
are filled with undefined instructions. When the BB is inserted into
the translation cache, the undefined instructions are replaced with a
call to VG_(patch_me). When VG_(patch_me) is called, it looks up the
desired target address in the fast translation cache. If present, it
backpatches the call to patch_me with a jump to the translated target
BB. If the fast lookup fails, it falls back into the normal dispatch
loop.

When the parts of the translation cache are discarded, all translations
are unchained, so as to ensure we don't have direct jumps to code which
has been thrown away.

This optimisation only has effect on direct jumps; indirect jumps
(including returns) still go through the dispatch loop.  The -v stats
indicate a worst-case rate of about 16% of jumps having to go via the
slow mechanism.  This will be a combination of function returns and
genuine indirect jumps.

Certain parts of the dispatch loop's actions have to be moved into
each basic block; namely: updating the virtual EIP and keeping track
of the basic block counter.

At present, basic block chaining seems to improve performance by up to
25% with --skin=none.  Gains for skins adding more instrumentation
will be correspondingly smaller.

There is a command line option: --chain-bb=yes|no (defaults to yes).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1336
2002-11-30 14:00:47 +00:00
Julian Seward
1115a9090c Merge patch from JeremyF (with a little added paranoia, for this one
could potentially cause hard-to-find code generation bugs):

00-lazy-fp

This patch implements lazy FPU state save and restore, which improves
the performance of FPU-intensive code by a factor of 15 or so.  [when
running without any instrumentatation, that is.]


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1335
2002-11-30 12:35:42 +00:00
Julian Seward
31fb0482e7 Complete integration of the new code management (sectored FIFO) story.
This commit adds stats gathering / printing (use -v -v), and selection
of sector size decided by asking skins, via
VG_(details).avg_translation_sizeB, the average size of their
translations.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1334
2002-11-30 00:49:43 +00:00
Julian Seward
205244f4f1 Complete overhaul of the storage of translations to properly support
translation chaining.  The old LRU system has gone, since it required
marking each translation each time it was used -- simulating a
reference bit.  This is unacceptably expensive.

New scheme uses FIFO discard.  TC is split into a variable number
(currently 8) parts.  When all 8 parts are full, the oldest is
discarded and reused for allocation.  This somewhat guards against
discarding recently-made translations and performs well in practice.

TT entries are simplified: the orig and trans size fields are now
stored in the TC, not in the TT.  The TC entries are "self
describing", so it is possible to scan forwards through the TC entries
and rebuild the TT from them.  TC entries are now word-aligned.

VG_(tt_fast) entries now point to TC entries, not TT entries.

The main dispatch loop now is 2 insns shorter since there's no need to
mark the current epoch on each TT entry as it is used.  For that
matter, there's no longer any need for the notion of a current epoch
anyway.

It's all a great deal simpler than the old scheme, and it seems
significantly faster too.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1333
2002-11-29 01:02:45 +00:00
Nicholas Nethercote
6131b25bd2 Fixed up for core/skin interface change.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1332
2002-11-22 16:10:55 +00:00
Nicholas Nethercote
5531ce45d2 Moved setting of err->where outside the if/else; it was redundant because the
same test is done with VG_(get_ExeContext2)().


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1331
2002-11-21 13:38:08 +00:00
Julian Seward
69ca0cb5c3 A small tool to help documentation writers. Copies docs out of an
installation tree (`pwd`/Inst) back to the build tree since it is a
lot easier to edit them in the installation tree.  Use with care!


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1330
2002-11-20 08:17:16 +00:00