diff options
author | Konstantin Baladurin <k.baladurin@partner.samsung.com> | 2018-02-14 10:46:19 +0300 |
---|---|---|
committer | Konstantin Baladurin <k.baladurin@partner.samsung.com> | 2018-02-14 17:21:48 +0300 |
commit | a14840ebeb1f7a76b8d957eb39f63eef0250a872 (patch) | |
tree | e6740ab4383cfcc48b790b34c4b41b998c649786 /src/jit/jit.h | |
parent | 4d1abfbb93e614fcc88cbd848b4c718b702841ab (diff) | |
download | coreclr-a14840ebeb1f7a76b8d957eb39f63eef0250a872.tar.gz coreclr-a14840ebeb1f7a76b8d957eb39f63eef0250a872.tar.bz2 coreclr-a14840ebeb1f7a76b8d957eb39f63eef0250a872.zip |
Historam: doesn't allocate additional memory to store counts
It allows to remove deallocation in destuctor that can lead to uaf
for static Historgam's objects during shutdown.
Diffstat (limited to 'src/jit/jit.h')
-rw-r--r-- | src/jit/jit.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/jit/jit.h b/src/jit/jit.h index 00f5cb2fee..82970706cb 100644 --- a/src/jit/jit.h +++ b/src/jit/jit.h @@ -695,11 +695,12 @@ inline size_t unsigned_abs(ssize_t x) #if CALL_ARG_STATS || COUNT_BASIC_BLOCKS || COUNT_LOOPS || EMITTER_STATS || MEASURE_NODE_SIZE || MEASURE_MEM_ALLOC +#define HISTOGRAM_MAX_SIZE_COUNT 64 + class Histogram { public: - Histogram(HostAllocator* allocator, const unsigned* const sizeTable); - ~Histogram(); + Histogram(const unsigned* const sizeTable); void dump(FILE* output); void record(unsigned size); @@ -707,10 +708,9 @@ public: private: void ensureAllocated(); - HostAllocator* m_allocator; unsigned m_sizeCount; const unsigned* const m_sizeTable; - unsigned* m_counts; + unsigned m_counts[HISTOGRAM_MAX_SIZE_COUNT]; }; #endif // CALL_ARG_STATS || COUNT_BASIC_BLOCKS || COUNT_LOOPS || EMITTER_STATS || MEASURE_NODE_SIZE |