summaryrefslogtreecommitdiff
path: root/src/base
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2017-11-29 17:58:59 -0800
committerGabe Black <gabeblack@google.com>2017-12-04 23:09:47 +0000
commit4b04e3893a098044b4f46dbff0ff060260e86ca6 (patch)
tree1c24a2caa79c2f842e36fa2696da3d592dc3dfde /src/base
parentb359faa73b199b4defa42983ba17068d66beaaca (diff)
downloadgem5-4b04e3893a098044b4f46dbff0ff060260e86ca6.tar.xz
tests: Remove trietest's dependence on cprintf.
Dumping the structure of the tries being constructed was useful for debugging when the trie data structure was being developed, but the output can't be automatically verified easily, and what's considered correct depends on the specific implementation of the trie itself. To make some of the earlier tests more meaningful, additional lookups were added which verified that the correct values were returned when the nodes of the trie were in particular arrangements. Change-Id: Ib464ad1804d13fe40882da2190d7bf452da83818 Reviewed-on: https://gem5-review.googlesource.com/6223 Reviewed-by: Brandon Potter <Brandon.Potter@amd.com> Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src/base')
-rw-r--r--src/base/trie.hh4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/base/trie.hh b/src/base/trie.hh
index e6b2881ab..1d110b4e1 100644
--- a/src/base/trie.hh
+++ b/src/base/trie.hh
@@ -185,6 +185,10 @@ class Trie
Handle
insert(Key key, unsigned width, Value *val)
{
+ // We use NULL value pointers to mark internal nodes of the trie, so
+ // we don't allow inserting them as real values.
+ assert(val);
+
// Build a mask which masks off all the bits we don't care about.
Key new_mask = ~(Key)0;
if (width < MaxBits)