1/** 2 * Copyright (c) 2018 Metempsy Technology Consulting 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 94 unchanged lines hidden (view full) --- 103 104 // if this is a read, read the data from the cache and assume 105 // it is an index (this is only possible if the data is already 106 // in the cache), also, only indexes up to 8 bytes are 107 // considered 108 109 if (!miss && !pfi.isWrite() && pfi.getSize() <= 8) { 110 int64_t index = 0; |
111 bool read_index = true; |
112 switch(pfi.getSize()) { 113 case sizeof(uint8_t): 114 index = pfi.get<uint8_t>(byteOrder); 115 break; 116 case sizeof(uint16_t): 117 index = pfi.get<uint16_t>(byteOrder); 118 break; 119 case sizeof(uint32_t): 120 index = pfi.get<uint32_t>(byteOrder); 121 break; 122 case sizeof(uint64_t): 123 index = pfi.get<uint64_t>(byteOrder); 124 break; 125 default: |
126 // Ignore non-power-of-two sizes 127 read_index = false; |
128 } |
129 if (read_index && !pt_entry->enabled) { |
130 // Not enabled (no pattern detected in this stream), 131 // add or update an entry in the pattern detector and 132 // start tracking misses 133 allocateOrUpdateIPDEntry(pt_entry, index); |
134 } else if (read_index) { |
135 // Enabled entry, update the index 136 pt_entry->index = index; 137 if (!pt_entry->increasedIndirectCounter) { 138 if (pt_entry->indirectCounter > 0) { 139 pt_entry->indirectCounter -= 1; 140 } 141 } else { 142 // Set this to false, to see if the new index --- 130 unchanged lines hidden --- |