indirect_memory.cc (13775:36b71cff789e) | indirect_memory.cc (13827:2764e4b4de5d) |
---|---|
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; | 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; |
|
111 switch(pfi.getSize()) { 112 case sizeof(uint8_t): 113 index = pfi.get<uint8_t>(byteOrder); 114 break; 115 case sizeof(uint16_t): 116 index = pfi.get<uint16_t>(byteOrder); 117 break; 118 case sizeof(uint32_t): 119 index = pfi.get<uint32_t>(byteOrder); 120 break; 121 case sizeof(uint64_t): 122 index = pfi.get<uint64_t>(byteOrder); 123 break; 124 default: | 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: |
125 panic("Invalid access size\n"); | 126 // Ignore non-power-of-two sizes 127 read_index = false; |
126 } | 128 } |
127 if (!pt_entry->enabled) { | 129 if (read_index && !pt_entry->enabled) { |
128 // Not enabled (no pattern detected in this stream), 129 // add or update an entry in the pattern detector and 130 // start tracking misses 131 allocateOrUpdateIPDEntry(pt_entry, index); | 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); |
132 } else { | 134 } else if (read_index) { |
133 // Enabled entry, update the index 134 pt_entry->index = index; 135 if (!pt_entry->increasedIndirectCounter) { 136 if (pt_entry->indirectCounter > 0) { 137 pt_entry->indirectCounter -= 1; 138 } 139 } else { 140 // Set this to false, to see if the new index --- 130 unchanged lines hidden --- | 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 --- |