From: Daniel R. Carvalho Date: Wed, 8 May 2019 20:18:27 +0000 (+0200) Subject: mem-ruby: Fix MultiGrainBloomFilter accessing X-Git-Tag: v19.0.0.0~740 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7b09869eacfe561b927de9a61c9ebcce750357cf;p=gem5.git 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 --- 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