@@ -92,10 +92,11 @@ bool validate(const ContextRoot *Root) {
9292}
9393
9494inline ContextNode *allocContextNode (char *Place, GUID Guid,
95- uint32_t NrCounters, uint32_t NrCallsites,
95+ uint32_t NumCounters,
96+ uint32_t NumCallsites,
9697 ContextNode *Next = nullptr ) {
9798 assert (reinterpret_cast <uint64_t >(Place) % ExpectedAlignment == 0 );
98- return new (Place) ContextNode (Guid, NrCounters, NrCallsites , Next);
99+ return new (Place) ContextNode (Guid, NumCounters, NumCallsites , Next);
99100}
100101
101102void resetContextNode (ContextNode &Node) {
@@ -161,8 +162,8 @@ void Arena::freeArenaList(Arena *&A) {
161162// If this is the first time we hit a callsite with this (Guid) particular
162163// callee, we need to allocate.
163164ContextNode *getCallsiteSlow (GUID Guid, ContextNode **InsertionPoint,
164- uint32_t NrCounters , uint32_t NrCallsites ) {
165- auto AllocSize = ContextNode::getAllocSize (NrCounters, NrCallsites );
165+ uint32_t NumCounters , uint32_t NumCallsites ) {
166+ auto AllocSize = ContextNode::getAllocSize (NumCounters, NumCallsites );
166167 auto *Mem = __llvm_ctx_profile_current_context_root->CurrentMem ;
167168 char *AllocPlace = Mem->tryBumpAllocate (AllocSize);
168169 if (!AllocPlace) {
@@ -175,15 +176,15 @@ ContextNode *getCallsiteSlow(GUID Guid, ContextNode **InsertionPoint,
175176 Mem->allocateNewArena (getArenaAllocSize (AllocSize), Mem);
176177 AllocPlace = Mem->tryBumpAllocate (AllocSize);
177178 }
178- auto *Ret = allocContextNode (AllocPlace, Guid, NrCounters, NrCallsites ,
179+ auto *Ret = allocContextNode (AllocPlace, Guid, NumCounters, NumCallsites ,
179180 *InsertionPoint);
180181 *InsertionPoint = Ret;
181182 return Ret;
182183}
183184
184185ContextNode *__llvm_ctx_profile_get_context (void *Callee, GUID Guid,
185- uint32_t NrCounters ,
186- uint32_t NrCallsites ) {
186+ uint32_t NumCounters ,
187+ uint32_t NumCallsites ) {
187188 // fast "out" if we're not even doing contextual collection.
188189 if (!__llvm_ctx_profile_current_context_root)
189190 return TheScratchContext;
@@ -222,34 +223,34 @@ ContextNode *__llvm_ctx_profile_get_context(void *Callee, GUID Guid,
222223 Callsite = Callsite->next ();
223224 }
224225 auto *Ret = Callsite ? Callsite
225- : getCallsiteSlow (Guid, CallsiteContext, NrCounters ,
226- NrCallsites );
227- if (Ret->callsites_size () != NrCallsites ||
228- Ret->counters_size () != NrCounters )
226+ : getCallsiteSlow (Guid, CallsiteContext, NumCounters ,
227+ NumCallsites );
228+ if (Ret->callsites_size () != NumCallsites ||
229+ Ret->counters_size () != NumCounters )
229230 __sanitizer::Printf (" [ctxprof] Returned ctx differs from what's asked: "
230231 " Context: %p, Asked: %lu %u %u, Got: %lu %u %u \n " ,
231- reinterpret_cast <void *>(Ret), Guid, NrCallsites ,
232- NrCounters , Ret->guid (), Ret->callsites_size (),
232+ reinterpret_cast <void *>(Ret), Guid, NumCallsites ,
233+ NumCounters , Ret->guid (), Ret->callsites_size (),
233234 Ret->counters_size ());
234235 onContextEnter (*Ret);
235236 return Ret;
236237}
237238
238239// This should be called once for a Root. Allocate the first arena, set up the
239240// first context.
240- void setupContext (ContextRoot *Root, GUID Guid, uint32_t NrCounters ,
241- uint32_t NrCallsites ) {
241+ void setupContext (ContextRoot *Root, GUID Guid, uint32_t NumCounters ,
242+ uint32_t NumCallsites ) {
242243 __sanitizer::GenericScopedLock<__sanitizer::SpinMutex> Lock (
243244 &AllContextsMutex);
244245 // Re-check - we got here without having had taken a lock.
245246 if (Root->FirstMemBlock )
246247 return ;
247- const auto Needed = ContextNode::getAllocSize (NrCounters, NrCallsites );
248+ const auto Needed = ContextNode::getAllocSize (NumCounters, NumCallsites );
248249 auto *M = Arena::allocateNewArena (getArenaAllocSize (Needed));
249250 Root->FirstMemBlock = M;
250251 Root->CurrentMem = M;
251252 Root->FirstNode = allocContextNode (M->tryBumpAllocate (Needed), Guid,
252- NrCounters, NrCallsites );
253+ NumCounters, NumCallsites );
253254 AllContextRoots.PushBack (Root);
254255}
255256
@@ -278,19 +279,19 @@ void __llvm_ctx_profile_release_context(ContextRoot *Root)
278279}
279280
280281void __llvm_ctx_profile_start_collection () {
281- size_t NrMemUnits = 0 ;
282+ size_t NumMemUnits = 0 ;
282283 __sanitizer::GenericScopedLock<__sanitizer::SpinMutex> Lock (
283284 &AllContextsMutex);
284285 for (uint32_t I = 0 ; I < AllContextRoots.Size (); ++I) {
285286 auto *Root = AllContextRoots[I];
286287 __sanitizer::GenericScopedLock<__sanitizer::StaticSpinMutex> Lock (
287288 &Root->Taken );
288289 for (auto *Mem = Root->FirstMemBlock ; Mem; Mem = Mem->next ())
289- ++NrMemUnits ;
290+ ++NumMemUnits ;
290291
291292 resetContextNode (*Root->FirstNode );
292293 }
293- __sanitizer::Printf (" [ctxprof] Initial NrMemUnits : %zu \n " , NrMemUnits );
294+ __sanitizer::Printf (" [ctxprof] Initial NumMemUnits : %zu \n " , NumMemUnits );
294295}
295296
296297bool __llvm_ctx_profile_fetch (void *Data,
0 commit comments