Fix a sandcastle crash due to PGO mode

I'm only 95% convinced that this is the cause of a sandcastle crash.
We're not calling transCounterAddr with sequential translation ids
anymore (apparently) so it's possible that we need to allocate more than
one chunk of new counters.

I ran a sandcastle with this fix applied and it didn't crash, but the
crash wasn't 100% before, so you never know.

Reviewed By: @ottoni

Differential Revision: D1142512
Esse commit está contido em:
Owen Yamauchi
2014-01-24 11:47:47 -08:00
commit de Sara Golemon
commit a5261ea56c
+1 -1
Ver Arquivo
@@ -44,7 +44,7 @@ T ProfCounters<T>::get(uint32_t id) const {
template<typename T>
T* ProfCounters<T>::getAddr(uint32_t id) {
// allocate a new chunk of counters if necessary
if (id >= m_chunks.size() * kCountersPerChunk) {
while (id >= m_chunks.size() * kCountersPerChunk) {
uint32_t size = sizeof(T) * kCountersPerChunk;
T* chunk = (T*)malloc(size);
std::fill_n(chunk, kCountersPerChunk, m_initVal);