From 7b09869eacfe561b927de9a61c9ebcce750357cf Mon Sep 17 00:00:00 2001 From: "Daniel R. Carvalho" Date: Wed, 8 May 2019 22:18:27 +0200 Subject: [PATCH] mem-ruby: Fix MultiGrainBloomFilter accessing When accessing the page filter the page hash should be used instead of the hash of the base filter. Change-Id: I17b7c64f2a0d654c7d9a77a7bfb435385d81032c Signed-off-by: Daniel R. Carvalho Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/18739 Maintainer: Nikos Nikoleris Tested-by: kokoro Reviewed-by: Nikos Nikoleris --- src/mem/ruby/filters/MultiGrainBloomFilter.cc | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/mem/ruby/filters/MultiGrainBloomFilter.cc b/src/mem/ruby/filters/MultiGrainBloomFilter.cc index d91eb7fd0..150e0a561 100644 --- a/src/mem/ruby/filters/MultiGrainBloomFilter.cc +++ b/src/mem/ruby/filters/MultiGrainBloomFilter.cc @@ -54,21 +54,23 @@ MultiGrainBloomFilter::clear() void MultiGrainBloomFilter::set(Addr addr) { - int i = hash(addr); - assert(i < filter.size()); - assert(pageHash(addr) < pageFilter.size()); - filter[i] = 1; - pageFilter[i] = 1; + const int index = hash(addr); + assert(index < filter.size()); + filter[index] = 1; + const int page_index = pageHash(addr); + assert(page_index < pageFilter.size()); + pageFilter[page_index] = 1; } int MultiGrainBloomFilter::getCount(Addr addr) const { - int i = hash(addr); - assert(i < filter.size()); - assert(pageHash(addr) < pageFilter.size()); - return filter[i] + pageFilter[i]; + const int index = hash(addr); + const int page_index = pageHash(addr); + assert(index < filter.size()); + assert(page_index < pageFilter.size()); + return filter[index] + pageFilter[page_index]; } int -- 2.30.2