You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(122) |
Nov
(152) |
Dec
(69) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(6) |
Feb
(25) |
Mar
(73) |
Apr
(82) |
May
(24) |
Jun
(25) |
Jul
(10) |
Aug
(11) |
Sep
(10) |
Oct
(54) |
Nov
(203) |
Dec
(182) |
| 2004 |
Jan
(307) |
Feb
(305) |
Mar
(430) |
Apr
(312) |
May
(187) |
Jun
(342) |
Jul
(487) |
Aug
(637) |
Sep
(336) |
Oct
(373) |
Nov
(441) |
Dec
(210) |
| 2005 |
Jan
(385) |
Feb
(480) |
Mar
(636) |
Apr
(544) |
May
(679) |
Jun
(625) |
Jul
(810) |
Aug
(838) |
Sep
(634) |
Oct
(521) |
Nov
(965) |
Dec
(543) |
| 2006 |
Jan
(494) |
Feb
(431) |
Mar
(546) |
Apr
(411) |
May
(406) |
Jun
(322) |
Jul
(256) |
Aug
(401) |
Sep
(345) |
Oct
(542) |
Nov
(308) |
Dec
(481) |
| 2007 |
Jan
(427) |
Feb
(326) |
Mar
(367) |
Apr
(255) |
May
(244) |
Jun
(204) |
Jul
(223) |
Aug
(231) |
Sep
(354) |
Oct
(374) |
Nov
(497) |
Dec
(362) |
| 2008 |
Jan
(322) |
Feb
(482) |
Mar
(658) |
Apr
(422) |
May
(476) |
Jun
(396) |
Jul
(455) |
Aug
(267) |
Sep
(280) |
Oct
(253) |
Nov
(232) |
Dec
(304) |
| 2009 |
Jan
(486) |
Feb
(470) |
Mar
(458) |
Apr
(423) |
May
(696) |
Jun
(461) |
Jul
(551) |
Aug
(575) |
Sep
(134) |
Oct
(110) |
Nov
(157) |
Dec
(102) |
| 2010 |
Jan
(226) |
Feb
(86) |
Mar
(147) |
Apr
(117) |
May
(107) |
Jun
(203) |
Jul
(193) |
Aug
(238) |
Sep
(300) |
Oct
(246) |
Nov
(23) |
Dec
(75) |
| 2011 |
Jan
(133) |
Feb
(195) |
Mar
(315) |
Apr
(200) |
May
(267) |
Jun
(293) |
Jul
(353) |
Aug
(237) |
Sep
(278) |
Oct
(611) |
Nov
(274) |
Dec
(260) |
| 2012 |
Jan
(303) |
Feb
(391) |
Mar
(417) |
Apr
(441) |
May
(488) |
Jun
(655) |
Jul
(590) |
Aug
(610) |
Sep
(526) |
Oct
(478) |
Nov
(359) |
Dec
(372) |
| 2013 |
Jan
(467) |
Feb
(226) |
Mar
(391) |
Apr
(281) |
May
(299) |
Jun
(252) |
Jul
(311) |
Aug
(352) |
Sep
(481) |
Oct
(571) |
Nov
(222) |
Dec
(231) |
| 2014 |
Jan
(185) |
Feb
(329) |
Mar
(245) |
Apr
(238) |
May
(281) |
Jun
(399) |
Jul
(382) |
Aug
(500) |
Sep
(579) |
Oct
(435) |
Nov
(487) |
Dec
(256) |
| 2015 |
Jan
(338) |
Feb
(357) |
Mar
(330) |
Apr
(294) |
May
(191) |
Jun
(108) |
Jul
(142) |
Aug
(261) |
Sep
(190) |
Oct
(54) |
Nov
(83) |
Dec
(22) |
| 2016 |
Jan
(49) |
Feb
(89) |
Mar
(33) |
Apr
(50) |
May
(27) |
Jun
(34) |
Jul
(53) |
Aug
(53) |
Sep
(98) |
Oct
(206) |
Nov
(93) |
Dec
(53) |
| 2017 |
Jan
(65) |
Feb
(82) |
Mar
(102) |
Apr
(86) |
May
(187) |
Jun
(67) |
Jul
(23) |
Aug
(93) |
Sep
(65) |
Oct
(45) |
Nov
(35) |
Dec
(17) |
| 2018 |
Jan
(26) |
Feb
(35) |
Mar
(38) |
Apr
(32) |
May
(8) |
Jun
(43) |
Jul
(27) |
Aug
(30) |
Sep
(43) |
Oct
(42) |
Nov
(38) |
Dec
(67) |
| 2019 |
Jan
(32) |
Feb
(37) |
Mar
(53) |
Apr
(64) |
May
(49) |
Jun
(18) |
Jul
(14) |
Aug
(53) |
Sep
(25) |
Oct
(30) |
Nov
(49) |
Dec
(31) |
| 2020 |
Jan
(87) |
Feb
(45) |
Mar
(37) |
Apr
(51) |
May
(99) |
Jun
(36) |
Jul
(11) |
Aug
(14) |
Sep
(20) |
Oct
(24) |
Nov
(40) |
Dec
(23) |
| 2021 |
Jan
(14) |
Feb
(53) |
Mar
(85) |
Apr
(15) |
May
(19) |
Jun
(3) |
Jul
(14) |
Aug
(1) |
Sep
(57) |
Oct
(73) |
Nov
(56) |
Dec
(22) |
| 2022 |
Jan
(3) |
Feb
(22) |
Mar
(6) |
Apr
(55) |
May
(46) |
Jun
(39) |
Jul
(15) |
Aug
(9) |
Sep
(11) |
Oct
(34) |
Nov
(20) |
Dec
(36) |
| 2023 |
Jan
(79) |
Feb
(41) |
Mar
(99) |
Apr
(169) |
May
(48) |
Jun
(16) |
Jul
(16) |
Aug
(57) |
Sep
(19) |
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
|
|
|
|
1
(21) |
|
2
(19) |
3
(33) |
4
(24) |
5
(18) |
6
(13) |
7
(22) |
8
(21) |
|
9
(38) |
10
(25) |
11
(20) |
12
(27) |
13
(43) |
14
(9) |
15
(19) |
|
16
(37) |
17
(19) |
18
(13) |
19
(11) |
20
(8) |
21
(11) |
22
(25) |
|
23
(21) |
24
(30) |
25
(18) |
26
(11) |
27
(10) |
28
(14) |
29
(40) |
|
30
(24) |
31
(14) |
|
|
|
|
|
|
From: <sv...@va...> - 2008-03-24 19:38:51
|
Author: bart
Date: 2008-03-24 19:38:57 +0000 (Mon, 24 Mar 2008)
New Revision: 7786
Log:
More expected output updates.
Modified:
trunk/exp-drd/tests/tc20_verifywrap2.stderr.exp-glibc2.3
Modified: trunk/exp-drd/tests/tc20_verifywrap2.stderr.exp-glibc2.3
===================================================================
--- trunk/exp-drd/tests/tc20_verifywrap2.stderr.exp-glibc2.3 2008-03-24 19:38:14 UTC (rev 7785)
+++ trunk/exp-drd/tests/tc20_verifywrap2.stderr.exp-glibc2.3 2008-03-24 19:38:57 UTC (rev 7786)
@@ -18,7 +18,7 @@
[1/1] mutex_init invalid mutex 0x........
-Not a mutex
+The object at address 0x........ is not a mutex.
at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:92)
[1/1] mutex_init mutex 0x........
@@ -34,19 +34,19 @@
[1/1] pre_mutex_lock invalid mutex 0x........ rc 0 owner 0
-Not a mutex
+The object at address 0x........ is not a mutex.
at 0x........: pthread_mutex_trylock (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:116)
[1/1] post_mutex_lock invalid mutex 0x........ rc 0 owner 0
[1/1] pre_mutex_lock invalid mutex 0x........ rc 0 owner 0
-Not a mutex
+The object at address 0x........ is not a mutex.
at 0x........: pthread_mutex_timedlock (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:121)
[1/1] post_mutex_lock invalid mutex 0x........ rc 0 owner 0
[1/1] mutex_unlock invalid mutex 0x........ rc 0
-Not a mutex
+The object at address 0x........ is not a mutex.
at 0x........: pthread_mutex_unlock (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:125)
|
|
From: <sv...@va...> - 2008-03-24 19:38:12
|
Author: bart
Date: 2008-03-24 19:38:14 +0000 (Mon, 24 Mar 2008)
New Revision: 7785
Log:
Removed make -s install.
Modified:
trunk/exp-drd/Testing.txt
Modified: trunk/exp-drd/Testing.txt
===================================================================
--- trunk/exp-drd/Testing.txt 2008-03-24 19:37:42 UTC (rev 7784)
+++ trunk/exp-drd/Testing.txt 2008-03-24 19:38:14 UTC (rev 7785)
@@ -62,5 +62,4 @@
${SRC}/configure
make -s || exit $?
-make -s install || exit $?
------------------------------------------------------------
|
|
From: <sv...@va...> - 2008-03-24 19:37:38
|
Author: bart
Date: 2008-03-24 19:37:42 +0000 (Mon, 24 Mar 2008)
New Revision: 7784
Log:
Updated expected output.
Modified:
trunk/exp-drd/tests/tc20_verifywrap.stderr.exp
trunk/exp-drd/tests/tc20_verifywrap2.stderr.exp
Modified: trunk/exp-drd/tests/tc20_verifywrap.stderr.exp
===================================================================
--- trunk/exp-drd/tests/tc20_verifywrap.stderr.exp 2008-03-24 19:31:33 UTC (rev 7783)
+++ trunk/exp-drd/tests/tc20_verifywrap.stderr.exp 2008-03-24 19:37:42 UTC (rev 7784)
@@ -17,7 +17,7 @@
---------------- pthread_mutex_lock et al ----------------
-Not a mutex: mutex 0x.........
+The object at address 0x........ is not a mutex.
at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:92)
@@ -25,19 +25,19 @@
at 0x........: pthread_mutex_destroy (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:102)
-Not a mutex: mutex 0x.........
+The object at address 0x........ is not a mutex.
at 0x........: pthread_mutex_lock (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:108)
-Not a mutex: mutex 0x.........
+The object at address 0x........ is not a mutex.
at 0x........: pthread_mutex_trylock (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:116)
-Not a mutex: mutex 0x.........
+The object at address 0x........ is not a mutex.
at 0x........: pthread_mutex_timedlock (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:121)
-Not a mutex: mutex 0x.........
+The object at address 0x........ is not a mutex.
at 0x........: pthread_mutex_unlock (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:125)
Modified: trunk/exp-drd/tests/tc20_verifywrap2.stderr.exp
===================================================================
--- trunk/exp-drd/tests/tc20_verifywrap2.stderr.exp 2008-03-24 19:31:33 UTC (rev 7783)
+++ trunk/exp-drd/tests/tc20_verifywrap2.stderr.exp 2008-03-24 19:37:42 UTC (rev 7784)
@@ -18,7 +18,7 @@
[1/1] mutex_init invalid mutex 0x........
-Not a mutex: mutex 0x.........
+The object at address 0x........ is not a mutex.
at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:92)
[1/1] mutex_init mutex 0x........
@@ -31,25 +31,25 @@
by 0x........: main (tc20_verifywrap.c:102)
[1/1] pre_mutex_lock invalid mutex 0x........ rc 0 owner 0
-Not a mutex: mutex 0x.........
+The object at address 0x........ is not a mutex.
at 0x........: pthread_mutex_lock (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:108)
[1/1] post_mutex_lock invalid mutex 0x........ rc 0 owner 0
[1/1] pre_mutex_lock invalid mutex 0x........ rc 0 owner 0
-Not a mutex: mutex 0x.........
+The object at address 0x........ is not a mutex.
at 0x........: pthread_mutex_trylock (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:116)
[1/1] post_mutex_lock invalid mutex 0x........ rc 0 owner 0
[1/1] pre_mutex_lock invalid mutex 0x........ rc 0 owner 0
-Not a mutex: mutex 0x.........
+The object at address 0x........ is not a mutex.
at 0x........: pthread_mutex_timedlock (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:121)
[1/1] post_mutex_lock invalid mutex 0x........ rc 0 owner 0
[1/1] mutex_unlock invalid mutex 0x........ rc 0
-Not a mutex: mutex 0x.........
+The object at address 0x........ is not a mutex.
at 0x........: pthread_mutex_unlock (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:125)
|
|
From: Sergei T. <sl...@in...> - 2008-03-24 19:34:46
|
Hello! I extensively use valgrind --tool=memcheck. And once upon a time I've got long running program merely consuming memory (just leaky), so valgrind dies of OOM. I've tried to insert VALGRIND_DO_LEAK_CHECK into program's main loop, but eventually got false positive `definetly lost' blocks in this place (there's no memleaks when program normally stops in valgrind's report). The question is: Does VALGRIND_DO_LEAK_CHECK work in ANY cases and I should model this situation and report a bug, or there is yet some cases memcheck can't handle? Thanks! |
|
From: <sv...@va...> - 2008-03-24 19:31:31
|
Author: bart
Date: 2008-03-24 19:31:33 +0000 (Mon, 24 Mar 2008)
New Revision: 7783
Log:
Modified error message that is printed when a mutex operation is attempted on an object that is not a mutex.
Modified:
trunk/exp-drd/drd_error.c
trunk/exp-drd/tests/tc09_bad_unlock.stderr.exp
trunk/exp-drd/tests/tc20_verifywrap.stderr.exp-glibc2.3
trunk/exp-drd/tests/tc20_verifywrap2.stderr.exp-glibc2.3-b
trunk/exp-drd/tests/tc23_bogus_condwait.stderr.exp
Modified: trunk/exp-drd/drd_error.c
===================================================================
--- trunk/exp-drd/drd_error.c 2008-03-24 19:12:12 UTC (rev 7782)
+++ trunk/exp-drd/drd_error.c 2008-03-24 19:31:33 UTC (rev 7783)
@@ -145,8 +145,7 @@
else
{
VG_(message)(Vg_UserMsg,
- "%s: mutex 0x%lx.",
- VG_(get_error_string)(e),
+ "The object at address 0x%lx is not a mutex.",
p->mutex);
}
VG_(pp_ExeContext)(VG_(get_error_where)(e));
Modified: trunk/exp-drd/tests/tc09_bad_unlock.stderr.exp
===================================================================
--- trunk/exp-drd/tests/tc09_bad_unlock.stderr.exp 2008-03-24 19:12:12 UTC (rev 7782)
+++ trunk/exp-drd/tests/tc09_bad_unlock.stderr.exp 2008-03-24 19:31:33 UTC (rev 7783)
@@ -13,7 +13,7 @@
by 0x........: clone (in /...libc...)
Thread 1:
-Not a mutex: mutex 0x.........
+The object at address 0x........ is not a mutex.
at 0x........: pthread_mutex_unlock (drd_pthread_intercepts.c:?)
by 0x........: nearly_main (tc09_bad_unlock.c:41)
by 0x........: main (tc09_bad_unlock.c:49)
@@ -36,7 +36,7 @@
by 0x........: clone (in /...libc...)
Thread 1:
-Not a mutex: mutex 0x.........
+The object at address 0x........ is not a mutex.
at 0x........: pthread_mutex_unlock (drd_pthread_intercepts.c:?)
by 0x........: nearly_main (tc09_bad_unlock.c:41)
by 0x........: main (tc09_bad_unlock.c:50)
Modified: trunk/exp-drd/tests/tc20_verifywrap.stderr.exp-glibc2.3
===================================================================
--- trunk/exp-drd/tests/tc20_verifywrap.stderr.exp-glibc2.3 2008-03-24 19:12:12 UTC (rev 7782)
+++ trunk/exp-drd/tests/tc20_verifywrap.stderr.exp-glibc2.3 2008-03-24 19:31:33 UTC (rev 7783)
@@ -17,7 +17,7 @@
---------------- pthread_mutex_lock et al ----------------
-Not a mutex
+The object at address 0x........ is not a mutex.
at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:92)
@@ -28,15 +28,15 @@
make pthread_mutex_lock fail: skipped on glibc < 2.4
-Not a mutex
+The object at address 0x........ is not a mutex.
at 0x........: pthread_mutex_trylock (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:116)
-Not a mutex
+The object at address 0x........ is not a mutex.
at 0x........: pthread_mutex_timedlock (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:121)
-Not a mutex
+The object at address 0x........ is not a mutex.
at 0x........: pthread_mutex_unlock (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:125)
Modified: trunk/exp-drd/tests/tc20_verifywrap2.stderr.exp-glibc2.3-b
===================================================================
--- trunk/exp-drd/tests/tc20_verifywrap2.stderr.exp-glibc2.3-b 2008-03-24 19:12:12 UTC (rev 7782)
+++ trunk/exp-drd/tests/tc20_verifywrap2.stderr.exp-glibc2.3-b 2008-03-24 19:31:33 UTC (rev 7783)
@@ -18,7 +18,7 @@
[1/1] mutex_init invalid mutex 0x........
-Not a mutex
+The object at address 0x........ is not a mutex.
at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:92)
[1/1] mutex_init mutex 0x........
@@ -34,19 +34,19 @@
[1/1] pre_mutex_lock invalid mutex 0x........ rc 0 owner 0
-Not a mutex
+The object at address 0x........ is not a mutex.
at 0x........: pthread_mutex_trylock (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:116)
[1/1] post_mutex_lock invalid mutex 0x........ rc 0 owner 0
[1/1] pre_mutex_lock invalid mutex 0x........ rc 0 owner 0
-Not a mutex
+The object at address 0x........ is not a mutex.
at 0x........: pthread_mutex_timedlock (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:121)
[1/1] post_mutex_lock invalid mutex 0x........ rc 0 owner 0
[1/1] mutex_unlock invalid mutex 0x........ rc 0
-Not a mutex
+The object at address 0x........ is not a mutex.
at 0x........: pthread_mutex_unlock (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:125)
Modified: trunk/exp-drd/tests/tc23_bogus_condwait.stderr.exp
===================================================================
--- trunk/exp-drd/tests/tc23_bogus_condwait.stderr.exp 2008-03-24 19:12:12 UTC (rev 7782)
+++ trunk/exp-drd/tests/tc23_bogus_condwait.stderr.exp 2008-03-24 19:31:33 UTC (rev 7783)
@@ -1,5 +1,5 @@
-Not a mutex: mutex 0x.........
+The object at address 0x........ is not a mutex.
at 0x........: pthread_cond_wait* (drd_pthread_intercepts.c:?)
by 0x........: main (tc23_bogus_condwait.c:69)
@@ -7,7 +7,7 @@
at 0x........: pthread_cond_wait* (drd_pthread_intercepts.c:?)
by 0x........: main (tc23_bogus_condwait.c:72)
-Not a mutex: mutex 0x.........
+The object at address 0x........ is not a mutex.
at 0x........: pthread_cond_wait* (drd_pthread_intercepts.c:?)
by 0x........: main (tc23_bogus_condwait.c:75)
|
|
From: Bart V. A. <bar...@gm...> - 2008-03-24 19:16:45
|
Please ignore the proposal below -- shortly after I wrote down this proposal, I found a way to implement the desired functionality without changing the core. Bart. On Mon, Mar 24, 2008 at 7:56 PM, Bart Van Assche <bar...@gm...> wrote: > Hello, > > VG_(OSetGen_Create)() has four arguments, where the last two are > pointers to an allocation and a deallocation function. These last two > functions are not only used to allocate and deallocate tree nodes, but > also for allocating and deallocating the OSet itself. I'd like to > build an OSet with tree nodes that store a pointer to a > reference-counted bitmap, with a deallocation function that does not > only deallocate the node memory but also decrements the reference > count. It would be inelegant to make the allocation and deallocation > functions try to figure out what kind of item (node or OSet) they are > allocating or deallocating. One solution it to change the OSet > implementation such that it always uses VG_(malloc) / VG_(free) for > the OSet, another solution is to add an extra OSet creation function > that accepts six arguments instead of four (where the two extra > arguments are pointers to the allocation and deallocation function for > the OSet itself). |
|
From: <sv...@va...> - 2008-03-24 19:12:07
|
Author: bart
Date: 2008-03-24 19:12:12 +0000 (Mon, 24 Mar 2008)
New Revision: 7782
Log:
Merged revisions r7758:7781 from branch DRDDEV to trunk.
Modified:
trunk/exp-drd/drd_bitmap.c
trunk/exp-drd/drd_bitmap.h
Modified: trunk/exp-drd/drd_bitmap.c
===================================================================
--- trunk/exp-drd/drd_bitmap.c 2008-03-24 19:05:36 UTC (rev 7781)
+++ trunk/exp-drd/drd_bitmap.c 2008-03-24 19:12:12 UTC (rev 7782)
@@ -36,19 +36,24 @@
#include "drd_suppression.h"
-// Local constants.
+/* Forward declarations. */
-static ULong s_bitmap_creation_count;
+struct bitmap2;
-// Local function declarations.
+/* Local function declarations. */
static void bm2_merge(struct bitmap2* const bm2l,
const struct bitmap2* const bm2r);
-// Function definitions.
+/* Local constants. */
+static ULong s_bitmap_creation_count;
+
+
+/* Function definitions. */
+
struct bitmap* bm_new()
{
unsigned i;
@@ -65,7 +70,7 @@
bm->cache[i].a1 = 0;
bm->cache[i].bm2 = 0;
}
- bm->oset = VG_(OSetGen_Create)(0, 0, VG_(malloc), VG_(free));
+ bm->oset = VG_(OSetGen_Create)(0, 0, VG_(malloc), VG_(free));
s_bitmap_creation_count++;
@@ -74,7 +79,22 @@
void bm_delete(struct bitmap* const bm)
{
+ struct bitmap2* bm2;
+ struct bitmap2ref* bm2ref;
+
tl_assert(bm);
+
+ VG_(OSetGen_ResetIter)(bm->oset);
+ for ( ; (bm2ref = VG_(OSetGen_Next)(bm->oset)) != 0; )
+ {
+ bm2 = bm2ref->bm2;
+ tl_assert(bm2->refcnt >= 1);
+ if (--bm2->refcnt == 0)
+ {
+ VG_(free)(bm2);
+ }
+ }
+
VG_(OSetGen_Destroy)(bm->oset);
VG_(free)(bm);
}
@@ -106,7 +126,7 @@
b_next = a2;
}
- bm2 = bm2_lookup_or_insert(bm, b1);
+ bm2 = bm2_lookup_or_insert_exclusive(bm, b1);
tl_assert(bm2);
if ((bm2->addr << ADDR0_BITS) < a1)
@@ -149,7 +169,7 @@
{
struct bitmap2* bm2;
- bm2 = bm2_lookup_or_insert(bm, a1 >> ADDR0_BITS);
+ bm2 = bm2_lookup_or_insert_exclusive(bm, a1 >> ADDR0_BITS);
bm0_set_range(bm2->bm1.bm0_r, a1 & ADDR0_MASK, size);
}
@@ -159,7 +179,7 @@
{
struct bitmap2* bm2;
- bm2 = bm2_lookup_or_insert(bm, a1 >> ADDR0_BITS);
+ bm2 = bm2_lookup_or_insert_exclusive(bm, a1 >> ADDR0_BITS);
bm0_set_range(bm2->bm1.bm0_w, a1 & ADDR0_MASK, size);
}
@@ -287,7 +307,7 @@
for (b = a1; b < a2; b = b_next)
{
- struct bitmap2* bm2 = bm2_lookup(bm, b >> ADDR0_BITS);
+ const struct bitmap2* bm2 = bm2_lookup(bm, b >> ADDR0_BITS);
b_next = (b & ~ADDR0_MASK) + ADDR0_COUNT;
if (b_next > a2)
@@ -342,9 +362,9 @@
const Addr a,
const BmAccessTypeT access_type)
{
- struct bitmap2* p2;
- struct bitmap1* p1;
- UWord* p0;
+ const struct bitmap2* p2;
+ const struct bitmap1* p1;
+ const UWord* p0;
const UWord a0 = a & ADDR0_MASK;
tl_assert(bm);
@@ -384,12 +404,16 @@
void bm_clear_all(const struct bitmap* const bm)
{
struct bitmap2* bm2;
+ struct bitmap2ref* bm2ref;
VG_(OSetGen_ResetIter)(bm->oset);
- for ( ; (bm2 = VG_(OSetGen_Next)(bm->oset)) != 0; )
+ for ( ; (bm2ref = VG_(OSetGen_Next)(bm->oset)) != 0; )
{
- struct bitmap1* const bm1 = &bm2->bm1;
+ struct bitmap1* bm1;
+
+ bm2 = bm2ref->bm2;
+ bm1 = &bm2->bm1;
tl_assert(bm1);
VG_(memset)(&bm1->bm0_r[0], 0, sizeof(bm1->bm0_r));
VG_(memset)(&bm1->bm0_w[0], 0, sizeof(bm1->bm0_w));
@@ -408,7 +432,7 @@
for (b = a1; b < a2; b = b_next)
{
- struct bitmap2* const p2 = bm2_lookup(bm, b >> ADDR0_BITS);
+ struct bitmap2* const p2 = bm2_lookup_exclusive(bm, b >> ADDR0_BITS);
b_next = (b & ~ADDR0_MASK) + ADDR0_COUNT;
if (b_next > a2)
@@ -419,6 +443,9 @@
if (p2)
{
Addr c = b;
+ /* If the first address in the bitmap that must be cleared does not */
+ /* start on an UWord boundary, start clearing the first addresses */
+ /* by calling bm1_clear(). */
if (UWORD_LSB(c))
{
Addr c_next = UWORD_MSB(c) + BITS_PER_UWORD;
@@ -427,6 +454,7 @@
bm1_clear(&p2->bm1, c, c_next);
c = c_next;
}
+ /* If some UWords have to be cleared entirely, do this now. */
if (UWORD_LSB(c) == 0)
{
const Addr c_next = UWORD_MSB(b_next);
@@ -442,6 +470,9 @@
c = c_next;
}
}
+ /* If the last address in the bitmap that must be cleared does not */
+ /* fall on an UWord boundary, clear the last addresses by calling */
+ /* bm1_clear(). */
if (c != b_next)
{
bm1_clear(&p2->bm1, c, b_next);
@@ -460,7 +491,7 @@
for (b = a1; b < a2; b = b_next)
{
- struct bitmap2* bm2 = bm2_lookup(bm, b >> ADDR0_BITS);
+ const struct bitmap2* bm2 = bm2_lookup(bm, b >> ADDR0_BITS);
b_next = (b & ~ADDR0_MASK) + ADDR0_COUNT;
if (b_next > a2)
@@ -520,7 +551,7 @@
Bool bm_aligned_load_has_conflict_with(const struct bitmap* const bm,
const Addr a1, const SizeT size)
{
- struct bitmap2* bm2;
+ const struct bitmap2* bm2;
bm2 = bm2_lookup(bm, a1 >> ADDR0_BITS);
@@ -531,7 +562,7 @@
Bool bm_aligned_store_has_conflict_with(const struct bitmap* const bm,
const Addr a1, const SizeT size)
{
- struct bitmap2* bm2;
+ const struct bitmap2* bm2;
bm2 = bm2_lookup(bm, a1 >> ADDR0_BITS);
@@ -623,32 +654,35 @@
bm2->oset = tmp;
}
+/** Merge bitmaps *lhs and *rhs into *lhs. */
void bm_merge2(struct bitmap* const lhs,
const struct bitmap* const rhs)
{
struct bitmap2* bm2l;
- const struct bitmap2* bm2r;
+ struct bitmap2ref* bm2l_ref;
+ struct bitmap2* bm2r;
+ const struct bitmap2ref* bm2r_ref;
- // First step: allocate any missing bitmaps in *lhs.
VG_(OSetGen_ResetIter)(rhs->oset);
- for ( ; (bm2r = VG_(OSetGen_Next)(rhs->oset)) != 0; )
- {
- bm2_lookup_or_insert(lhs, bm2r->addr);
- }
- VG_(OSetGen_ResetIter)(lhs->oset);
- VG_(OSetGen_ResetIter)(rhs->oset);
-
- for ( ; (bm2r = VG_(OSetGen_Next)(rhs->oset)) != 0; )
+ for ( ; (bm2r_ref = VG_(OSetGen_Next)(rhs->oset)) != 0; )
{
- do
+ bm2r = bm2r_ref->bm2;
+ bm2l_ref = VG_(OSetGen_Lookup)(lhs->oset, &bm2r->addr);
+ if (bm2l_ref)
{
- bm2l = VG_(OSetGen_Next)(lhs->oset);
- } while (bm2l->addr < bm2r->addr);
-
- tl_assert(bm2l->addr == bm2r->addr);
-
- bm2_merge(bm2l, bm2r);
+ bm2l = bm2l_ref->bm2;
+ if (bm2l != bm2r)
+ {
+ if (bm2l->refcnt > 1)
+ bm2l = bm2_make_exclusive(lhs, bm2l_ref);
+ bm2_merge(bm2l, bm2r);
+ }
+ }
+ else
+ {
+ bm2_insert_addref(lhs, bm2r);
+ }
}
}
@@ -666,18 +700,24 @@
for (;;)
{
- const struct bitmap2* bm2l = VG_(OSetGen_Next)(lhs->oset);
- const struct bitmap2* bm2r = VG_(OSetGen_Next)(rhs->oset);
+ const struct bitmap2ref* bm2l_ref;
+ const struct bitmap2ref* bm2r_ref;
+ const struct bitmap2* bm2l;
+ const struct bitmap2* bm2r;
const struct bitmap1* bm1l;
const struct bitmap1* bm1r;
unsigned k;
+ bm2l_ref = VG_(OSetGen_Next)(lhs->oset);
+ bm2l = bm2l_ref->bm2;
+ bm2r_ref = VG_(OSetGen_Next)(rhs->oset);
+ bm2r = bm2r_ref->bm2;
while (bm2l && bm2r && bm2l->addr != bm2r->addr)
{
if (bm2l->addr < bm2r->addr)
- bm2l = VG_(OSetGen_Next)(lhs->oset);
+ bm2l = (bm2l_ref = VG_(OSetGen_Next)(lhs->oset))->bm2;
else
- bm2r = VG_(OSetGen_Next)(rhs->oset);
+ bm2r = (bm2r_ref = VG_(OSetGen_Next)(rhs->oset))->bm2;
}
if (bm2l == 0 || bm2r == 0)
break;
@@ -709,13 +749,17 @@
void bm_print(const struct bitmap* const bm)
{
struct bitmap2* bm2;
+ struct bitmap2ref* bm2ref;
VG_(OSetGen_ResetIter)(bm->oset);
- for ( ; (bm2 = VG_(OSetGen_Next)(bm->oset)) != 0; )
+ for ( ; (bm2ref = VG_(OSetGen_Next)(bm->oset)) != 0; )
{
- const struct bitmap1* const bm1 = &bm2->bm1;
+ const struct bitmap1* bm1;
unsigned b;
+
+ bm2 = bm2ref->bm2;
+ bm1 = &bm2->bm1;
for (b = 0; b < ADDR0_COUNT; b++)
{
const Addr a = (bm2->addr << ADDR0_BITS) | b;
@@ -742,6 +786,54 @@
return s_bitmap2_creation_count;
}
+/** Allocate and initialize a second level bitmap. */
+static struct bitmap2* bm2_new(const UWord a1)
+{
+ struct bitmap2* bm2;
+
+ bm2 = VG_(malloc)(sizeof(*bm2));
+ bm2->addr = a1;
+ bm2->refcnt = 1;
+
+ s_bitmap2_creation_count++;
+
+ return bm2;
+}
+
+/** Make a copy of a shared second level bitmap such that the copy can be
+ * modified.
+ *
+ * @param a1 client address shifted right by ADDR0_BITS.
+ * @param bm bitmap pointer.
+ */
+static
+struct bitmap2* bm2_make_exclusive(struct bitmap* const bm,
+ struct bitmap2ref* const bm2ref)
+{
+ UWord a1;
+ struct bitmap2* bm2;
+ struct bitmap2* bm2_copy;
+
+ tl_assert(bm);
+ tl_assert(bm2ref);
+ bm2 = bm2ref->bm2;
+ tl_assert(bm2);
+ tl_assert(bm2->refcnt > 1);
+ bm2->refcnt--;
+ tl_assert(bm2->refcnt >= 1);
+ a1 = bm2->addr;
+ bm2_copy = bm2_new(a1);
+ tl_assert(bm2_copy);
+ tl_assert(bm2_copy->addr == a1);
+ tl_assert(bm2_copy->refcnt == 1);
+ VG_(memcpy)(&bm2_copy->bm1, &bm2->bm1, sizeof(bm2->bm1));
+ bm2ref->bm2 = bm2_copy;
+
+ bm_update_cache(bm, a1, bm2_copy);
+
+ return bm2_copy;
+}
+
static void bm2_merge(struct bitmap2* const bm2l,
const struct bitmap2* const bm2r)
{
@@ -750,6 +842,7 @@
tl_assert(bm2l);
tl_assert(bm2r);
tl_assert(bm2l->addr == bm2r->addr);
+ tl_assert(bm2l->refcnt == 1);
for (k = 0; k < BITMAP1_UWORD_COUNT; k++)
{
Modified: trunk/exp-drd/drd_bitmap.h
===================================================================
--- trunk/exp-drd/drd_bitmap.h 2008-03-24 19:05:36 UTC (rev 7781)
+++ trunk/exp-drd/drd_bitmap.h 2008-03-24 19:12:12 UTC (rev 7782)
@@ -155,9 +155,17 @@
struct bitmap2
{
Addr addr; ///< address >> ADDR0_BITS
+ int refcnt;
struct bitmap1 bm1;
};
+/* One node of bitmap::oset. */
+struct bitmap2ref
+{
+ Addr addr; ///< address >> ADDR0_BITS
+ struct bitmap2* bm2;
+};
+
struct bm_cache_elem
{
Addr a1;
@@ -174,7 +182,34 @@
};
+static struct bitmap2* bm2_new(const UWord a1);
+static struct bitmap2* bm2_make_exclusive(struct bitmap* const bm,
+ struct bitmap2ref* const bm2ref);
+
+
+#if 0
+/** Bitmap invariant check.
+ *
+ * @return 1 if the invariant is satisfied, 0 if not.
+ */
static __inline__
+int bm_check(const struct bitmap* const bm)
+{
+ struct bitmap2_ref* bm2ref;
+
+ tl_assert(bm);
+
+ return (bm->cache[0].a1 == 0
+ && bm->cache[1].a1 == 0
+ || ((bm2ref = VG_(OSetGen_Lookup)(bm->oset, &bm->last_lookup_a1))
+ && bm2ref->bm2
+ && bm->last_lookup_a1 == bm2ref->bm2->addr
+ && bm2ref->bm2->refcnt >= 1)
+ );
+}
+#endif
+
+static __inline__
struct bitmap2* bm_cache_lookup(const struct bitmap* const bm, const UWord a1)
{
tl_assert(bm);
@@ -252,44 +287,131 @@
bm->cache[0].bm2 = bm2;
}
-/** Look up the address a1 in bitmap bm.
+/** Look up the address a1 in bitmap bm and return a pointer to a potentially
+ * shared second level bitmap. The bitmap where the returned pointer points
+ * at may not be modified by the caller.
+ *
* @param a1 client address shifted right by ADDR0_BITS.
* @param bm bitmap pointer.
*/
static __inline__
-struct bitmap2* bm2_lookup(const struct bitmap* const bm, const UWord a1)
+const struct bitmap2* bm2_lookup(const struct bitmap* const bm, const UWord a1)
{
+ struct bitmap2ref* bm2ref;
+
+ tl_assert(bm);
+ if (a1 == bm->cache[0].a1)
+ {
+ return bm->cache[0].bm2;
+ }
+ if (a1 == bm->cache[1].a1)
+ {
+ return bm->cache[1].bm2;
+ }
+ bm2ref = VG_(OSetGen_Lookup)(bm->oset, &a1);
+ if (bm2ref)
+ {
+ struct bitmap2* const bm2 = bm2ref->bm2;
+ bm_update_cache(*(struct bitmap**)&bm, a1, bm2);
+ return bm2;
+ }
+ return 0;
+}
+
+/** Look up the address a1 in bitmap bm and return a pointer to a second
+ * level bitmap that is not shared and hence may be modified.
+ *
+ * @param a1 client address shifted right by ADDR0_BITS.
+ * @param bm bitmap pointer.
+ */
+static __inline__
+struct bitmap2*
+bm2_lookup_exclusive(const struct bitmap* const bm, const UWord a1)
+{
+ struct bitmap2ref* bm2ref;
struct bitmap2* bm2;
+
+ bm2ref = 0;
bm2 = bm_cache_lookup(bm, a1);
- if (bm2 == 0)
+ if (bm2)
{
- bm2 = VG_(OSetGen_Lookup)(bm->oset, &a1);
- if (bm2)
+ if (bm2->refcnt > 1)
{
- bm_update_cache(*(struct bitmap**)&bm, a1, bm2);
+ bm2ref = VG_(OSetGen_Lookup)(bm->oset, &a1);
}
}
+ else
+ {
+ bm2ref = VG_(OSetGen_Lookup)(bm->oset, &a1);
+ if (bm2ref)
+ {
+ bm2 = bm2ref->bm2;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ tl_assert(bm2);
+
+ if (bm2->refcnt > 1)
+ {
+ tl_assert(bm2ref);
+ bm2 = bm2_make_exclusive(*(struct bitmap**)&bm, bm2ref);
+ }
+
return bm2;
}
+/** Look up the address a1 in bitmap bm. The returned second level bitmap has
+ * reference count one and hence may be modified.
+ *
+ * @param a1 client address shifted right by ADDR0_BITS.
+ * @param bm bitmap pointer.
+ */
static __inline__
struct bitmap2* bm2_insert(const struct bitmap* const bm, const UWord a1)
{
+ struct bitmap2ref* bm2ref;
struct bitmap2* bm2;
- bm2 = VG_(OSetGen_AllocNode)(bm->oset, sizeof(*bm2));
- bm2->addr = a1;
+ bm2ref = VG_(OSetGen_AllocNode)(bm->oset, sizeof(*bm2ref));
+ bm2ref->addr = a1;
+ bm2 = bm2_new(a1);
+ bm2ref->bm2 = bm2;
VG_(memset)(&bm2->bm1, 0, sizeof(bm2->bm1));
- VG_(OSetGen_Insert)(bm->oset, bm2);
+ VG_(OSetGen_Insert)(bm->oset, bm2ref);
bm_update_cache(*(struct bitmap**)&bm, a1, bm2);
+
+ return bm2;
+}
+
+/** Insert a new node in bitmap bm that points to the second level bitmap
+ * *bm2. This means that *bm2 becomes shared over two or more bitmaps.
+ */
+static __inline__
+struct bitmap2* bm2_insert_addref(const struct bitmap* const bm,
+ struct bitmap2* const bm2)
+{
+ struct bitmap2ref* bm2ref;
+
+ tl_assert(bm);
+ //tl_assert(VG_(OSetGen_Lookup)(bm->oset, &bm2->addr) == 0);
+ bm2ref = VG_(OSetGen_AllocNode)(bm->oset, sizeof(*bm2ref));
+ bm2ref->addr = bm2->addr;
+ bm2ref->bm2 = bm2;
+ bm2->refcnt++;
+ VG_(OSetGen_Insert)(bm->oset, bm2ref);
- s_bitmap2_creation_count++;
-
+ bm_update_cache(*(struct bitmap**)&bm, bm2->addr, bm2);
+
return bm2;
}
/** Look up the address a1 in bitmap bm, and insert it if not found.
+ * The returned second level bitmap may not be modified.
*
* @param a1 client address shifted right by ADDR0_BITS.
* @param bm bitmap pointer.
@@ -298,14 +420,20 @@
struct bitmap2* bm2_lookup_or_insert(const struct bitmap* const bm,
const UWord a1)
{
+ struct bitmap2ref* bm2ref;
struct bitmap2* bm2;
+ tl_assert(bm);
bm2 = bm_cache_lookup(bm, a1);
if (bm2 == 0)
{
- bm2 = VG_(OSetGen_Lookup)(bm->oset, &a1);
- if (bm2 == 0)
+ bm2ref = VG_(OSetGen_Lookup)(bm->oset, &a1);
+ if (bm2ref)
{
+ bm2 = bm2ref->bm2;
+ }
+ else
+ {
bm2 = bm2_insert(bm, a1);
}
bm_update_cache(*(struct bitmap**)&bm, a1, bm2);
@@ -313,5 +441,29 @@
return bm2;
}
+/** Look up the address a1 in bitmap bm, and insert it if not found.
+ * The returned second level bitmap may be modified.
+ *
+ * @param a1 client address shifted right by ADDR0_BITS.
+ * @param bm bitmap pointer.
+ */
+static __inline__
+struct bitmap2* bm2_lookup_or_insert_exclusive(struct bitmap* const bm,
+ const UWord a1)
+{
+ struct bitmap2* bm2;
+ tl_assert(bm);
+ bm2 = (struct bitmap2*)bm2_lookup_or_insert(bm, a1);
+ tl_assert(bm2);
+ if (bm2->refcnt > 1)
+ {
+ struct bitmap2ref* bm2ref;
+ bm2ref = VG_(OSetGen_Lookup)(bm->oset, &a1);
+ bm2 = bm2_make_exclusive(bm, bm2ref);
+ }
+ return bm2;
+}
+
+
#endif /* __DRD_BITMAP_H */
|
|
From: <sv...@va...> - 2008-03-24 19:05:37
|
Author: bart
Date: 2008-03-24 19:05:36 +0000 (Mon, 24 Mar 2008)
New Revision: 7781
Log:
Changed bitmap implementation such that it works with the original OSet implementation. Restored original OSet implementation.
Modified:
branches/DRDDEV/coregrind/m_oset.c
branches/DRDDEV/exp-drd/drd_bitmap.c
branches/DRDDEV/include/pub_tool_oset.h
Modified: branches/DRDDEV/coregrind/m_oset.c
===================================================================
--- branches/DRDDEV/coregrind/m_oset.c 2008-03-24 12:38:02 UTC (rev 7780)
+++ branches/DRDDEV/coregrind/m_oset.c 2008-03-24 19:05:36 UTC (rev 7781)
@@ -76,10 +76,9 @@
// concurrent uses would screw things up.
#include "pub_core_basics.h"
-#include "pub_core_libcassert.h"
#include "pub_core_libcbase.h"
+#include "pub_core_libcassert.h"
#include "pub_core_libcprint.h"
-#include "pub_core_mallocfree.h"
#include "pub_core_oset.h"
/*--------------------------------------------------------------------*/
@@ -295,7 +294,7 @@
vg_assert(_free);
if (!_cmp) vg_assert(0 == _keyOff); // If no cmp, offset must be zero
- t = VG_(malloc)(sizeof(AvlTree));
+ t = _alloc(sizeof(AvlTree));
t->keyOff = _keyOff;
t->cmp = _cmp;
t->alloc = _alloc;
@@ -345,7 +344,7 @@
vg_assert(sz == t->nElems);
/* Free the AvlTree itself. */
- VG_(free)(t);
+ t->free(t);
}
void VG_(OSetWord_Destroy)(AvlTree* t)
@@ -369,11 +368,6 @@
t->free( node_of_elem(e) );
}
-void* VG_(OSetGen_NodeToElem)(void* node)
-{
- return elem_of_node(node);
-}
-
/*--------------------------------------------------------------------*/
/*--- Insertion ---*/
/*--------------------------------------------------------------------*/
Modified: branches/DRDDEV/exp-drd/drd_bitmap.c
===================================================================
--- branches/DRDDEV/exp-drd/drd_bitmap.c 2008-03-24 12:38:02 UTC (rev 7780)
+++ branches/DRDDEV/exp-drd/drd_bitmap.c 2008-03-24 19:05:36 UTC (rev 7781)
@@ -43,8 +43,6 @@
/* Local function declarations. */
-static void* bm2ref_new(const SizeT size);
-static void bm2ref_del(void* node);
static void bm2_merge(struct bitmap2* const bm2l,
const struct bitmap2* const bm2r);
@@ -72,7 +70,7 @@
bm->cache[i].a1 = 0;
bm->cache[i].bm2 = 0;
}
- bm->oset = VG_(OSetGen_Create)(0, 0, bm2ref_new, bm2ref_del);
+ bm->oset = VG_(OSetGen_Create)(0, 0, VG_(malloc), VG_(free));
s_bitmap_creation_count++;
@@ -81,7 +79,22 @@
void bm_delete(struct bitmap* const bm)
{
+ struct bitmap2* bm2;
+ struct bitmap2ref* bm2ref;
+
tl_assert(bm);
+
+ VG_(OSetGen_ResetIter)(bm->oset);
+ for ( ; (bm2ref = VG_(OSetGen_Next)(bm->oset)) != 0; )
+ {
+ bm2 = bm2ref->bm2;
+ tl_assert(bm2->refcnt >= 1);
+ if (--bm2->refcnt == 0)
+ {
+ VG_(free)(bm2);
+ }
+ }
+
VG_(OSetGen_Destroy)(bm->oset);
VG_(free)(bm);
}
@@ -773,33 +786,6 @@
return s_bitmap2_creation_count;
}
-/** Allocate memory for a tree node, without initializing the tree node. */
-static void* bm2ref_new(const SizeT size)
-{
- void* node = VG_(malloc)(size);
- return node;
-}
-
-/** Deallocate the tree node, decrement the reference count of the second
- * level bitmap and deallocate the second level bitmap memory if the reference
- * count reached zero.
- */
-static void bm2ref_del(void* node)
-{
- struct bitmap2* bm2;
- struct bitmap2ref* bm2ref;
-
- bm2ref = VG_(OSetGen_NodeToElem)(node);
- tl_assert(bm2ref);
- bm2 = bm2ref->bm2;
- tl_assert(bm2->refcnt >= 1);
- if (--bm2->refcnt == 0)
- {
- VG_(free)(bm2);
- }
- VG_(free)(node);
-}
-
/** Allocate and initialize a second level bitmap. */
static struct bitmap2* bm2_new(const UWord a1)
{
Modified: branches/DRDDEV/include/pub_tool_oset.h
===================================================================
--- branches/DRDDEV/include/pub_tool_oset.h 2008-03-24 12:38:02 UTC (rev 7780)
+++ branches/DRDDEV/include/pub_tool_oset.h 2008-03-24 19:05:36 UTC (rev 7781)
@@ -187,7 +187,6 @@
extern void VG_(OSetGen_Destroy) ( OSet* os );
extern void* VG_(OSetGen_AllocNode) ( OSet* os, SizeT elemSize );
extern void VG_(OSetGen_FreeNode) ( OSet* os, void* elem );
-extern void* VG_(OSetGen_NodeToElem)( void* node );
/*--------------------------------------------------------------------*/
/*--- Operations on OSets (Gen) ---*/
|
|
From: Bart V. A. <bar...@gm...> - 2008-03-24 18:56:05
|
Hello,
VG_(OSetGen_Create)() has four arguments, where the last two are
pointers to an allocation and a deallocation function. These last two
functions are not only used to allocate and deallocate tree nodes, but
also for allocating and deallocating the OSet itself. I'd like to
build an OSet with tree nodes that store a pointer to a
reference-counted bitmap, with a deallocation function that does not
only deallocate the node memory but also decrements the reference
count. It would be inelegant to make the allocation and deallocation
functions try to figure out what kind of item (node or OSet) they are
allocating or deallocating. One solution it to change the OSet
implementation such that it always uses VG_(malloc) / VG_(free) for
the OSet, another solution is to add an extra OSet creation function
that accepts six arguments instead of four (where the two extra
arguments are pointers to the allocation and deallocation function for
the OSet itself).
The patch below implements the first option.
Comments are welcome.
Bart.
Index: coregrind/m_oset.c
===================================================================
--- coregrind/m_oset.c (.../trunk/coregrind/m_oset.c) (revision 7758)
+++ coregrind/m_oset.c (.../branches/DRDDEV/coregrind/m_oset.c) (working copy)
@@ -79,6 +79,7 @@
#include "pub_core_libcbase.h"
#include "pub_core_libcassert.h"
#include "pub_core_libcprint.h"
+#include "pub_core_mallocfree.h"
#include "pub_core_oset.h"
/*--------------------------------------------------------------------*/
@@ -294,7 +295,7 @@
vg_assert(_free);
if (!_cmp) vg_assert(0 == _keyOff); // If no cmp, offset must be zero
- t = _alloc(sizeof(AvlTree));
+ t = VG_(malloc)(sizeof(AvlTree));
t->keyOff = _keyOff;
t->cmp = _cmp;
t->alloc = _alloc;
@@ -344,7 +345,7 @@
vg_assert(sz == t->nElems);
/* Free the AvlTree itself. */
- t->free(t);
+ VG_(free)(t);
}
void VG_(OSetWord_Destroy)(AvlTree* t)
@@ -368,6 +369,11 @@
t->free( node_of_elem(e) );
}
+void* VG_(OSetGen_NodeToElem)(void* node)
+{
+ return elem_of_node(node);
+}
+
/*--------------------------------------------------------------------*/
/*--- Insertion ---*/
/*--------------------------------------------------------------------*/
Index: include/pub_tool_oset.h
===================================================================
--- include/pub_tool_oset.h (.../trunk/include) (revision 7758)
+++ include/pub_tool_oset.h (.../branches/DRDDEV/include) (working copy)
@@ -187,6 +187,7 @@
extern void VG_(OSetGen_Destroy) ( OSet* os );
extern void* VG_(OSetGen_AllocNode) ( OSet* os, SizeT elemSize );
extern void VG_(OSetGen_FreeNode) ( OSet* os, void* elem );
+extern void* VG_(OSetGen_NodeToElem)( void* node );
/*--------------------------------------------------------------------*/
/*--- Operations on OSets (Gen) ---*/
Index: memcheck/tests/oset_test.c
===================================================================
--- memcheck/tests/oset_test.c (.../trunk/memcheck) (revision 7758)
+++ memcheck/tests/oset_test.c (.../branches/DRDDEV/memcheck) (working copy)
@@ -28,6 +28,9 @@
#define vgPlain_memset memset
#define vgPlain_memcpy memcpy
+static void* VG_(malloc)( SizeT nbytes ) { return malloc(nbytes); }
+static void VG_(free) ( void* p ) { return free(p); }
+
#include "coregrind/m_oset.c"
#define NN 1000 // Size of OSets being created
|
|
From: Nuno L. <nun...@sa...> - 2008-03-24 18:23:19
|
Hi, Today I've written a simple peephole optimizer that works after the instruction selection and before register allocation. So it takes an array of instructions and outputs another array of instructions. It's also independent of the platform. The patch is available at: http://web.ist.utl.pt/nuno.lopes/valgrind_vex_peephole_optimizations.txt Currently it only removes redudant MOVs between virtual registers that can be propagated forward. Imagine this: 9 movl %vr16,%vr85 ; %vr16 isn't referenced below this line 10 subl $0x4,%vr85 (maps %vr85 to %vr16) the movl is removed and translated into: 9 subl $0x4,%vr16 With only this simple transformation, I was able to reduce the number of instructions of a simple block (instrumented with memcheck) from 120 to 106, which is quite good. The number of register spills is also hugely reduced (on a x86 host)! (memcheck creates some unnecessary moves because of the dirty handler arguments). The caveats? Well it segfaults *after* compiling all the blocks, which is weird.. I get the following error: ==28498== Invalid read of size 1 ==28498== at 0x4015508: (within /lib/ld-2.6.1.so) ==28498== by 0x4013CB5: (within /lib/ld-2.6.1.so) ==28498== by 0x400134E: (within /lib/ld-2.6.1.so) ==28498== by 0x40009A6: (within /lib/ld-2.6.1.so) ==28498== Address 0x10090188 is not stack'd, malloc'd or (recently) free'd ==28498== ==28498== Process terminating with default action of signal 11 (SIGSEGV) ==28498== Access not within mapped region at address 0x10090188 ==28498== at 0x4015508: (within /lib/ld-2.6.1.so) ==28498== by 0x4013CB5: (within /lib/ld-2.6.1.so) ==28498== by 0x400134E: (within /lib/ld-2.6.1.so) ==28498== by 0x40009A6: (within /lib/ld-2.6.1.so) ==28498== If you believe this happened as a result of a stack overflow in your ==28498== program's main thread (unlikely but possible), you can try to increase ==28498== the size of the main thread stack using the --main-stacksize= flag. ==28498== The main thread stack size used in this run was 8388608. ==28498== ==28498== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0) ==28498== malloc/free: in use at exit: 0 bytes in 0 blocks. ==28498== malloc/free: 0 allocs, 0 frees, 0 bytes allocated. ==28498== For counts of detected errors, rerun with: -v ==28498== All heap blocks were freed -- no leaks are possible. ./vg-in-place: line 8: 28498 Segmentation fault VALGRIND_LIB=$d/.in_place VALGRIND_LIB_INNER=$d/.in_place $d/coregrind/valgrind "$@" Do you know what might be causing the problem? Also, after this is working correctly (i.e. fixing this segfault and running the tests), do you think this could be incorporated in valgrind/VEX? Regards, Nuno |
|
From: <sv...@va...> - 2008-03-24 12:37:58
|
Author: bart
Date: 2008-03-24 12:38:02 +0000 (Mon, 24 Mar 2008)
New Revision: 7780
Log:
Updated test plan.
Modified:
trunk/exp-drd/Testing.txt
Modified: trunk/exp-drd/Testing.txt
===================================================================
--- trunk/exp-drd/Testing.txt 2008-03-24 12:19:14 UTC (rev 7779)
+++ trunk/exp-drd/Testing.txt 2008-03-24 12:38:02 UTC (rev 7780)
@@ -3,19 +3,28 @@
1. Run the regression tests. After having compiled DRD, run the following
command:
- perl tests/vg_regtest exp-drd
-2. Test whether DRD works with standard KDE applications and whether it does
+ perl tests/vg_regtest exp-drd
+2. Test the slowdown for matinv for various matrix sizes (must be less
+ than 100):
+ time exp-drd/tests/matinv 200
+ for ((i=1;i<=10;i++))
+ do
+ echo "==== $i ===="
+ time ./vg-in-place --tool=exp-drd exp-drd/tests/matinv 200 -t$i
+ done
+3. Test whether DRD works with standard KDE applications and whether it does
not print any error messages:
- ./vg-in-place --tool=exp-drd kate
- ./vg-in-place --trace-children=yes --tool=exp-drd knode
-3. Test DRD with Firefox. First of all, build and install Firefox 3. Next,
+ ./vg-in-place --tool=exp-drd kate
+ ./vg-in-place --trace-children=yes --tool=exp-drd knode
+4. Test DRD with Firefox. First of all, build and install Firefox 3. Next,
run the following command:
- LD_LIBRARY_PATH=$HOME/firefox3: ./vg-in-place --tool=exp-drd \
- $HOME/firefox3/firefox-bin
+ LD_LIBRARY_PATH=$HOME/software/mozilla-build/dist/lib: ./vg-in-place --tool=exp-drd $HOME/software/mozilla-build/dist/bin/firefox-bin
+
+
The Firefox source code can be obtained here:
ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/${version}/source
@@ -30,6 +39,7 @@
BUILD=${SRC}-build
PREFIX=$HOME/firefox3
MOZCONFIG=$BUILD/mozconfig-firefox
+export MOZCONFIG
rm -rf ${BUILD} || exit $?
rm -rf ${PREFIX} || exit $?
@@ -47,7 +57,6 @@
ac_add_options --prefix $PREFIX
EOF
-export MOZCONFIG
export CFLAGS=-pipe
${SRC}/configure
|
|
From: <sv...@va...> - 2008-03-24 12:19:10
|
Author: bart Date: 2008-03-24 12:19:14 +0000 (Mon, 24 Mar 2008) New Revision: 7779 Log: Merged trunk changes r7771:7778 to DRDDEV branch. Added: branches/DRDDEV/exp-drd/Testing.txt Modified: branches/DRDDEV/exp-drd/TODO.txt branches/DRDDEV/exp-drd/docs/README.txt branches/DRDDEV/exp-drd/tests/omp_matinv.vgtest branches/DRDDEV/exp-drd/tests/omp_matinv_racy.vgtest branches/DRDDEV/exp-drd/tests/omp_prime_racy.vgtest branches/DRDDEV/exp-drd/tests/run_openmp_test branches/DRDDEV/exp-drd/tests/tc09_bad_unlock.stderr.exp branches/DRDDEV/exp-drd/tests/tc20_verifywrap.stderr.exp branches/DRDDEV/exp-drd/tests/tc20_verifywrap2.stderr.exp branches/DRDDEV/exp-drd/tests/tc23_bogus_condwait.stderr.exp Modified: branches/DRDDEV/exp-drd/TODO.txt =================================================================== --- branches/DRDDEV/exp-drd/TODO.txt 2008-03-24 11:56:57 UTC (rev 7778) +++ branches/DRDDEV/exp-drd/TODO.txt 2008-03-24 12:19:14 UTC (rev 7779) @@ -1,4 +1,4 @@ -Last updated February 17, 2008 +Last updated March 24, 2008. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Copied: branches/DRDDEV/exp-drd/Testing.txt (from rev 7778, trunk/exp-drd/Testing.txt) =================================================================== --- branches/DRDDEV/exp-drd/Testing.txt (rev 0) +++ branches/DRDDEV/exp-drd/Testing.txt 2008-03-24 12:19:14 UTC (rev 7779) @@ -0,0 +1,57 @@ +How to test DRD +~~~~~~~~~~~~~~~ + +1. Run the regression tests. After having compiled DRD, run the following + command: + perl tests/vg_regtest exp-drd +2. Test whether DRD works with standard KDE applications and whether it does + not print any error messages: + ./vg-in-place --tool=exp-drd kate + ./vg-in-place --trace-children=yes --tool=exp-drd knode +3. Test DRD with Firefox. First of all, build and install Firefox 3. Next, + run the following command: + LD_LIBRARY_PATH=$HOME/firefox3: ./vg-in-place --tool=exp-drd \ + $HOME/firefox3/firefox-bin + + + + +The Firefox source code can be obtained here: +ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/${version}/source + +See also http://developer.mozilla.org/en/docs/Build_Documentation + +Firefox can be compiled via the following shell script: +------------------------------------------------------------ +#!/bin/sh + +SRCDIR=$HOME/software +SRC=$SRCDIR/mozilla +BUILD=${SRC}-build +PREFIX=$HOME/firefox3 +MOZCONFIG=$BUILD/mozconfig-firefox + +rm -rf ${BUILD} || exit $? +rm -rf ${PREFIX} || exit $? +mkdir -p ${BUILD} || exit $? +cd ${BUILD} || exit $? + +cat <<EOF >$MOZCONFIG +. $SRC/browser/config/mozconfig +mk_add_options MOZ_OBJDIR="$BUILD" +ac_add_app_options browser --enable-application=browser +ac_add_options --disable-optimize +ac_add_options --disable-tests +ac_add_options --enable-debug +ac_add_options --enable-static +ac_add_options --prefix $PREFIX +EOF + +export MOZCONFIG +export CFLAGS=-pipe + +${SRC}/configure + +make -s || exit $? +make -s install || exit $? +------------------------------------------------------------ Modified: branches/DRDDEV/exp-drd/docs/README.txt =================================================================== --- branches/DRDDEV/exp-drd/docs/README.txt 2008-03-24 11:56:57 UTC (rev 7778) +++ branches/DRDDEV/exp-drd/docs/README.txt 2008-03-24 12:19:14 UTC (rev 7779) @@ -381,6 +381,16 @@ http://rsim.cs.uiuc.edu/~sadve/Publications/isca91.dataraces.ps http://portal.acm.org/citation.cfm?doid=115953.115976 +[Cameron 1995] + Steven Cameron Woo, Moriyoshi Ohara, Evan Torrie, Jaswinder Pal Singh + and Anoop Gupta. + The SPLASH-2 Programs: Characterization and Methodological Considerations. + Proceedings of the 22nd International Symposium on Computer Architecture, + pages 24-36, Santa Margherita Ligure, Italy, June 1995. + http://portal.acm.org/citation.cfm?doid=225830.223990 + ftp://www-flash.stanford.edu/pub/splash2/splash2_isca95.ps.Z + http://www-flash.stanford.edu/apps/SPLASH/splash2.tar.gz + [Ousterhout 1996] John Ousterhout. Why Threads Are A Bad Idea (for most purposes). Modified: branches/DRDDEV/exp-drd/tests/omp_matinv.vgtest =================================================================== --- branches/DRDDEV/exp-drd/tests/omp_matinv.vgtest 2008-03-24 11:56:57 UTC (rev 7778) +++ branches/DRDDEV/exp-drd/tests/omp_matinv.vgtest 2008-03-24 12:19:14 UTC (rev 7779) @@ -1,3 +1,3 @@ -prereq: ./supported_libpthread && ./run_openmp_test ./omp_matinv +prereq: ./run_openmp_test ./omp_matinv prog: omp_matinv args: 30 -t 15 -q Modified: branches/DRDDEV/exp-drd/tests/omp_matinv_racy.vgtest =================================================================== --- branches/DRDDEV/exp-drd/tests/omp_matinv_racy.vgtest 2008-03-24 11:56:57 UTC (rev 7778) +++ branches/DRDDEV/exp-drd/tests/omp_matinv_racy.vgtest 2008-03-24 12:19:14 UTC (rev 7779) @@ -1,4 +1,4 @@ -prereq: ./supported_libpthread && ./run_openmp_test ./omp_matinv +prereq: ./run_openmp_test ./omp_matinv prog: omp_matinv args: 3 -t 2 -q -r stderr_filter: filter_error_summary Modified: branches/DRDDEV/exp-drd/tests/omp_prime_racy.vgtest =================================================================== --- branches/DRDDEV/exp-drd/tests/omp_prime_racy.vgtest 2008-03-24 11:56:57 UTC (rev 7778) +++ branches/DRDDEV/exp-drd/tests/omp_prime_racy.vgtest 2008-03-24 12:19:14 UTC (rev 7779) @@ -1,4 +1,4 @@ -prereq: ./supported_libpthread && ./run_openmp_test ./omp_prime +prereq: ./run_openmp_test ./omp_prime prog: omp_prime args: 4 -q stderr_filter: filter_error_summary Modified: branches/DRDDEV/exp-drd/tests/run_openmp_test =================================================================== --- branches/DRDDEV/exp-drd/tests/run_openmp_test 2008-03-24 11:56:57 UTC (rev 7778) +++ branches/DRDDEV/exp-drd/tests/run_openmp_test 2008-03-24 12:19:14 UTC (rev 7779) @@ -6,6 +6,8 @@ test -e "$1" || exit $? +./supported_libpthread || exit $? + if [ "$(uname)" = Linux ]; then # Let the dynamic linker/loader print the path of libgomp. See also man ld.so Modified: branches/DRDDEV/exp-drd/tests/tc09_bad_unlock.stderr.exp =================================================================== --- branches/DRDDEV/exp-drd/tests/tc09_bad_unlock.stderr.exp 2008-03-24 11:56:57 UTC (rev 7778) +++ branches/DRDDEV/exp-drd/tests/tc09_bad_unlock.stderr.exp 2008-03-24 12:19:14 UTC (rev 7779) @@ -13,7 +13,7 @@ by 0x........: clone (in /...libc...) Thread 1: -Not a mutex +Not a mutex: mutex 0x......... at 0x........: pthread_mutex_unlock (drd_pthread_intercepts.c:?) by 0x........: nearly_main (tc09_bad_unlock.c:41) by 0x........: main (tc09_bad_unlock.c:49) @@ -36,7 +36,7 @@ by 0x........: clone (in /...libc...) Thread 1: -Not a mutex +Not a mutex: mutex 0x......... at 0x........: pthread_mutex_unlock (drd_pthread_intercepts.c:?) by 0x........: nearly_main (tc09_bad_unlock.c:41) by 0x........: main (tc09_bad_unlock.c:50) Modified: branches/DRDDEV/exp-drd/tests/tc20_verifywrap.stderr.exp =================================================================== --- branches/DRDDEV/exp-drd/tests/tc20_verifywrap.stderr.exp 2008-03-24 11:56:57 UTC (rev 7778) +++ branches/DRDDEV/exp-drd/tests/tc20_verifywrap.stderr.exp 2008-03-24 12:19:14 UTC (rev 7779) @@ -17,7 +17,7 @@ ---------------- pthread_mutex_lock et al ---------------- -Not a mutex +Not a mutex: mutex 0x......... at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?) by 0x........: main (tc20_verifywrap.c:92) @@ -25,19 +25,19 @@ at 0x........: pthread_mutex_destroy (drd_pthread_intercepts.c:?) by 0x........: main (tc20_verifywrap.c:102) -Not a mutex +Not a mutex: mutex 0x......... at 0x........: pthread_mutex_lock (drd_pthread_intercepts.c:?) by 0x........: main (tc20_verifywrap.c:108) -Not a mutex +Not a mutex: mutex 0x......... at 0x........: pthread_mutex_trylock (drd_pthread_intercepts.c:?) by 0x........: main (tc20_verifywrap.c:116) -Not a mutex +Not a mutex: mutex 0x......... at 0x........: pthread_mutex_timedlock (drd_pthread_intercepts.c:?) by 0x........: main (tc20_verifywrap.c:121) -Not a mutex +Not a mutex: mutex 0x......... at 0x........: pthread_mutex_unlock (drd_pthread_intercepts.c:?) by 0x........: main (tc20_verifywrap.c:125) Modified: branches/DRDDEV/exp-drd/tests/tc20_verifywrap2.stderr.exp =================================================================== --- branches/DRDDEV/exp-drd/tests/tc20_verifywrap2.stderr.exp 2008-03-24 11:56:57 UTC (rev 7778) +++ branches/DRDDEV/exp-drd/tests/tc20_verifywrap2.stderr.exp 2008-03-24 12:19:14 UTC (rev 7779) @@ -18,7 +18,7 @@ [1/1] mutex_init invalid mutex 0x........ -Not a mutex +Not a mutex: mutex 0x......... at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?) by 0x........: main (tc20_verifywrap.c:92) [1/1] mutex_init mutex 0x........ @@ -31,25 +31,25 @@ by 0x........: main (tc20_verifywrap.c:102) [1/1] pre_mutex_lock invalid mutex 0x........ rc 0 owner 0 -Not a mutex +Not a mutex: mutex 0x......... at 0x........: pthread_mutex_lock (drd_pthread_intercepts.c:?) by 0x........: main (tc20_verifywrap.c:108) [1/1] post_mutex_lock invalid mutex 0x........ rc 0 owner 0 [1/1] pre_mutex_lock invalid mutex 0x........ rc 0 owner 0 -Not a mutex +Not a mutex: mutex 0x......... at 0x........: pthread_mutex_trylock (drd_pthread_intercepts.c:?) by 0x........: main (tc20_verifywrap.c:116) [1/1] post_mutex_lock invalid mutex 0x........ rc 0 owner 0 [1/1] pre_mutex_lock invalid mutex 0x........ rc 0 owner 0 -Not a mutex +Not a mutex: mutex 0x......... at 0x........: pthread_mutex_timedlock (drd_pthread_intercepts.c:?) by 0x........: main (tc20_verifywrap.c:121) [1/1] post_mutex_lock invalid mutex 0x........ rc 0 owner 0 [1/1] mutex_unlock invalid mutex 0x........ rc 0 -Not a mutex +Not a mutex: mutex 0x......... at 0x........: pthread_mutex_unlock (drd_pthread_intercepts.c:?) by 0x........: main (tc20_verifywrap.c:125) Modified: branches/DRDDEV/exp-drd/tests/tc23_bogus_condwait.stderr.exp =================================================================== --- branches/DRDDEV/exp-drd/tests/tc23_bogus_condwait.stderr.exp 2008-03-24 11:56:57 UTC (rev 7778) +++ branches/DRDDEV/exp-drd/tests/tc23_bogus_condwait.stderr.exp 2008-03-24 12:19:14 UTC (rev 7779) @@ -1,5 +1,5 @@ -Not a mutex +Not a mutex: mutex 0x......... at 0x........: pthread_cond_wait* (drd_pthread_intercepts.c:?) by 0x........: main (tc23_bogus_condwait.c:69) @@ -7,7 +7,7 @@ at 0x........: pthread_cond_wait* (drd_pthread_intercepts.c:?) by 0x........: main (tc23_bogus_condwait.c:72) -Not a mutex +Not a mutex: mutex 0x......... at 0x........: pthread_cond_wait* (drd_pthread_intercepts.c:?) by 0x........: main (tc23_bogus_condwait.c:75) |
|
From: <sv...@va...> - 2008-03-24 11:56:55
|
Author: bart
Date: 2008-03-24 11:56:57 +0000 (Mon, 24 Mar 2008)
New Revision: 7778
Log:
Added support for jemalloc.
Modified:
branches/DRDDEV/coregrind/m_replacemalloc/vg_replace_malloc.c
Modified: branches/DRDDEV/coregrind/m_replacemalloc/vg_replace_malloc.c
===================================================================
--- branches/DRDDEV/coregrind/m_replacemalloc/vg_replace_malloc.c 2008-03-24 11:54:47 UTC (rev 7777)
+++ branches/DRDDEV/coregrind/m_replacemalloc/vg_replace_malloc.c 2008-03-24 11:56:57 UTC (rev 7778)
@@ -68,6 +68,10 @@
# error "Unknown platform"
#endif
+/* --- Soname of libjemalloc. --- */
+
+#define m_jemalloc_soname libjemallocZdsoZa /* libjemalloc.so* */
+
/* --- Soname of the GNU C++ library. --- */
#define m_libstdcxx_soname libstdcZpZpZa // libstdc++*
@@ -203,6 +207,7 @@
// (from_so, from_fn, v's replacement)
// malloc
+ALLOC_or_NULL(m_jemalloc_soname, malloc, malloc);
ALLOC_or_NULL(m_libstdcxx_soname, malloc, malloc);
ALLOC_or_NULL(m_libc_soname, malloc, malloc);
#if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
@@ -319,6 +324,7 @@
}
// free
+FREE(m_jemalloc_soname, free, free );
FREE(m_libstdcxx_soname, free, free );
FREE(m_libc_soname, free, free );
#if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
@@ -394,6 +400,7 @@
return v; \
}
+CALLOC(m_jemalloc_soname, calloc);
CALLOC(m_libc_soname, calloc);
#if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
CALLOC(m_libc_soname, calloc_common);
@@ -426,6 +433,7 @@
return v; \
}
+REALLOC(m_jemalloc_soname, realloc);
REALLOC(m_libc_soname, realloc);
#if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
REALLOC(m_libc_soname, realloc_common);
@@ -457,6 +465,7 @@
return v; \
}
+MEMALIGN(m_jemalloc_soname, memalign);
MEMALIGN(m_libc_soname, memalign);
@@ -483,6 +492,7 @@
((SizeT)pszB, size); \
}
+VALLOC(m_jemalloc_soname, valloc);
VALLOC(m_libc_soname, valloc);
@@ -566,6 +576,7 @@
return VKI_ENOMEM; \
}
+POSIX_MEMALIGN(m_jemalloc_soname, posix_memalign);
POSIX_MEMALIGN(m_libc_soname, posix_memalign);
#if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
/* 27 Nov 07: it appears that xlc links into executables, a
@@ -596,6 +607,7 @@
return pszB; \
}
+MALLOC_USABLE_SIZE(m_jemalloc_soname, malloc_usable_size);
MALLOC_USABLE_SIZE(m_libc_soname, malloc_usable_size);
|
|
From: <sv...@va...> - 2008-03-24 11:55:17
|
Author: bart
Date: 2008-03-24 11:54:47 +0000 (Mon, 24 Mar 2008)
New Revision: 7777
Log:
Merged from trunk to DRDDEV branch.
Modified:
branches/DRDDEV/exp-drd/drd_error.c
branches/DRDDEV/exp-drd/drd_mutex.c
Modified: branches/DRDDEV/exp-drd/drd_error.c
===================================================================
--- branches/DRDDEV/exp-drd/drd_error.c 2008-03-24 11:02:05 UTC (rev 7776)
+++ branches/DRDDEV/exp-drd/drd_error.c 2008-03-24 11:54:47 UTC (rev 7777)
@@ -133,12 +133,22 @@
case MutexErr: {
MutexErrInfo* p = (MutexErrInfo*)(VG_(get_error_extra)(e));
tl_assert(p);
- VG_(message)(Vg_UserMsg,
- "%s: mutex 0x%lx, recursion count %d, owner %d.",
- VG_(get_error_string)(e),
- p->mutex,
- p->recursion_count,
- p->owner);
+ if (p->recursion_count >= 0)
+ {
+ VG_(message)(Vg_UserMsg,
+ "%s: mutex 0x%lx, recursion count %d, owner %d.",
+ VG_(get_error_string)(e),
+ p->mutex,
+ p->recursion_count,
+ p->owner);
+ }
+ else
+ {
+ VG_(message)(Vg_UserMsg,
+ "%s: mutex 0x%lx.",
+ VG_(get_error_string)(e),
+ p->mutex);
+ }
VG_(pp_ExeContext)(VG_(get_error_where)(e));
break;
}
Modified: branches/DRDDEV/exp-drd/drd_mutex.c
===================================================================
--- branches/DRDDEV/exp-drd/drd_mutex.c 2008-03-24 11:02:05 UTC (rev 7776)
+++ branches/DRDDEV/exp-drd/drd_mutex.c 2008-03-24 11:54:47 UTC (rev 7777)
@@ -72,6 +72,8 @@
/** Deallocate the memory that was allocated by mutex_initialize(). */
static void mutex_cleanup(struct mutex_info* p)
{
+ tl_assert(p);
+
if (s_trace_mutex)
{
VG_(message)(Vg_UserMsg,
@@ -96,6 +98,16 @@
p->last_locked_segment = 0;
}
+static void not_a_mutex(const Addr mutex)
+{
+ MutexErrInfo MEI = { mutex, -1, DRD_INVALID_THREADID };
+ VG_(maybe_record_error)(VG_(get_running_tid)(),
+ MutexErr,
+ VG_(get_IP)(VG_(get_running_tid)()),
+ "Not a mutex",
+ &MEI);
+}
+
static
struct mutex_info*
mutex_get_or_allocate(const Addr mutex, const MutexT mutex_type)
@@ -111,12 +123,7 @@
if (clientobj_present(mutex, mutex + 1))
{
- GenericErrInfo GEI;
- VG_(maybe_record_error)(VG_(get_running_tid)(),
- GenericErr,
- VG_(get_IP)(VG_(get_running_tid)()),
- "Not a mutex",
- &GEI);
+ not_a_mutex(mutex);
return 0;
}
@@ -149,12 +156,7 @@
if (mutex_type == mutex_type_invalid_mutex)
{
- GenericErrInfo GEI;
- VG_(maybe_record_error)(VG_(get_running_tid)(),
- GenericErr,
- VG_(get_IP)(VG_(get_running_tid)()),
- "Not a mutex",
- &GEI);
+ not_a_mutex(mutex);
return 0;
}
@@ -184,12 +186,7 @@
p = mutex_get(mutex);
if (p == 0)
{
- GenericErrInfo GEI;
- VG_(maybe_record_error)(VG_(get_running_tid)(),
- GenericErr,
- VG_(get_IP)(VG_(get_running_tid)()),
- "Not a mutex",
- &GEI);
+ not_a_mutex(mutex);
return;
}
@@ -213,7 +210,7 @@
"[%d/%d] pre_mutex_lock %s 0x%lx rc %d owner %d",
VG_(get_running_tid)(),
thread_get_running_tid(),
- mutex_get_typename(p),
+ p ? mutex_get_typename(p) : "(?)",
mutex,
p ? p->recursion_count : -1,
p ? p->owner : DRD_INVALID_THREADID);
@@ -221,12 +218,7 @@
if (p == 0)
{
- GenericErrInfo GEI;
- VG_(maybe_record_error)(VG_(get_running_tid)(),
- GenericErr,
- VG_(get_IP)(VG_(get_running_tid)()),
- "Not a mutex",
- &GEI);
+ not_a_mutex(mutex);
return;
}
@@ -234,12 +226,7 @@
if (mutex_type == mutex_type_invalid_mutex)
{
- GenericErrInfo GEI;
- VG_(maybe_record_error)(VG_(get_running_tid)(),
- GenericErr,
- VG_(get_IP)(VG_(get_running_tid)()),
- "Not a mutex",
- &GEI);
+ not_a_mutex(mutex);
return;
}
@@ -331,19 +318,14 @@
"[%d/%d] mutex_unlock %s 0x%lx rc %d",
vg_tid,
drd_tid,
- p ? mutex_get_typename(p) : "?",
+ p ? mutex_get_typename(p) : "(?)",
mutex,
p ? p->recursion_count : 0);
}
if (p == 0 || mutex_type == mutex_type_invalid_mutex)
{
- GenericErrInfo GEI;
- VG_(maybe_record_error)(vg_tid,
- GenericErr,
- VG_(get_IP)(vg_tid),
- "Not a mutex",
- &GEI);
+ not_a_mutex(mutex);
return;
}
|
|
From: <sv...@va...> - 2008-03-24 11:02:01
|
Author: bart Date: 2008-03-24 11:02:05 +0000 (Mon, 24 Mar 2008) New Revision: 7776 Log: Updated modification date. Modified: trunk/exp-drd/TODO.txt Modified: trunk/exp-drd/TODO.txt =================================================================== --- trunk/exp-drd/TODO.txt 2008-03-24 11:01:45 UTC (rev 7775) +++ trunk/exp-drd/TODO.txt 2008-03-24 11:02:05 UTC (rev 7776) @@ -1,4 +1,4 @@ -Last updated February 17, 2008 +Last updated March 24, 2008. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
From: <sv...@va...> - 2008-03-24 11:01:42
|
Author: bart Date: 2008-03-24 11:01:45 +0000 (Mon, 24 Mar 2008) New Revision: 7775 Log: Added document with information about how to test DRD. Added: trunk/exp-drd/Testing.txt Added: trunk/exp-drd/Testing.txt =================================================================== --- trunk/exp-drd/Testing.txt (rev 0) +++ trunk/exp-drd/Testing.txt 2008-03-24 11:01:45 UTC (rev 7775) @@ -0,0 +1,57 @@ +How to test DRD +~~~~~~~~~~~~~~~ + +1. Run the regression tests. After having compiled DRD, run the following + command: + perl tests/vg_regtest exp-drd +2. Test whether DRD works with standard KDE applications and whether it does + not print any error messages: + ./vg-in-place --tool=exp-drd kate + ./vg-in-place --trace-children=yes --tool=exp-drd knode +3. Test DRD with Firefox. First of all, build and install Firefox 3. Next, + run the following command: + LD_LIBRARY_PATH=$HOME/firefox3: ./vg-in-place --tool=exp-drd \ + $HOME/firefox3/firefox-bin + + + + +The Firefox source code can be obtained here: +ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/${version}/source + +See also http://developer.mozilla.org/en/docs/Build_Documentation + +Firefox can be compiled via the following shell script: +------------------------------------------------------------ +#!/bin/sh + +SRCDIR=$HOME/software +SRC=$SRCDIR/mozilla +BUILD=${SRC}-build +PREFIX=$HOME/firefox3 +MOZCONFIG=$BUILD/mozconfig-firefox + +rm -rf ${BUILD} || exit $? +rm -rf ${PREFIX} || exit $? +mkdir -p ${BUILD} || exit $? +cd ${BUILD} || exit $? + +cat <<EOF >$MOZCONFIG +. $SRC/browser/config/mozconfig +mk_add_options MOZ_OBJDIR="$BUILD" +ac_add_app_options browser --enable-application=browser +ac_add_options --disable-optimize +ac_add_options --disable-tests +ac_add_options --enable-debug +ac_add_options --enable-static +ac_add_options --prefix $PREFIX +EOF + +export MOZCONFIG +export CFLAGS=-pipe + +${SRC}/configure + +make -s || exit $? +make -s install || exit $? +------------------------------------------------------------ |
|
From: <sv...@va...> - 2008-03-24 10:50:16
|
Author: bart Date: 2008-03-24 10:50:21 +0000 (Mon, 24 Mar 2008) New Revision: 7774 Log: Added reference to SPLASH-2 benchmarks. Modified: trunk/exp-drd/docs/README.txt Modified: trunk/exp-drd/docs/README.txt =================================================================== --- trunk/exp-drd/docs/README.txt 2008-03-24 09:29:38 UTC (rev 7773) +++ trunk/exp-drd/docs/README.txt 2008-03-24 10:50:21 UTC (rev 7774) @@ -381,6 +381,16 @@ http://rsim.cs.uiuc.edu/~sadve/Publications/isca91.dataraces.ps http://portal.acm.org/citation.cfm?doid=115953.115976 +[Cameron 1995] + Steven Cameron Woo, Moriyoshi Ohara, Evan Torrie, Jaswinder Pal Singh + and Anoop Gupta. + The SPLASH-2 Programs: Characterization and Methodological Considerations. + Proceedings of the 22nd International Symposium on Computer Architecture, + pages 24-36, Santa Margherita Ligure, Italy, June 1995. + http://portal.acm.org/citation.cfm?doid=225830.223990 + ftp://www-flash.stanford.edu/pub/splash2/splash2_isca95.ps.Z + http://www-flash.stanford.edu/apps/SPLASH/splash2.tar.gz + [Ousterhout 1996] John Ousterhout. Why Threads Are A Bad Idea (for most purposes). |
|
From: <sv...@va...> - 2008-03-24 09:43:26
|
Author: bart Date: 2008-03-24 09:28:06 +0000 (Mon, 24 Mar 2008) New Revision: 7772 Log: Moved "supported_libpthread" test from .vgtest into run_openmp_test. Modified: trunk/exp-drd/tests/omp_matinv.vgtest trunk/exp-drd/tests/omp_matinv_racy.vgtest trunk/exp-drd/tests/omp_prime_racy.vgtest trunk/exp-drd/tests/run_openmp_test Modified: trunk/exp-drd/tests/omp_matinv.vgtest =================================================================== --- trunk/exp-drd/tests/omp_matinv.vgtest 2008-03-24 08:48:14 UTC (rev 7771) +++ trunk/exp-drd/tests/omp_matinv.vgtest 2008-03-24 09:28:06 UTC (rev 7772) @@ -1,3 +1,3 @@ -prereq: ./supported_libpthread && ./run_openmp_test ./omp_matinv +prereq: ./run_openmp_test ./omp_matinv prog: omp_matinv args: 30 -t 15 -q Modified: trunk/exp-drd/tests/omp_matinv_racy.vgtest =================================================================== --- trunk/exp-drd/tests/omp_matinv_racy.vgtest 2008-03-24 08:48:14 UTC (rev 7771) +++ trunk/exp-drd/tests/omp_matinv_racy.vgtest 2008-03-24 09:28:06 UTC (rev 7772) @@ -1,4 +1,4 @@ -prereq: ./supported_libpthread && ./run_openmp_test ./omp_matinv +prereq: ./run_openmp_test ./omp_matinv prog: omp_matinv args: 3 -t 2 -q -r stderr_filter: filter_error_summary Modified: trunk/exp-drd/tests/omp_prime_racy.vgtest =================================================================== --- trunk/exp-drd/tests/omp_prime_racy.vgtest 2008-03-24 08:48:14 UTC (rev 7771) +++ trunk/exp-drd/tests/omp_prime_racy.vgtest 2008-03-24 09:28:06 UTC (rev 7772) @@ -1,4 +1,4 @@ -prereq: ./supported_libpthread && ./run_openmp_test ./omp_prime +prereq: ./run_openmp_test ./omp_prime prog: omp_prime args: 4 -q stderr_filter: filter_error_summary Modified: trunk/exp-drd/tests/run_openmp_test =================================================================== --- trunk/exp-drd/tests/run_openmp_test 2008-03-24 08:48:14 UTC (rev 7771) +++ trunk/exp-drd/tests/run_openmp_test 2008-03-24 09:28:06 UTC (rev 7772) @@ -6,6 +6,8 @@ test -e "$1" || exit $? +./supported_libpthread || exit $? + if [ "$(uname)" = Linux ]; then # Let the dynamic linker/loader print the path of libgomp. See also man ld.so |
|
From: <sv...@va...> - 2008-03-24 09:43:23
|
Author: bart
Date: 2008-03-24 09:29:38 +0000 (Mon, 24 Mar 2008)
New Revision: 7773
Log:
When the "not a mutex" error message is printed, the offending address is now printed too.
Modified:
trunk/exp-drd/drd_error.c
trunk/exp-drd/drd_mutex.c
trunk/exp-drd/tests/tc09_bad_unlock.stderr.exp
trunk/exp-drd/tests/tc20_verifywrap.stderr.exp
trunk/exp-drd/tests/tc20_verifywrap2.stderr.exp
trunk/exp-drd/tests/tc23_bogus_condwait.stderr.exp
Modified: trunk/exp-drd/drd_error.c
===================================================================
--- trunk/exp-drd/drd_error.c 2008-03-24 09:28:06 UTC (rev 7772)
+++ trunk/exp-drd/drd_error.c 2008-03-24 09:29:38 UTC (rev 7773)
@@ -133,12 +133,22 @@
case MutexErr: {
MutexErrInfo* p = (MutexErrInfo*)(VG_(get_error_extra)(e));
tl_assert(p);
- VG_(message)(Vg_UserMsg,
- "%s: mutex 0x%lx, recursion count %d, owner %d.",
- VG_(get_error_string)(e),
- p->mutex,
- p->recursion_count,
- p->owner);
+ if (p->recursion_count >= 0)
+ {
+ VG_(message)(Vg_UserMsg,
+ "%s: mutex 0x%lx, recursion count %d, owner %d.",
+ VG_(get_error_string)(e),
+ p->mutex,
+ p->recursion_count,
+ p->owner);
+ }
+ else
+ {
+ VG_(message)(Vg_UserMsg,
+ "%s: mutex 0x%lx.",
+ VG_(get_error_string)(e),
+ p->mutex);
+ }
VG_(pp_ExeContext)(VG_(get_error_where)(e));
break;
}
Modified: trunk/exp-drd/drd_mutex.c
===================================================================
--- trunk/exp-drd/drd_mutex.c 2008-03-24 09:28:06 UTC (rev 7772)
+++ trunk/exp-drd/drd_mutex.c 2008-03-24 09:29:38 UTC (rev 7773)
@@ -72,6 +72,8 @@
/** Deallocate the memory that was allocated by mutex_initialize(). */
static void mutex_cleanup(struct mutex_info* p)
{
+ tl_assert(p);
+
if (s_trace_mutex)
{
VG_(message)(Vg_UserMsg,
@@ -96,6 +98,16 @@
p->last_locked_segment = 0;
}
+static void not_a_mutex(const Addr mutex)
+{
+ MutexErrInfo MEI = { mutex, -1, DRD_INVALID_THREADID };
+ VG_(maybe_record_error)(VG_(get_running_tid)(),
+ MutexErr,
+ VG_(get_IP)(VG_(get_running_tid)()),
+ "Not a mutex",
+ &MEI);
+}
+
static
struct mutex_info*
mutex_get_or_allocate(const Addr mutex, const MutexT mutex_type)
@@ -111,12 +123,7 @@
if (clientobj_present(mutex, mutex + 1))
{
- GenericErrInfo GEI;
- VG_(maybe_record_error)(VG_(get_running_tid)(),
- GenericErr,
- VG_(get_IP)(VG_(get_running_tid)()),
- "Not a mutex",
- &GEI);
+ not_a_mutex(mutex);
return 0;
}
@@ -149,12 +156,7 @@
if (mutex_type == mutex_type_invalid_mutex)
{
- GenericErrInfo GEI;
- VG_(maybe_record_error)(VG_(get_running_tid)(),
- GenericErr,
- VG_(get_IP)(VG_(get_running_tid)()),
- "Not a mutex",
- &GEI);
+ not_a_mutex(mutex);
return 0;
}
@@ -184,12 +186,7 @@
p = mutex_get(mutex);
if (p == 0)
{
- GenericErrInfo GEI;
- VG_(maybe_record_error)(VG_(get_running_tid)(),
- GenericErr,
- VG_(get_IP)(VG_(get_running_tid)()),
- "Not a mutex",
- &GEI);
+ not_a_mutex(mutex);
return;
}
@@ -213,7 +210,7 @@
"[%d/%d] pre_mutex_lock %s 0x%lx rc %d owner %d",
VG_(get_running_tid)(),
thread_get_running_tid(),
- mutex_get_typename(p),
+ p ? mutex_get_typename(p) : "(?)",
mutex,
p ? p->recursion_count : -1,
p ? p->owner : DRD_INVALID_THREADID);
@@ -221,12 +218,7 @@
if (p == 0)
{
- GenericErrInfo GEI;
- VG_(maybe_record_error)(VG_(get_running_tid)(),
- GenericErr,
- VG_(get_IP)(VG_(get_running_tid)()),
- "Not a mutex",
- &GEI);
+ not_a_mutex(mutex);
return;
}
@@ -234,12 +226,7 @@
if (mutex_type == mutex_type_invalid_mutex)
{
- GenericErrInfo GEI;
- VG_(maybe_record_error)(VG_(get_running_tid)(),
- GenericErr,
- VG_(get_IP)(VG_(get_running_tid)()),
- "Not a mutex",
- &GEI);
+ not_a_mutex(mutex);
return;
}
@@ -331,19 +318,14 @@
"[%d/%d] mutex_unlock %s 0x%lx rc %d",
vg_tid,
drd_tid,
- p ? mutex_get_typename(p) : "?",
+ p ? mutex_get_typename(p) : "(?)",
mutex,
p ? p->recursion_count : 0);
}
if (p == 0 || mutex_type == mutex_type_invalid_mutex)
{
- GenericErrInfo GEI;
- VG_(maybe_record_error)(vg_tid,
- GenericErr,
- VG_(get_IP)(vg_tid),
- "Not a mutex",
- &GEI);
+ not_a_mutex(mutex);
return;
}
Modified: trunk/exp-drd/tests/tc09_bad_unlock.stderr.exp
===================================================================
--- trunk/exp-drd/tests/tc09_bad_unlock.stderr.exp 2008-03-24 09:28:06 UTC (rev 7772)
+++ trunk/exp-drd/tests/tc09_bad_unlock.stderr.exp 2008-03-24 09:29:38 UTC (rev 7773)
@@ -13,7 +13,7 @@
by 0x........: clone (in /...libc...)
Thread 1:
-Not a mutex
+Not a mutex: mutex 0x.........
at 0x........: pthread_mutex_unlock (drd_pthread_intercepts.c:?)
by 0x........: nearly_main (tc09_bad_unlock.c:41)
by 0x........: main (tc09_bad_unlock.c:49)
@@ -36,7 +36,7 @@
by 0x........: clone (in /...libc...)
Thread 1:
-Not a mutex
+Not a mutex: mutex 0x.........
at 0x........: pthread_mutex_unlock (drd_pthread_intercepts.c:?)
by 0x........: nearly_main (tc09_bad_unlock.c:41)
by 0x........: main (tc09_bad_unlock.c:50)
Modified: trunk/exp-drd/tests/tc20_verifywrap.stderr.exp
===================================================================
--- trunk/exp-drd/tests/tc20_verifywrap.stderr.exp 2008-03-24 09:28:06 UTC (rev 7772)
+++ trunk/exp-drd/tests/tc20_verifywrap.stderr.exp 2008-03-24 09:29:38 UTC (rev 7773)
@@ -17,7 +17,7 @@
---------------- pthread_mutex_lock et al ----------------
-Not a mutex
+Not a mutex: mutex 0x.........
at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:92)
@@ -25,19 +25,19 @@
at 0x........: pthread_mutex_destroy (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:102)
-Not a mutex
+Not a mutex: mutex 0x.........
at 0x........: pthread_mutex_lock (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:108)
-Not a mutex
+Not a mutex: mutex 0x.........
at 0x........: pthread_mutex_trylock (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:116)
-Not a mutex
+Not a mutex: mutex 0x.........
at 0x........: pthread_mutex_timedlock (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:121)
-Not a mutex
+Not a mutex: mutex 0x.........
at 0x........: pthread_mutex_unlock (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:125)
Modified: trunk/exp-drd/tests/tc20_verifywrap2.stderr.exp
===================================================================
--- trunk/exp-drd/tests/tc20_verifywrap2.stderr.exp 2008-03-24 09:28:06 UTC (rev 7772)
+++ trunk/exp-drd/tests/tc20_verifywrap2.stderr.exp 2008-03-24 09:29:38 UTC (rev 7773)
@@ -18,7 +18,7 @@
[1/1] mutex_init invalid mutex 0x........
-Not a mutex
+Not a mutex: mutex 0x.........
at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:92)
[1/1] mutex_init mutex 0x........
@@ -31,25 +31,25 @@
by 0x........: main (tc20_verifywrap.c:102)
[1/1] pre_mutex_lock invalid mutex 0x........ rc 0 owner 0
-Not a mutex
+Not a mutex: mutex 0x.........
at 0x........: pthread_mutex_lock (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:108)
[1/1] post_mutex_lock invalid mutex 0x........ rc 0 owner 0
[1/1] pre_mutex_lock invalid mutex 0x........ rc 0 owner 0
-Not a mutex
+Not a mutex: mutex 0x.........
at 0x........: pthread_mutex_trylock (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:116)
[1/1] post_mutex_lock invalid mutex 0x........ rc 0 owner 0
[1/1] pre_mutex_lock invalid mutex 0x........ rc 0 owner 0
-Not a mutex
+Not a mutex: mutex 0x.........
at 0x........: pthread_mutex_timedlock (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:121)
[1/1] post_mutex_lock invalid mutex 0x........ rc 0 owner 0
[1/1] mutex_unlock invalid mutex 0x........ rc 0
-Not a mutex
+Not a mutex: mutex 0x.........
at 0x........: pthread_mutex_unlock (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:125)
Modified: trunk/exp-drd/tests/tc23_bogus_condwait.stderr.exp
===================================================================
--- trunk/exp-drd/tests/tc23_bogus_condwait.stderr.exp 2008-03-24 09:28:06 UTC (rev 7772)
+++ trunk/exp-drd/tests/tc23_bogus_condwait.stderr.exp 2008-03-24 09:29:38 UTC (rev 7773)
@@ -1,5 +1,5 @@
-Not a mutex
+Not a mutex: mutex 0x.........
at 0x........: pthread_cond_wait* (drd_pthread_intercepts.c:?)
by 0x........: main (tc23_bogus_condwait.c:69)
@@ -7,7 +7,7 @@
at 0x........: pthread_cond_wait* (drd_pthread_intercepts.c:?)
by 0x........: main (tc23_bogus_condwait.c:72)
-Not a mutex
+Not a mutex: mutex 0x.........
at 0x........: pthread_cond_wait* (drd_pthread_intercepts.c:?)
by 0x........: main (tc23_bogus_condwait.c:75)
|
|
From: <sv...@va...> - 2008-03-24 08:48:09
|
Author: bart
Date: 2008-03-24 08:48:14 +0000 (Mon, 24 Mar 2008)
New Revision: 7771
Log:
Merged trunk changes r7760:7770 to DRDDEV branch.
Modified:
branches/DRDDEV/exp-drd/TODO.txt
branches/DRDDEV/exp-drd/docs/README.txt
branches/DRDDEV/exp-drd/drd_clientreq.c
branches/DRDDEV/exp-drd/drd_clientreq.h
branches/DRDDEV/exp-drd/drd_main.c
branches/DRDDEV/exp-drd/drd_mutex.c
branches/DRDDEV/exp-drd/drd_mutex.h
branches/DRDDEV/exp-drd/drd_pthread_intercepts.c
branches/DRDDEV/exp-drd/drd_track.h
branches/DRDDEV/glibc-2.X-drd.supp
Modified: branches/DRDDEV/exp-drd/TODO.txt
===================================================================
--- branches/DRDDEV/exp-drd/TODO.txt 2008-03-24 08:35:03 UTC (rev 7770)
+++ branches/DRDDEV/exp-drd/TODO.txt 2008-03-24 08:48:14 UTC (rev 7771)
@@ -4,26 +4,15 @@
Data-race detection algorithm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- Implement segment merging, such that the number of segments per thread
- remains limited even when there is no synchronization between threads.
-- Add locking order checking.
-- Discuss on the Valgrind mailing list how to make it possible to call
- POSIX thread synchronization primitives from client code (drd_intercepts.c)
- without triggering Valgrind's redirection mechanism.
- Make sure -v works again with exp-drd.
+- Add locking order checking.
- Continue the discussion on the Valgrind mailing list about docbook and
'make dist'.
-- Continue the discussion on the Valgrind mailing list about -Wformat.
-- Enable format string checking for DRD during compilation.
-- Propose to modify tl_assert() / vg_assert() such that it uses
- __builtin_expect.
- Explain on the Valgrind mailing list the difference between a bus lock
and acquire / release labels.
- Add configure tests for the name of the 'kind' member in pthread_mutex_t.
- Find out why a race is reported on std::string::string(std::string const&)
(stc test case 16).
-- Find out why no races are reported on matinv_openmp.c when "private(k)" is
- removed.
- Add support for objects that are shared over threads and that use reference
counting, e.g. std::string -- no races should be reported on the reference
count.
@@ -35,18 +24,14 @@
- Find out why no line number or variable name information is printed for
races detected in parallel sections of OpenMP programs. An example:
./vg-in-place --tool=exp-drd exp-drd/tests/omp_prime 4 -t 2
-- Find a way for suppressing races reported on _IO_2_1_stdout. This race is
- triggered by calling printf() from more than one thread. Examples (AMD64):
- ./vg-in-place --tool=exp-drd exp-drd/tests/tc21_pthonce
- Find out why 'matinv 400' runs faster in 32-bit mode than in 64-bit mode
on the same CPU.
- testing on PPC and AIX (current implementation is only tested on X86 and
AMD64).
- Convert the array in drd_thread.c with thread information into an OSet.
-- Performance testing and tuning.
-- Optimize run time of the following test case:
- ./vg-in-place --tool=exp-drd exp-drd/tests/matinv 100
+- Performance testing and tuning, a.o. for kate / knode / open office / matinv.
+
Testing
~~~~~~~
- testing with more complex multithreaded test programs.
@@ -68,13 +53,3 @@
~~~~~~~~~~~
- Does not work with a glibc library compiled with linuxthreads -- NPTL is
required for proper operation.
-
-
-Known bugs
-~~~~~~~~~~
-- Gets killed by the OOM handler for realistically sized applications,
- e.g. knode and OpenOffice.
-- [x86_64] Reports "Allocation context: unknown" for BSS symbols on AMD64
- (works fine on i386). This is a bug in Valgrind's debug info reader
- -- VG_(find_seginfo)() returns NULL for BSS symbols on x86_64. Not yet in
- the KDE bug tracking system.
Modified: branches/DRDDEV/exp-drd/docs/README.txt
===================================================================
--- branches/DRDDEV/exp-drd/docs/README.txt 2008-03-24 08:35:03 UTC (rev 7770)
+++ branches/DRDDEV/exp-drd/docs/README.txt 2008-03-24 08:48:14 UTC (rev 7771)
@@ -301,10 +301,7 @@
Future DRD Versions
-------------------
The following may be expected in future versions of DRD:
-* Drastically reduced memory consumption, such that realistic applications can
- be analyzed with DRD.
* A lock dependency analyzer, as a help in deadlock prevention.
-* Faster operation.
* More extensive documentation.
* Support for PowerPC CPU's.
Modified: branches/DRDDEV/exp-drd/drd_clientreq.c
===================================================================
--- branches/DRDDEV/exp-drd/drd_clientreq.c 2008-03-24 08:35:03 UTC (rev 7770)
+++ branches/DRDDEV/exp-drd/drd_clientreq.c 2008-03-24 08:48:14 UTC (rev 7771)
@@ -147,7 +147,7 @@
case VG_USERREQ__PRE_MUTEX_LOCK:
if (thread_enter_synchr(drd_tid) == 0)
- drd_pre_mutex_lock(arg[1], arg[2]);
+ drd_pre_mutex_lock(arg[1], arg[2], arg[3]);
break;
case VG_USERREQ__POST_MUTEX_LOCK:
Modified: branches/DRDDEV/exp-drd/drd_clientreq.h
===================================================================
--- branches/DRDDEV/exp-drd/drd_clientreq.h 2008-03-24 08:35:03 UTC (rev 7770)
+++ branches/DRDDEV/exp-drd/drd_clientreq.h 2008-03-24 08:48:14 UTC (rev 7771)
@@ -57,7 +57,7 @@
/* args: Addr, MutexT */
/* to notify the drd tool of pthread_mutex_lock calls */
VG_USERREQ__PRE_MUTEX_LOCK,
- /* args: Addr, MutexT */
+ /* args: Addr, MutexT, Bool */
/* to notify the drd tool of pthread_mutex_lock calls */
VG_USERREQ__POST_MUTEX_LOCK,
/* args: Addr, Bool */
Modified: branches/DRDDEV/exp-drd/drd_main.c
===================================================================
--- branches/DRDDEV/exp-drd/drd_main.c 2008-03-24 08:35:03 UTC (rev 7770)
+++ branches/DRDDEV/exp-drd/drd_main.c 2008-03-24 08:48:14 UTC (rev 7771)
@@ -628,9 +628,10 @@
mutex_post_destroy(mutex);
}
-void drd_pre_mutex_lock(const Addr mutex, const MutexT mutex_type)
+void drd_pre_mutex_lock(const Addr mutex, const MutexT mutex_type,
+ const Bool trylock)
{
- mutex_pre_lock(mutex, mutex_type);
+ mutex_pre_lock(mutex, mutex_type, trylock);
}
void drd_post_mutex_lock(const Addr mutex, const Bool took_lock)
Modified: branches/DRDDEV/exp-drd/drd_mutex.c
===================================================================
--- branches/DRDDEV/exp-drd/drd_mutex.c 2008-03-24 08:35:03 UTC (rev 7770)
+++ branches/DRDDEV/exp-drd/drd_mutex.c 2008-03-24 08:48:14 UTC (rev 7771)
@@ -201,14 +201,12 @@
* an attempt is made to lock recursively a synchronization object that must
* not be locked recursively.
*/
-void mutex_pre_lock(const Addr mutex, MutexT mutex_type)
+void mutex_pre_lock(const Addr mutex, const MutexT mutex_type,
+ const Bool trylock)
{
struct mutex_info* p;
p = mutex_get_or_allocate(mutex, mutex_type);
-
- tl_assert(p);
-
if (s_trace_mutex)
{
VG_(message)(Vg_UserMsg,
@@ -217,10 +215,23 @@
thread_get_running_tid(),
mutex_get_typename(p),
mutex,
- p->recursion_count,
- p->owner);
+ p ? p->recursion_count : -1,
+ p ? p->owner : DRD_INVALID_THREADID);
}
+ if (p == 0)
+ {
+ GenericErrInfo GEI;
+ VG_(maybe_record_error)(VG_(get_running_tid)(),
+ GenericErr,
+ VG_(get_IP)(VG_(get_running_tid)()),
+ "Not a mutex",
+ &GEI);
+ return;
+ }
+
+ tl_assert(p);
+
if (mutex_type == mutex_type_invalid_mutex)
{
GenericErrInfo GEI;
@@ -232,7 +243,8 @@
return;
}
- if (p->owner == thread_get_running_tid()
+ if (! trylock
+ && p->owner == thread_get_running_tid()
&& p->recursion_count >= 1
&& mutex_type != mutex_type_recursive_mutex)
{
Modified: branches/DRDDEV/exp-drd/drd_mutex.h
===================================================================
--- branches/DRDDEV/exp-drd/drd_mutex.h 2008-03-24 08:35:03 UTC (rev 7770)
+++ branches/DRDDEV/exp-drd/drd_mutex.h 2008-03-24 08:48:14 UTC (rev 7771)
@@ -44,8 +44,8 @@
const MutexT mutex_type);
void mutex_post_destroy(const Addr mutex);
struct mutex_info* mutex_get(const Addr mutex);
-void mutex_pre_lock(const Addr mutex,
- const MutexT mutex_type);
+void mutex_pre_lock(const Addr mutex, const MutexT mutex_type,
+ const Bool trylock);
void mutex_post_lock(const Addr mutex, const Bool took_lock);
void mutex_unlock(const Addr mutex, const MutexT mutex_type);
const char* mutex_get_typename(struct mutex_info* const p);
Modified: branches/DRDDEV/exp-drd/drd_pthread_intercepts.c
===================================================================
--- branches/DRDDEV/exp-drd/drd_pthread_intercepts.c 2008-03-24 08:35:03 UTC (rev 7770)
+++ branches/DRDDEV/exp-drd/drd_pthread_intercepts.c 2008-03-24 08:48:14 UTC (rev 7771)
@@ -375,7 +375,7 @@
OrigFn fn;
VALGRIND_GET_ORIG_FN(fn);
VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__PRE_MUTEX_LOCK,
- mutex, mutex_type(mutex), 0, 0, 0);
+ mutex, mutex_type(mutex), 1, 0, 0);
CALL_FN_W_W(ret, fn, mutex);
VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_MUTEX_LOCK,
mutex, ret == 0, 0, 0, 0);
Modified: branches/DRDDEV/exp-drd/drd_track.h
===================================================================
--- branches/DRDDEV/exp-drd/drd_track.h 2008-03-24 08:35:03 UTC (rev 7770)
+++ branches/DRDDEV/exp-drd/drd_track.h 2008-03-24 08:48:14 UTC (rev 7771)
@@ -29,7 +29,8 @@
void drd_pre_mutex_init(Addr mutex, const MutexT mutex_type);
void drd_post_mutex_destroy(Addr mutex, const MutexT mutex_type);
-void drd_pre_mutex_lock(const Addr mutex, const MutexT mutex_type);
+void drd_pre_mutex_lock(const Addr mutex, const MutexT mutex_type,
+ const Bool trylock);
void drd_post_mutex_lock(Addr mutex, const Bool took_lock);
void drd_pre_mutex_unlock(const Addr mutex, const MutexT mutex_type);
Modified: branches/DRDDEV/glibc-2.X-drd.supp
===================================================================
--- branches/DRDDEV/glibc-2.X-drd.supp 2008-03-24 08:35:03 UTC (rev 7770)
+++ branches/DRDDEV/glibc-2.X-drd.supp 2008-03-24 08:48:14 UTC (rev 7771)
@@ -38,6 +38,13 @@
obj:/lib*/ld-*.so
}
{
+ dl-dlsym
+ exp-drd:ConflictingAccess
+ obj:/lib*/ld-*.so
+ obj:/lib*/libc-*.so
+ obj:/lib*/libdl-*.so
+}
+{
libc
exp-drd:ConflictingAccess
fun:__libc_enable_asynccancel
|
|
From: <sv...@va...> - 2008-03-24 08:34:58
|
Author: bart
Date: 2008-03-24 08:35:03 +0000 (Mon, 24 Mar 2008)
New Revision: 7770
Log:
Addresses in the range 0..ADDR0_COUNT-1 can again be stored in a bitmap.
Modified:
branches/DRDDEV/exp-drd/drd_bitmap.h
Modified: branches/DRDDEV/exp-drd/drd_bitmap.h
===================================================================
--- branches/DRDDEV/exp-drd/drd_bitmap.h 2008-03-24 08:33:47 UTC (rev 7769)
+++ branches/DRDDEV/exp-drd/drd_bitmap.h 2008-03-24 08:35:03 UTC (rev 7770)
@@ -424,7 +424,6 @@
struct bitmap2* bm2;
tl_assert(bm);
- tl_assert(a1);
bm2 = bm_cache_lookup(bm, a1);
if (bm2 == 0)
{
|
|
From: <sv...@va...> - 2008-03-24 08:33:43
|
Author: bart
Date: 2008-03-24 08:33:47 +0000 (Mon, 24 Mar 2008)
New Revision: 7769
Log:
Make sure no error message is printed when pthread_mutex_trylock() is called on a non-recursive mutex from the thread that holds a lock on the mutex.
Modified:
trunk/exp-drd/drd_clientreq.c
trunk/exp-drd/drd_clientreq.h
trunk/exp-drd/drd_main.c
trunk/exp-drd/drd_mutex.c
trunk/exp-drd/drd_mutex.h
trunk/exp-drd/drd_pthread_intercepts.c
trunk/exp-drd/drd_track.h
Modified: trunk/exp-drd/drd_clientreq.c
===================================================================
--- trunk/exp-drd/drd_clientreq.c 2008-03-24 06:41:30 UTC (rev 7768)
+++ trunk/exp-drd/drd_clientreq.c 2008-03-24 08:33:47 UTC (rev 7769)
@@ -147,7 +147,7 @@
case VG_USERREQ__PRE_MUTEX_LOCK:
if (thread_enter_synchr(drd_tid) == 0)
- drd_pre_mutex_lock(arg[1], arg[2]);
+ drd_pre_mutex_lock(arg[1], arg[2], arg[3]);
break;
case VG_USERREQ__POST_MUTEX_LOCK:
Modified: trunk/exp-drd/drd_clientreq.h
===================================================================
--- trunk/exp-drd/drd_clientreq.h 2008-03-24 06:41:30 UTC (rev 7768)
+++ trunk/exp-drd/drd_clientreq.h 2008-03-24 08:33:47 UTC (rev 7769)
@@ -57,7 +57,7 @@
/* args: Addr, MutexT */
/* to notify the drd tool of pthread_mutex_lock calls */
VG_USERREQ__PRE_MUTEX_LOCK,
- /* args: Addr, MutexT */
+ /* args: Addr, MutexT, Bool */
/* to notify the drd tool of pthread_mutex_lock calls */
VG_USERREQ__POST_MUTEX_LOCK,
/* args: Addr, Bool */
Modified: trunk/exp-drd/drd_main.c
===================================================================
--- trunk/exp-drd/drd_main.c 2008-03-24 06:41:30 UTC (rev 7768)
+++ trunk/exp-drd/drd_main.c 2008-03-24 08:33:47 UTC (rev 7769)
@@ -628,9 +628,10 @@
mutex_post_destroy(mutex);
}
-void drd_pre_mutex_lock(const Addr mutex, const MutexT mutex_type)
+void drd_pre_mutex_lock(const Addr mutex, const MutexT mutex_type,
+ const Bool trylock)
{
- mutex_pre_lock(mutex, mutex_type);
+ mutex_pre_lock(mutex, mutex_type, trylock);
}
void drd_post_mutex_lock(const Addr mutex, const Bool took_lock)
Modified: trunk/exp-drd/drd_mutex.c
===================================================================
--- trunk/exp-drd/drd_mutex.c 2008-03-24 06:41:30 UTC (rev 7768)
+++ trunk/exp-drd/drd_mutex.c 2008-03-24 08:33:47 UTC (rev 7769)
@@ -201,14 +201,12 @@
* an attempt is made to lock recursively a synchronization object that must
* not be locked recursively.
*/
-void mutex_pre_lock(const Addr mutex, MutexT mutex_type)
+void mutex_pre_lock(const Addr mutex, const MutexT mutex_type,
+ const Bool trylock)
{
struct mutex_info* p;
p = mutex_get_or_allocate(mutex, mutex_type);
-
- tl_assert(p);
-
if (s_trace_mutex)
{
VG_(message)(Vg_UserMsg,
@@ -217,10 +215,23 @@
thread_get_running_tid(),
mutex_get_typename(p),
mutex,
- p->recursion_count,
- p->owner);
+ p ? p->recursion_count : -1,
+ p ? p->owner : DRD_INVALID_THREADID);
}
+ if (p == 0)
+ {
+ GenericErrInfo GEI;
+ VG_(maybe_record_error)(VG_(get_running_tid)(),
+ GenericErr,
+ VG_(get_IP)(VG_(get_running_tid)()),
+ "Not a mutex",
+ &GEI);
+ return;
+ }
+
+ tl_assert(p);
+
if (mutex_type == mutex_type_invalid_mutex)
{
GenericErrInfo GEI;
@@ -232,7 +243,8 @@
return;
}
- if (p->owner == thread_get_running_tid()
+ if (! trylock
+ && p->owner == thread_get_running_tid()
&& p->recursion_count >= 1
&& mutex_type != mutex_type_recursive_mutex)
{
Modified: trunk/exp-drd/drd_mutex.h
===================================================================
--- trunk/exp-drd/drd_mutex.h 2008-03-24 06:41:30 UTC (rev 7768)
+++ trunk/exp-drd/drd_mutex.h 2008-03-24 08:33:47 UTC (rev 7769)
@@ -44,8 +44,8 @@
const MutexT mutex_type);
void mutex_post_destroy(const Addr mutex);
struct mutex_info* mutex_get(const Addr mutex);
-void mutex_pre_lock(const Addr mutex,
- const MutexT mutex_type);
+void mutex_pre_lock(const Addr mutex, const MutexT mutex_type,
+ const Bool trylock);
void mutex_post_lock(const Addr mutex, const Bool took_lock);
void mutex_unlock(const Addr mutex, const MutexT mutex_type);
const char* mutex_get_typename(struct mutex_info* const p);
Modified: trunk/exp-drd/drd_pthread_intercepts.c
===================================================================
--- trunk/exp-drd/drd_pthread_intercepts.c 2008-03-24 06:41:30 UTC (rev 7768)
+++ trunk/exp-drd/drd_pthread_intercepts.c 2008-03-24 08:33:47 UTC (rev 7769)
@@ -375,7 +375,7 @@
OrigFn fn;
VALGRIND_GET_ORIG_FN(fn);
VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__PRE_MUTEX_LOCK,
- mutex, mutex_type(mutex), 0, 0, 0);
+ mutex, mutex_type(mutex), 1, 0, 0);
CALL_FN_W_W(ret, fn, mutex);
VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_MUTEX_LOCK,
mutex, ret == 0, 0, 0, 0);
Modified: trunk/exp-drd/drd_track.h
===================================================================
--- trunk/exp-drd/drd_track.h 2008-03-24 06:41:30 UTC (rev 7768)
+++ trunk/exp-drd/drd_track.h 2008-03-24 08:33:47 UTC (rev 7769)
@@ -29,7 +29,8 @@
void drd_pre_mutex_init(Addr mutex, const MutexT mutex_type);
void drd_post_mutex_destroy(Addr mutex, const MutexT mutex_type);
-void drd_pre_mutex_lock(const Addr mutex, const MutexT mutex_type);
+void drd_pre_mutex_lock(const Addr mutex, const MutexT mutex_type,
+ const Bool trylock);
void drd_post_mutex_lock(Addr mutex, const Bool took_lock);
void drd_pre_mutex_unlock(const Addr mutex, const MutexT mutex_type);
|
|
From: <sv...@va...> - 2008-03-24 06:41:24
|
Author: bart
Date: 2008-03-24 06:41:30 +0000 (Mon, 24 Mar 2008)
New Revision: 7768
Log:
Extended bitmap lookup cache from one to four elements.
Modified:
trunk/exp-drd/drd_bitmap.c
trunk/exp-drd/drd_bitmap.h
trunk/exp-drd/pub_drd_bitmap.h
Modified: trunk/exp-drd/drd_bitmap.c
===================================================================
--- trunk/exp-drd/drd_bitmap.c 2008-03-24 06:38:39 UTC (rev 7767)
+++ trunk/exp-drd/drd_bitmap.c 2008-03-24 06:41:30 UTC (rev 7768)
@@ -51,6 +51,7 @@
struct bitmap* bm_new()
{
+ unsigned i;
struct bitmap* bm;
// If this assert fails, fix the definition of BITS_PER_BITS_PER_UWORD
@@ -59,8 +60,11 @@
bm = VG_(malloc)(sizeof(*bm));
tl_assert(bm);
- bm->last_lookup_a1 = 0;
- bm->last_lookup_result = 0;
+ for (i = 0; i < N_CACHE_ELEM; i++)
+ {
+ bm->cache[i].a1 = 0;
+ bm->cache[i].bm2 = 0;
+ }
bm->oset = VG_(OSetGen_Create)(0, 0, VG_(malloc), VG_(free));
s_bitmap_creation_count++;
@@ -743,6 +747,8 @@
{
unsigned k;
+ tl_assert(bm2l);
+ tl_assert(bm2r);
tl_assert(bm2l->addr == bm2r->addr);
for (k = 0; k < BITMAP1_UWORD_COUNT; k++)
@@ -764,7 +770,7 @@
{ 0 + ADDR0_COUNT, 1, eLoad },
{ 666 + ADDR0_COUNT, 4, eLoad },
{ 667 + ADDR0_COUNT, 2, eStore },
- { -1 + 2*ADDR0_COUNT, 1, eStore },
+ { -2 + 2*ADDR0_COUNT, 1, eStore },
{ 0x0001ffffUL, 1, eLoad },
{ 0x0002ffffUL, 1, eLoad },
{ 0x00ffffffUL, 1, eLoad },
Modified: trunk/exp-drd/drd_bitmap.h
===================================================================
--- trunk/exp-drd/drd_bitmap.h 2008-03-24 06:38:39 UTC (rev 7767)
+++ trunk/exp-drd/drd_bitmap.h 2008-03-24 06:41:30 UTC (rev 7768)
@@ -23,8 +23,8 @@
*/
-#ifndef __DRD_BITMAP3_H
-#define __DRD_BITMAP3_H
+#ifndef __DRD_BITMAP_H
+#define __DRD_BITMAP_H
#include "pub_tool_oset.h"
@@ -75,7 +75,7 @@
#define UWORD_HIGHEST_ADDRESS(a) ((a) | (BITS_PER_UWORD - 1))
-/* Local constants. */
+/* Local variables. */
static ULong s_bitmap2_creation_count;
@@ -151,20 +151,107 @@
/*********************************************************************/
+/* Second level bitmap. */
struct bitmap2
{
- Addr addr; ///< address >> ADDR0_BITS
+ Addr addr; ///< address >> ADDR0_BITS
struct bitmap1 bm1;
};
+struct bm_cache_elem
+{
+ Addr a1;
+ struct bitmap2* bm2;
+};
+
+#define N_CACHE_ELEM 4
+
/* Complete bitmap. */
struct bitmap
{
- Addr last_lookup_a1;
- struct bitmap2* last_lookup_result;
- OSet* oset;
+ struct bm_cache_elem cache[N_CACHE_ELEM];
+ OSet* oset;
};
+
+static __inline__
+struct bitmap2* bm_cache_lookup(const struct bitmap* const bm, const UWord a1)
+{
+ tl_assert(bm);
+
+#if N_CACHE_ELEM > 8
+#error Please update the code below.
+#endif
+#if N_CACHE_ELEM >= 1
+ if (a1 == bm->cache[0].a1)
+ return bm->cache[0].bm2;
+#endif
+#if N_CACHE_ELEM >= 2
+ if (a1 == bm->cache[1].a1)
+ return bm->cache[1].bm2;
+#endif
+#if N_CACHE_ELEM >= 3
+ if (a1 == bm->cache[2].a1)
+ return bm->cache[2].bm2;
+#endif
+#if N_CACHE_ELEM >= 4
+ if (a1 == bm->cache[3].a1)
+ return bm->cache[3].bm2;
+#endif
+#if N_CACHE_ELEM >= 5
+ if (a1 == bm->cache[4].a1)
+ return bm->cache[4].bm2;
+#endif
+#if N_CACHE_ELEM >= 6
+ if (a1 == bm->cache[5].a1)
+ return bm->cache[5].bm2;
+#endif
+#if N_CACHE_ELEM >= 7
+ if (a1 == bm->cache[6].a1)
+ return bm->cache[6].bm2;
+#endif
+#if N_CACHE_ELEM >= 8
+ if (a1 == bm->cache[7].a1)
+ return bm->cache[7].bm2;
+#endif
+ return 0;
+}
+
+static __inline__
+void bm_update_cache(struct bitmap* const bm,
+ const UWord a1,
+ struct bitmap2* const bm2)
+{
+ tl_assert(bm);
+
+#if N_CACHE_ELEM > 8
+#error Please update the code below.
+#endif
+#if N_CACHE_ELEM >= 8
+ bm->cache[7] = bm->cache[6];
+#endif
+#if N_CACHE_ELEM >= 7
+ bm->cache[6] = bm->cache[5];
+#endif
+#if N_CACHE_ELEM >= 6
+ bm->cache[5] = bm->cache[4];
+#endif
+#if N_CACHE_ELEM >= 5
+ bm->cache[4] = bm->cache[3];
+#endif
+#if N_CACHE_ELEM >= 4
+ bm->cache[3] = bm->cache[2];
+#endif
+#if N_CACHE_ELEM >= 3
+ bm->cache[2] = bm->cache[1];
+#endif
+#if N_CACHE_ELEM >= 2
+ bm->cache[1] = bm->cache[0];
+#endif
+ bm->cache[0].a1 = a1;
+ bm->cache[0].bm2 = bm2;
+}
+
/** Look up the address a1 in bitmap bm.
* @param a1 client address shifted right by ADDR0_BITS.
* @param bm bitmap pointer.
@@ -172,30 +259,30 @@
static __inline__
struct bitmap2* bm2_lookup(const struct bitmap* const bm, const UWord a1)
{
- struct bitmap2* result;
- if (a1 == bm->last_lookup_a1)
+ struct bitmap2* bm2;
+ bm2 = bm_cache_lookup(bm, a1);
+ if (bm2 == 0)
{
- return bm->last_lookup_result;
+ bm2 = VG_(OSetGen_Lookup)(bm->oset, &a1);
+ if (bm2)
+ {
+ bm_update_cache(*(struct bitmap**)&bm, a1, bm2);
+ }
}
- result = VG_(OSetGen_Lookup)(bm->oset, &a1);
- if (result)
- {
- ((struct bitmap*)bm)->last_lookup_a1 = a1;
- ((struct bitmap*)bm)->last_lookup_result = result;
- }
- return result;
+ return bm2;
}
static __inline__
struct bitmap2* bm2_insert(const struct bitmap* const bm, const UWord a1)
{
- struct bitmap2* const bm2 = VG_(OSetGen_AllocNode)(bm->oset, sizeof(*bm2));
+ struct bitmap2* bm2;
+
+ bm2 = VG_(OSetGen_AllocNode)(bm->oset, sizeof(*bm2));
bm2->addr = a1;
VG_(memset)(&bm2->bm1, 0, sizeof(bm2->bm1));
VG_(OSetGen_Insert)(bm->oset, bm2);
- ((struct bitmap*)bm)->last_lookup_a1 = a1;
- ((struct bitmap*)bm)->last_lookup_result = bm2;
+ bm_update_cache(*(struct bitmap**)&bm, a1, bm2);
s_bitmap2_creation_count++;
@@ -213,20 +300,18 @@
{
struct bitmap2* bm2;
- if (a1 == bm->last_lookup_a1)
- {
- return bm->last_lookup_result;
- }
-
- bm2 = VG_(OSetGen_Lookup)(bm->oset, &a1);
+ bm2 = bm_cache_lookup(bm, a1);
if (bm2 == 0)
{
- bm2 = bm2_insert(bm, a1);
+ bm2 = VG_(OSetGen_Lookup)(bm->oset, &a1);
+ if (bm2 == 0)
+ {
+ bm2 = bm2_insert(bm, a1);
+ }
+ bm_update_cache(*(struct bitmap**)&bm, a1, bm2);
}
- ((struct bitmap*)bm)->last_lookup_a1 = a1;
- ((struct bitmap*)bm)->last_lookup_result = bm2;
return bm2;
}
-#endif /* __DRD_BITMAP3_H */
+#endif /* __DRD_BITMAP_H */
Modified: trunk/exp-drd/pub_drd_bitmap.h
===================================================================
--- trunk/exp-drd/pub_drd_bitmap.h 2008-03-24 06:38:39 UTC (rev 7767)
+++ trunk/exp-drd/pub_drd_bitmap.h 2008-03-24 06:41:30 UTC (rev 7768)
@@ -28,8 +28,8 @@
// segment.
-#ifndef __DRD_BITMAP_H
-#define __DRD_BITMAP_H
+#ifndef __PUB_DRD_BITMAP_H
+#define __PUB_DRD_BITMAP_H
#include "pub_tool_basics.h" /* Addr, SizeT */
@@ -107,6 +107,7 @@
void bm_print(const struct bitmap* bm);
ULong bm_get_bitmap_creation_count(void);
ULong bm_get_bitmap2_creation_count(void);
+void bm_test(void);
-#endif /* __DRD_BITMAP_H */
+#endif /* __PUB_DRD_BITMAP_H */
|
|
From: <sv...@va...> - 2008-03-24 06:38:37
|
Author: bart
Date: 2008-03-24 06:38:39 +0000 (Mon, 24 Mar 2008)
New Revision: 7767
Log:
Added one more DRD libdl.so suppression pattern.
Modified:
trunk/glibc-2.X-drd.supp
Modified: trunk/glibc-2.X-drd.supp
===================================================================
--- trunk/glibc-2.X-drd.supp 2008-03-23 18:50:32 UTC (rev 7766)
+++ trunk/glibc-2.X-drd.supp 2008-03-24 06:38:39 UTC (rev 7767)
@@ -38,6 +38,13 @@
obj:/lib*/ld-*.so
}
{
+ dl-dlsym
+ exp-drd:ConflictingAccess
+ obj:/lib*/ld-*.so
+ obj:/lib*/libc-*.so
+ obj:/lib*/libdl-*.so
+}
+{
libc
exp-drd:ConflictingAccess
fun:__libc_enable_asynccancel
|
|
From: Tom H. <th...@cy...> - 2008-03-24 06:10:04
|
Nightly build on alvis ( i686, Red Hat 7.3 ) started at 2008-03-24 03:15:04 GMT Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 330 tests, 76 stderr failures, 1 stdout failure, 29 post failures == memcheck/tests/addressable (stderr) memcheck/tests/badjump (stderr) memcheck/tests/describe-block (stderr) memcheck/tests/erringfds (stderr) memcheck/tests/leak-0 (stderr) memcheck/tests/leak-cycle (stderr) memcheck/tests/leak-pool-0 (stderr) memcheck/tests/leak-pool-1 (stderr) memcheck/tests/leak-pool-2 (stderr) memcheck/tests/leak-pool-3 (stderr) memcheck/tests/leak-pool-4 (stderr) memcheck/tests/leak-pool-5 (stderr) memcheck/tests/leak-regroot (stderr) memcheck/tests/leak-tree (stderr) memcheck/tests/long_namespace_xml (stderr) memcheck/tests/lsframe1 (stderr) memcheck/tests/lsframe2 (stderr) memcheck/tests/malloc_free_fill (stderr) memcheck/tests/match-overrun (stderr) memcheck/tests/noisy_child (stderr) memcheck/tests/partial_load_dflt (stderr) memcheck/tests/partial_load_ok (stderr) memcheck/tests/partiallydefinedeq (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/sigkill (stderr) memcheck/tests/stack_changes (stderr) memcheck/tests/varinfo1 (stderr) memcheck/tests/varinfo2 (stderr) memcheck/tests/varinfo3 (stderr) memcheck/tests/varinfo4 (stderr) memcheck/tests/varinfo5 (stderr) memcheck/tests/varinfo6 (stderr) memcheck/tests/x86/bug152022 (stderr) memcheck/tests/x86/scalar (stderr) memcheck/tests/x86/scalar_supp (stderr) memcheck/tests/x86/xor-undef-x86 (stderr) memcheck/tests/xml1 (stderr) massif/tests/alloc-fns-A (post) massif/tests/alloc-fns-B (post) massif/tests/basic (post) massif/tests/basic2 (post) massif/tests/big-alloc (post) massif/tests/culling1 (stderr) massif/tests/culling2 (stderr) massif/tests/custom_alloc (post) massif/tests/deep-A (post) massif/tests/deep-B (stderr) massif/tests/deep-B (post) massif/tests/deep-C (stderr) massif/tests/deep-C (post) massif/tests/deep-D (post) massif/tests/ignoring (post) massif/tests/insig (post) massif/tests/long-names (post) massif/tests/long-time (post) massif/tests/new-cpp (post) massif/tests/null (post) massif/tests/one (post) massif/tests/overloaded-new (post) massif/tests/peak (post) massif/tests/peak2 (stderr) massif/tests/peak2 (post) massif/tests/realloc (stderr) massif/tests/realloc (post) massif/tests/thresholds_0_0 (post) massif/tests/thresholds_0_10 (post) massif/tests/thresholds_10_0 (post) massif/tests/thresholds_10_10 (post) massif/tests/thresholds_5_0 (post) massif/tests/thresholds_5_10 (post) massif/tests/zero1 (post) massif/tests/zero2 (post) none/tests/blockfault (stderr) none/tests/faultstatus (stderr) none/tests/mremap (stderr) none/tests/mremap2 (stdout) none/tests/shell (stderr) none/tests/shell_valid1 (stderr) none/tests/shell_valid2 (stderr) none/tests/shell_valid3 (stderr) helgrind/tests/hg01_all_ok (stderr) helgrind/tests/hg02_deadlock (stderr) helgrind/tests/hg03_inherit (stderr) helgrind/tests/hg04_race (stderr) helgrind/tests/hg05_race2 (stderr) helgrind/tests/hg06_readshared (stderr) helgrind/tests/tc01_simple_race (stderr) helgrind/tests/tc02_simple_tls (stderr) helgrind/tests/tc03_re_excl (stderr) helgrind/tests/tc05_simple_race (stderr) helgrind/tests/tc06_two_races (stderr) helgrind/tests/tc07_hbl1 (stderr) helgrind/tests/tc08_hbl2 (stderr) helgrind/tests/tc09_bad_unlock (stderr) helgrind/tests/tc11_XCHG (stderr) helgrind/tests/tc12_rwl_trivial (stderr) helgrind/tests/tc14_laog_dinphils (stderr) helgrind/tests/tc16_byterace (stderr) helgrind/tests/tc17_sembar (stderr) helgrind/tests/tc18_semabuse (stderr) helgrind/tests/tc19_shadowmem (stderr) helgrind/tests/tc20_verifywrap (stderr) helgrind/tests/tc21_pthonce (stderr) helgrind/tests/tc22_exit_w_lock (stderr) helgrind/tests/tc23_bogus_condwait (stderr) helgrind/tests/tc24_nonzero_sem (stderr) |