|
From: <sv...@va...> - 2011-11-17 22:02:04
|
Author: philippe
Date: 2011-11-17 21:57:21 +0000 (Thu, 17 Nov 2011)
New Revision: 12272
Log:
The sparse wa maintains the nr of elements in use at level 0.
So, replace the code which counts the nr of bits in the level0
bitmap by just returning the nr of elements in use.
Modified:
trunk/coregrind/m_sparsewa.c
Modified: trunk/coregrind/m_sparsewa.c
===================================================================
--- trunk/coregrind/m_sparsewa.c 2011-11-16 20:43:39 UTC (rev 12271)
+++ trunk/coregrind/m_sparsewa.c 2011-11-17 21:57:21 UTC (rev 12272)
@@ -435,33 +435,21 @@
static UWord swa_sizeSWA_wrk ( void* nd )
{
Int i;
- UWord sum = 0;
if (*(UWord*)nd == LevelN_MAGIC) {
+ UWord sum = 0;
LevelN* levelN = (LevelN*)nd;
for (i = 0; i < 256; i++) {
if (levelN->child[i]) {
sum += swa_sizeSWA_wrk( levelN->child[i] );
}
- }
+ }
+ return sum;
} else {
Level0* level0;
vg_assert(*(UWord*)nd == Level0_MAGIC);
level0 = (Level0*)nd;
- for (i = 0; i < 256/8; i += 2) {
- UWord x = level0->inUse[i+0]; /* assume zero-extend */
- UWord y = level0->inUse[i+1]; /* assume zero-extend */
- /* do 'sum += popcount(x) + popcount(y)' for byte-sized x, y */
- /* unroll the loop twice so as to expose more ILP */
- x = (x & 0x55) + ((x >> 1) & 0x55);
- y = (y & 0x55) + ((y >> 1) & 0x55);
- x = (x & 0x33) + ((x >> 2) & 0x33);
- y = (y & 0x33) + ((y >> 2) & 0x33);
- x = (x & 0x0F) + ((x >> 4) & 0x0F);
- y = (y & 0x0F) + ((y >> 4) & 0x0F);
- sum += x + y;
- }
+ return level0->nInUse;
}
- return sum;
}
UWord VG_(sizeSWA) ( SparseWA* swa )
{
|