|
From: <sv...@va...> - 2008-10-08 23:03:14
|
Author: sewardj
Date: 2008-10-09 00:03:00 +0100 (Thu, 09 Oct 2008)
New Revision: 8652
Log:
Get rid of another layer of pointless function calls on the read/write
fast paths.
Modified:
branches/YARD/helgrind/hg_main.c
branches/YARD/helgrind/libhb.h
branches/YARD/helgrind/libhb_core.c
Modified: branches/YARD/helgrind/hg_main.c
===================================================================
--- branches/YARD/helgrind/hg_main.c 2008-10-08 21:55:49 UTC (rev 8651)
+++ branches/YARD/helgrind/hg_main.c 2008-10-08 23:03:00 UTC (rev 8652)
@@ -1054,13 +1054,13 @@
{
Thr* hbthr = thr->hbthr;
tl_assert(hbthr);
- libhb_read_N(hbthr, a, len);
+ LIBHB_READ_N(hbthr, a, len);
}
static void shadow_mem_write_range ( Thread* thr, Addr a, SizeT len ) {
Thr* hbthr = thr->hbthr;
tl_assert(hbthr);
- libhb_write_N(hbthr, a, len);
+ LIBHB_WRITE_N(hbthr, a, len);
}
static void shadow_mem_make_New ( Thread* thr, Addr a, SizeT len )
@@ -1731,70 +1731,70 @@
void evh__mem_help_read_1(Addr a) {
Thread* thr = get_current_Thread_in_C_C();
Thr* hbthr = thr->hbthr;
- libhb_read_1(hbthr, a);
+ LIBHB_READ_1(hbthr, a);
}
static VG_REGPARM(1)
void evh__mem_help_read_2(Addr a) {
Thread* thr = get_current_Thread_in_C_C();
Thr* hbthr = thr->hbthr;
- libhb_read_2(hbthr, a);
+ LIBHB_READ_2(hbthr, a);
}
static VG_REGPARM(1)
void evh__mem_help_read_4(Addr a) {
Thread* thr = get_current_Thread_in_C_C();
Thr* hbthr = thr->hbthr;
- libhb_read_4(hbthr, a);
+ LIBHB_READ_4(hbthr, a);
}
static VG_REGPARM(1)
void evh__mem_help_read_8(Addr a) {
Thread* thr = get_current_Thread_in_C_C();
Thr* hbthr = thr->hbthr;
- libhb_read_8(hbthr, a);
+ LIBHB_READ_8(hbthr, a);
}
static VG_REGPARM(2)
void evh__mem_help_read_N(Addr a, SizeT size) {
Thread* thr = get_current_Thread_in_C_C();
Thr* hbthr = thr->hbthr;
- libhb_read_N(hbthr, a, size);
+ LIBHB_READ_N(hbthr, a, size);
}
static VG_REGPARM(1)
void evh__mem_help_write_1(Addr a) {
Thread* thr = get_current_Thread_in_C_C();
Thr* hbthr = thr->hbthr;
- libhb_write_1(hbthr, a);
+ LIBHB_WRITE_1(hbthr, a);
}
static VG_REGPARM(1)
void evh__mem_help_write_2(Addr a) {
Thread* thr = get_current_Thread_in_C_C();
Thr* hbthr = thr->hbthr;
- libhb_write_2(hbthr, a);
+ LIBHB_WRITE_2(hbthr, a);
}
static VG_REGPARM(1)
void evh__mem_help_write_4(Addr a) {
Thread* thr = get_current_Thread_in_C_C();
Thr* hbthr = thr->hbthr;
- libhb_write_4(hbthr, a);
+ LIBHB_WRITE_4(hbthr, a);
}
static VG_REGPARM(1)
void evh__mem_help_write_8(Addr a) {
Thread* thr = get_current_Thread_in_C_C();
Thr* hbthr = thr->hbthr;
- libhb_write_8(hbthr, a);
+ LIBHB_WRITE_8(hbthr, a);
}
static VG_REGPARM(2)
void evh__mem_help_write_N(Addr a, SizeT size) {
Thread* thr = get_current_Thread_in_C_C();
Thr* hbthr = thr->hbthr;
- libhb_write_N(hbthr, a, size);
+ LIBHB_WRITE_N(hbthr, a, size);
}
static void evh__bus_lock(void) {
Modified: branches/YARD/helgrind/libhb.h
===================================================================
--- branches/YARD/helgrind/libhb.h 2008-10-08 21:55:49 UTC (rev 8651)
+++ branches/YARD/helgrind/libhb.h 2008-10-08 23:03:00 UTC (rev 8652)
@@ -98,21 +98,35 @@
/* Has this SO ever been sent on? */
Bool libhb_so_everSent ( SO* so );
-/* Memory accesses (1/2/4/8 byte size). Returns True if this access
- resulted in a reportable race, in which case the details are placed
- in *ri. If False is returned, the contents of *ri are unspecified
- and should not be consulted. */
-void libhb_write_1 ( Thr* thr, Addr a );
-void libhb_write_2 ( Thr* thr, Addr a );
-void libhb_write_4 ( Thr* thr, Addr a );
-void libhb_write_8 ( Thr* thr, Addr a );
-void libhb_write_N ( Thr* thr, Addr a, SizeT szB );
-void libhb_read_1 ( Thr* thr, Addr a );
-void libhb_read_2 ( Thr* thr, Addr a );
-void libhb_read_4 ( Thr* thr, Addr a );
-void libhb_read_8 ( Thr* thr, Addr a );
-void libhb_read_N ( Thr* thr, Addr a, SizeT szB );
+/* Memory accesses (1/2/4/8 byte size). They report a race if one is
+ found. */
+#define LIBHB_WRITE_1(_thr,_a) zsm_apply8___msm_write((_thr),(_a))
+#define LIBHB_WRITE_2(_thr,_a) zsm_apply16___msm_write((_thr),(_a))
+#define LIBHB_WRITE_4(_thr,_a) zsm_apply32___msm_write((_thr),(_a))
+#define LIBHB_WRITE_8(_thr,_a) zsm_apply64___msm_write((_thr),(_a))
+#define LIBHB_WRITE_N(_thr,_a,_n) zsm_apply_range___msm_read((_thr),(_a),(_n))
+#define LIBHB_READ_1(_thr,_a) zsm_apply8___msm_read((_thr),(_a))
+#define LIBHB_READ_2(_thr,_a) zsm_apply16___msm_read((_thr),(_a))
+#define LIBHB_READ_4(_thr,_a) zsm_apply32___msm_read((_thr),(_a))
+#define LIBHB_READ_8(_thr,_a) zsm_apply64___msm_read((_thr),(_a))
+#define LIBHB_READ_N(_thr,_a,_n) zsm_apply_range___msm_read((_thr),(_a),(_n))
+
+void zsm_apply8___msm_write ( Thr* thr, Addr a );
+void zsm_apply16___msm_write ( Thr* thr, Addr a );
+void zsm_apply32___msm_write ( Thr* thr, Addr a );
+void zsm_apply64___msm_write ( Thr* thr, Addr a );
+void zsm_apply_range___msm_write ( Thr* thr,
+ Addr a, SizeT len );
+
+void zsm_apply8___msm_read ( Thr* thr, Addr a );
+void zsm_apply16___msm_read ( Thr* thr, Addr a );
+void zsm_apply32___msm_read ( Thr* thr, Addr a );
+void zsm_apply64___msm_read ( Thr* thr, Addr a );
+void zsm_apply_range___msm_read ( Thr* thr,
+ Addr a, SizeT len );
+
+
/* Set memory address ranges to new (freshly allocated), or noaccess
(no longer accessible). */
void libhb_range_new ( Thr*, Addr, SizeT );
Modified: branches/YARD/helgrind/libhb_core.c
===================================================================
--- branches/YARD/helgrind/libhb_core.c 2008-10-08 21:55:49 UTC (rev 8651)
+++ branches/YARD/helgrind/libhb_core.c 2008-10-08 23:03:00 UTC (rev 8652)
@@ -3228,7 +3228,6 @@
/*------------- ZSM accesses: 8 bit apply ------------- */
-static
void zsm_apply8___msm_read ( Thr* thr, Addr a ) {
CacheLine* cl;
UWord cloff, tno, toff;
@@ -3252,7 +3251,6 @@
cl->svals[cloff] = svNew;
}
-static
void zsm_apply8___msm_write ( Thr* thr, Addr a ) {
CacheLine* cl;
UWord cloff, tno, toff;
@@ -3278,7 +3276,6 @@
/*------------- ZSM accesses: 16 bit apply ------------- */
-static
void zsm_apply16___msm_read ( Thr* thr, Addr a ) {
CacheLine* cl;
UWord cloff, tno, toff;
@@ -3312,7 +3309,6 @@
zsm_apply8___msm_read( thr, a + 1 );
}
-static
void zsm_apply16___msm_write ( Thr* thr, Addr a ) {
CacheLine* cl;
UWord cloff, tno, toff;
@@ -3348,7 +3344,6 @@
/*------------- ZSM accesses: 32 bit apply ------------- */
-static
void zsm_apply32___msm_read ( Thr* thr, Addr a ) {
CacheLine* cl;
UWord cloff, tno, toff;
@@ -3381,7 +3376,6 @@
zsm_apply16___msm_read( thr, a + 2 );
}
-static
void zsm_apply32___msm_write ( Thr* thr, Addr a ) {
CacheLine* cl;
UWord cloff, tno, toff;
@@ -3416,7 +3410,6 @@
/*------------- ZSM accesses: 64 bit apply ------------- */
-static
void zsm_apply64___msm_read ( Thr* thr, Addr a ) {
CacheLine* cl;
UWord cloff, tno, toff;
@@ -3443,7 +3436,6 @@
zsm_apply32___msm_read( thr, a + 4 );
}
-static
void zsm_apply64___msm_write ( Thr* thr, Addr a ) {
CacheLine* cl;
UWord cloff, tno, toff;
@@ -3633,8 +3625,8 @@
/* ------------ Shadow memory range setting ops ------------ */
-static void zsm_apply_range___msm_read ( Thr* thr,
- Addr a, SizeT len )
+void zsm_apply_range___msm_read ( Thr* thr,
+ Addr a, SizeT len )
{
/* fast track a couple of common cases */
if (len == 4 && aligned32(a)) {
@@ -3712,8 +3704,8 @@
-static void zsm_apply_range___msm_write ( Thr* thr,
- Addr a, SizeT len )
+void zsm_apply_range___msm_write ( Thr* thr,
+ Addr a, SizeT len )
{
/* fast track a couple of common cases */
if (len == 4 && aligned32(a)) {
@@ -4376,58 +4368,6 @@
VG_(printf)("%s","\n");
}
-void libhb_read_1 ( Thr* thr, Addr a ) {
- if(TRACEME(a,1))trace(thr,a,1,"rd-before");
- zsm_apply8___msm_read ( thr, a );
- if(TRACEME(a,1))trace(thr,a,1,"rd-after ");
-}
-void libhb_read_2 ( Thr* thr, Addr a ) {
- if(TRACEME(a,2))trace(thr,a,2,"rd-before");
- zsm_apply16___msm_read ( thr, a );
- if(TRACEME(a,2))trace(thr,a,2,"rd-after ");
-}
-void libhb_read_4 ( Thr* thr, Addr a ) {
- if(TRACEME(a,4))trace(thr,a,4,"rd-before");
- zsm_apply32___msm_read ( thr, a );
- if(TRACEME(a,4))trace(thr,a,4,"rd-after ");
-}
-void libhb_read_8 ( Thr* thr, Addr a ) {
- if(TRACEME(a,8))trace(thr,a,8,"rd-before");
- zsm_apply64___msm_read ( thr, a );
- if(TRACEME(a,8))trace(thr,a,8,"rd-after ");
-}
-void libhb_read_N ( Thr* thr, Addr a, SizeT szB ) {
- if(TRACEME(a,szB))trace(thr,a,szB,"rd-before");
- zsm_apply_range___msm_read ( thr, a, szB );
- if(TRACEME(a,szB))trace(thr,a,szB,"rd-after ");
-}
-
-void libhb_write_1 ( Thr* thr, Addr a ) {
- if(TRACEME(a,1))trace(thr,a,1,"wr-before");
- zsm_apply8___msm_write ( thr, a );
- if(TRACEME(a,1))trace(thr,a,1,"wr-after ");
-}
-void libhb_write_2 ( Thr* thr, Addr a ) {
- if(TRACEME(a,2))trace(thr,a,2,"wr-before");
- zsm_apply16___msm_write ( thr, a );
- if(TRACEME(a,2))trace(thr,a,2,"wr-after ");
-}
-void libhb_write_4 ( Thr* thr, Addr a ) {
- if(TRACEME(a,4))trace(thr,a,4,"wr-before");
- zsm_apply32___msm_write ( thr, a );
- if(TRACEME(a,4))trace(thr,a,4,"wr-after ");
-}
-void libhb_write_8 ( Thr* thr, Addr a ) {
- if(TRACEME(a,8))trace(thr,a,8,"wr-before");
- zsm_apply64___msm_write ( thr, a );
- if(TRACEME(a,8))trace(thr,a,8,"wr-after ");
-}
-void libhb_write_N ( Thr* thr, Addr a, SizeT szB ) {
- if(TRACEME(a,szB))trace(thr,a,szB,"wr-before");
- zsm_apply_range___msm_write ( thr, a, szB );
- if(TRACEME(a,szB))trace(thr,a,szB,"wr-after ");
-}
-
void libhb_range_new ( Thr* thr, Addr a, SizeT szB )
{
SVal sv = SVal__mkC(thr->viW, thr->viW);
|