diff options
author | Xinliang David Li <davidxl@google.com> | 2016-05-14 20:12:42 +0000 |
---|---|---|
committer | Xinliang David Li <davidxl@google.com> | 2016-05-14 20:12:42 +0000 |
commit | 31e6b45c64181fbd3928856bb4a5f0081390ea3e (patch) | |
tree | 69005109496fd58761f67719aba120ec074960ae /lib/profile/InstrProfData.inc | |
parent | 6948b5e68fe7b8361951ad9a0b8a01f0b4847537 (diff) |
[profile] Eliminate dynamic memory allocation for vp writing
This is part-3 of the effort to eliminate dependency on
libc allocator in instr profiler runtime. With this change,
the profile dumper is completely free of malloc/calloc.
Value profile instr API implementation is the only remaining
piece with calloc dependency.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@269576 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/profile/InstrProfData.inc')
-rw-r--r-- | lib/profile/InstrProfData.inc | 28 |
1 files changed, 2 insertions, 26 deletions
diff --git a/lib/profile/InstrProfData.inc b/lib/profile/InstrProfData.inc index 77d44f15b..4b748f973 100644 --- a/lib/profile/InstrProfData.inc +++ b/lib/profile/InstrProfData.inc @@ -361,32 +361,11 @@ typedef struct ValueProfRecordClosure { ValueProfData *(*AllocValueProfData)(size_t TotalSizeInBytes); } ValueProfRecordClosure; -/* - * A wrapper struct that represents value profile runtime data. - * Like InstrProfRecord class which is used by profiling host tools, - * ValueProfRuntimeRecord also implements the abstract intefaces defined in - * ValueProfRecordClosure so that the runtime data can be serialized using - * shared C implementation. In this structure, NumValueSites and Nodes - * members are the primary fields while other fields hold the derived - * information for fast implementation of closure interfaces. - */ -typedef struct ValueProfRuntimeRecord { - /* Number of sites for each value profile kind. */ - const uint16_t *NumValueSites; - /* An array of linked-list headers. The size of of the array is the - * total number of value profile sites : sum(NumValueSites[*])). Each - * linked-list stores the values profiled for a value profile site. */ - ValueProfNode **Nodes; - - /* Total number of value profile kinds which have at least one - * value profile sites. */ - uint32_t NumValueKinds; - ValueProfNode **NodesKind[IPVK_Last + 1]; -} ValueProfRuntimeRecord; ValueProfRecord *getFirstValueProfRecord(ValueProfData *VPD); ValueProfRecord *getValueProfRecordNext(ValueProfRecord *VPR); InstrProfValueData *getValueProfRecordValueData(ValueProfRecord *VPR); +uint32_t getValueProfRecordHeaderSize(uint32_t NumValueSites); #undef INSTR_PROF_VALUE_PROF_DATA #endif /* INSTR_PROF_VALUE_PROF_DATA */ @@ -480,9 +459,6 @@ uint32_t getValueProfDataSize(ValueProfRecordClosure *Closure) { uint32_t Kind; uint32_t TotalSize = sizeof(ValueProfData); const void *Record = Closure->Record; - uint32_t NumValueKinds = Closure->GetNumValueKinds(Record); - if (NumValueKinds == 0) - return TotalSize; for (Kind = IPVK_First; Kind <= IPVK_Last; Kind++) { uint32_t NumValueSites = Closure->GetNumValueSites(Record, Kind); @@ -525,7 +501,7 @@ void serializeValueProfRecordFrom(ValueProfRecord *This, ValueProfData *serializeValueProfDataFrom(ValueProfRecordClosure *Closure, ValueProfData *DstData) { uint32_t Kind; - uint32_t TotalSize = + uint32_t TotalSize = DstData ? DstData->TotalSize : getValueProfDataSize(Closure); ValueProfData *VPD = |