69,70c69
< degree(p->degree),
< pcTable(pcTableAssoc, pcTableSets, name())
---
> degree(p->degree)
75,76c74,75
< std::vector<std::vector<StridePrefetcher::StrideEntry>>&
< StridePrefetcher::PCTable::allocateNewContext(int context)
---
> StridePrefetcher::PCTable*
> StridePrefetcher::findTable(int context)
78,82c77,80
< auto res = entries.insert(std::make_pair(context,
< std::vector<std::vector<StrideEntry>>(pcTableSets)));
< auto it = res.first;
< chatty_assert(res.second, "Allocating an already created context\n");
< assert(it->first == context);
---
> // Check if table for given context exists
> auto it = pcTables.find(context);
> if (it != pcTables.end())
> return &it->second;
83a82,92
> // If table does not exist yet, create one
> return allocateNewContext(context);
> }
>
> StridePrefetcher::PCTable*
> StridePrefetcher::allocateNewContext(int context)
> {
> // Create new table
> auto insertion_result = pcTables.insert(std::make_pair(context,
> PCTable(pcTableAssoc, pcTableSets, name())));
>
86,87c95,102
< std::vector<std::vector<StrideEntry>>& table = it->second;
< for (auto& set : table) {
---
> // Get iterator to new pc table, and then return a pointer to the new table
> return &(insertion_result.first->second);
> }
>
> StridePrefetcher::PCTable::PCTable(int assoc, int sets, const std::string name)
> : pcTableAssoc(assoc), pcTableSets(sets), _name(name), entries(pcTableSets)
> {
> for (auto& set : entries) {
90d104
< return table;
111a126,128
> // Get corresponding pc table
> PCTable* pcTable = findTable(master_id);
>
113c130
< StrideEntry *entry = findEntry(pc, is_secure, master_id);
---
> StrideEntry *entry = pcTable->findEntry(pc, is_secure);
167c184
< StrideEntry* entry = pcTableVictim(pc, master_id);
---
> StrideEntry* entry = pcTable->findVictim(pc);
177c194
< StridePrefetcher::pcHash(Addr pc) const
---
> StridePrefetcher::PCTable::pcHash(Addr pc) const
185c202
< StridePrefetcher::pcTableVictim(Addr pc, int master_id)
---
> StridePrefetcher::PCTable::findVictim(Addr pc)
192c209
< return &pcTable[master_id][set][way];
---
> return &entries[set][way];
196c213
< StridePrefetcher::findEntry(Addr pc, bool is_secure, int master_id)
---
> StridePrefetcher::PCTable::findEntry(Addr pc, bool is_secure)
199c216
< std::vector<StrideEntry>& set_entries = pcTable[master_id][set];
---
> std::vector<StrideEntry>& set_entries = entries[set];