Skip to content

Commit cd70d74

Browse files
committed
Code review feedback - Renaming fields using m_ style
1 parent b4d8ba7 commit cd70d74

17 files changed

+62
-62
lines changed

src/coreclr/debug/daccess/dacdbiimpl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6554,7 +6554,7 @@ HRESULT DacHeapWalker::Init(CORDB_ADDRESS start, CORDB_ADDRESS end)
65546554
j++;
65556555
}
65566556
}
6557-
gc_alloc_context globalCtx = ((ee_alloc_context)g_global_alloc_context).gc_allocation_context;
6557+
gc_alloc_context globalCtx = ((ee_alloc_context)g_global_alloc_context).m_GCAllocContext;
65586558
if (globalCtx.alloc_ptr != nullptr)
65596559
{
65606560
mAllocInfo[j].Ptr = (CORDB_ADDRESS)globalCtx.alloc_ptr;

src/coreclr/debug/daccess/request.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5767,7 +5767,7 @@ HRESULT ClrDataAccess::GetGlobalAllocationContext(
57675767
}
57685768

57695769
SOSDacEnter();
5770-
gc_alloc_context global_alloc_context = ((ee_alloc_context)g_global_alloc_context).gc_allocation_context;
5770+
gc_alloc_context global_alloc_context = ((ee_alloc_context)g_global_alloc_context).m_GCAllocContext;
57715771
*allocPtr = (CLRDATA_ADDRESS)global_alloc_context.alloc_ptr;
57725772
*allocLimit = (CLRDATA_ADDRESS)global_alloc_context.alloc_limit;
57735773
SOSDacLeave();

src/coreclr/debug/runtimeinfo/datadescriptor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ CDAC_TYPE_END(RuntimeThreadLocals)
137137

138138
CDAC_TYPE_BEGIN(EEAllocContext)
139139
CDAC_TYPE_INDETERMINATE(EEAllocContext)
140-
CDAC_TYPE_FIELD(EEAllocContext, /*GCAllocContext*/, GCAllocationContext, offsetof(ee_alloc_context, gc_allocation_context))
140+
CDAC_TYPE_FIELD(EEAllocContext, /*GCAllocContext*/, GCAllocationContext, offsetof(ee_alloc_context, m_GCAllocContext))
141141
CDAC_TYPE_END(EEAllocContext)
142142

143143
CDAC_TYPE_BEGIN(GCAllocContext)

src/coreclr/vm/amd64/JitHelpers_Slow.asm

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ LEAF_ENTRY JIT_TrialAllocSFastSP, _TEXT
180180
inc [g_global_alloc_lock]
181181
jnz JIT_NEW
182182

183-
mov rax, [g_global_alloc_context + OFFSETOF__ee_alloc_context__alloc_ptr] ; alloc_ptr
184-
mov r10, [g_global_alloc_context + OFFSETOF__ee_alloc_context__combined_limit] ; combined_limit
183+
mov rax, [g_global_alloc_context + OFFSETOF__ee_alloc_context__alloc_ptr] ; alloc_ptr
184+
mov r10, [g_global_alloc_context + OFFSETOF__ee_alloc_context__m_CombinedLimit] ; m_CombinedLimit
185185

186186
add r8, rax
187187

@@ -208,8 +208,8 @@ NESTED_ENTRY JIT_BoxFastUP, _TEXT
208208
inc [g_global_alloc_lock]
209209
jnz JIT_Box
210210

211-
mov rax, [g_global_alloc_context + OFFSETOF__ee_alloc_context__alloc_ptr] ; alloc_ptr
212-
mov r10, [g_global_alloc_context + OFFSETOF__ee_alloc_context__combined_limit] ; combined_limit
211+
mov rax, [g_global_alloc_context + OFFSETOF__ee_alloc_context__alloc_ptr] ; alloc_ptr
212+
mov r10, [g_global_alloc_context + OFFSETOF__ee_alloc_context__m_CombinedLimit] ; m_CombinedLimit
213213

214214
add r8, rax
215215

@@ -287,8 +287,8 @@ LEAF_ENTRY AllocateStringFastUP, _TEXT
287287
inc [g_global_alloc_lock]
288288
jnz FramedAllocateString
289289

290-
mov rax, [g_global_alloc_context + OFFSETOF__ee_alloc_context__alloc_ptr] ; alloc_ptr
291-
mov r10, [g_global_alloc_context + OFFSETOF__ee_alloc_context__combined_limit] ; combined_limit
290+
mov rax, [g_global_alloc_context + OFFSETOF__ee_alloc_context__alloc_ptr] ; alloc_ptr
291+
mov r10, [g_global_alloc_context + OFFSETOF__ee_alloc_context__m_CombinedLimit] ; m_CombinedLimit
292292

293293
add r8, rax
294294

@@ -343,8 +343,8 @@ LEAF_ENTRY JIT_NewArr1VC_UP, _TEXT
343343
inc [g_global_alloc_lock]
344344
jnz JIT_NewArr1
345345

346-
mov rax, [g_global_alloc_context + OFFSETOF__ee_alloc_context__alloc_ptr] ; alloc_ptr
347-
mov r10, [g_global_alloc_context + OFFSETOF__ee_alloc_context__combined_limit] ; combined_limit
346+
mov rax, [g_global_alloc_context + OFFSETOF__ee_alloc_context__alloc_ptr] ; alloc_ptr
347+
mov r10, [g_global_alloc_context + OFFSETOF__ee_alloc_context__m_CombinedLimit] ; m_CombinedLimit
348348

349349
add r8, rax
350350
jc AllocFailed
@@ -396,8 +396,8 @@ LEAF_ENTRY JIT_NewArr1OBJ_UP, _TEXT
396396
inc [g_global_alloc_lock]
397397
jnz JIT_NewArr1
398398

399-
mov rax, [g_global_alloc_context + OFFSETOF__ee_alloc_context__alloc_ptr] ; alloc_ptr
400-
mov r10, [g_global_alloc_context + OFFSETOF__ee_alloc_context__combined_limit] ; combined_limit
399+
mov rax, [g_global_alloc_context + OFFSETOF__ee_alloc_context__alloc_ptr] ; alloc_ptr
400+
mov r10, [g_global_alloc_context + OFFSETOF__ee_alloc_context__m_CombinedLimit] ; m_CombinedLimit
401401

402402
add r8, rax
403403

src/coreclr/vm/amd64/asmconstants.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,11 @@ ASMCONSTANTS_C_ASSERT(OFFSETOF__Thread__m_pFrame
112112

113113

114114
#define OFFSETOF__ee_alloc_context__alloc_ptr 0x8
115-
ASMCONSTANTS_C_ASSERT(OFFSETOF__ee_alloc_context__alloc_ptr == offsetof(ee_alloc_context, gc_allocation_context) +
115+
ASMCONSTANTS_C_ASSERT(OFFSETOF__ee_alloc_context__alloc_ptr == offsetof(ee_alloc_context, m_GCAllocContext) +
116116
offsetof(gc_alloc_context, alloc_ptr));
117117

118-
#define OFFSETOF__ee_alloc_context__combined_limit 0x0
119-
ASMCONSTANTS_C_ASSERT(OFFSETOF__ee_alloc_context__combined_limit == offsetof(ee_alloc_context, combined_limit));
118+
#define OFFSETOF__ee_alloc_context__m_CombinedLimit 0x0
119+
ASMCONSTANTS_C_ASSERT(OFFSETOF__ee_alloc_context__m_CombinedLimit == offsetof(ee_alloc_context, m_CombinedLimit));
120120

121121
#define OFFSETOF__ThreadExceptionState__m_pCurrentTracker 0x000
122122
ASMCONSTANTS_C_ASSERT(OFFSETOF__ThreadExceptionState__m_pCurrentTracker

src/coreclr/vm/comutilnative.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,7 @@ FCIMPL0(INT64, GCInterface::GetAllocatedBytesForCurrentThread)
889889

890890
INT64 currentAllocated = 0;
891891
Thread *pThread = GetThread();
892-
gc_alloc_context* ac = &t_runtime_thread_locals.alloc_context.gc_allocation_context;
892+
gc_alloc_context* ac = &t_runtime_thread_locals.alloc_context.m_GCAllocContext;
893893
currentAllocated = ac->alloc_bytes + ac->alloc_bytes_uoh - (ac->alloc_limit - ac->alloc_ptr);
894894

895895
return currentAllocated;

src/coreclr/vm/gccover.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1834,7 +1834,7 @@ void DoGcStress (PCONTEXT regs, NativeCodeVersion nativeCodeVersion)
18341834
// BUG(github #10318) - when not using allocation contexts, the alloc lock
18351835
// must be acquired here. Until fixed, this assert prevents random heap corruption.
18361836
assert(GCHeapUtilities::UseThreadAllocationContexts());
1837-
GCHeapUtilities::GetGCHeap()->StressHeap(&t_runtime_thread_locals.alloc_context.gc_allocation_context);
1837+
GCHeapUtilities::GetGCHeap()->StressHeap(&t_runtime_thread_locals.alloc_context.m_GCAllocContext);
18381838

18391839
// StressHeap can exit early w/o forcing a SuspendEE to trigger the instruction update
18401840
// We can not rely on the return code to determine if the instruction update happened

src/coreclr/vm/gcenv.ee.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ gc_alloc_context * GCToEEInterface::GetAllocContext()
443443
return nullptr;
444444
}
445445

446-
return &t_runtime_thread_locals.alloc_context.gc_allocation_context;
446+
return &t_runtime_thread_locals.alloc_context.m_GCAllocContext;
447447
}
448448

449449
void GCToEEInterface::GcEnumAllocContexts(enum_alloc_context_func* fn, void* param)
@@ -463,25 +463,25 @@ void GCToEEInterface::GcEnumAllocContexts(enum_alloc_context_func* fn, void* par
463463
ee_alloc_context* palloc_context = pThread->GetEEAllocContext();
464464
if (palloc_context != nullptr)
465465
{
466-
gc_alloc_context* ac = &palloc_context->gc_allocation_context;
466+
gc_alloc_context* ac = &palloc_context->m_GCAllocContext;
467467
fn(ac, param);
468468
// The GC may zero the alloc_ptr and alloc_limit fields of AC during enumeration and we need to keep
469-
// combined_limit up-to-date. Note that the GC has multiple threads running this enumeration concurrently
469+
// m_CombinedLimit up-to-date. Note that the GC has multiple threads running this enumeration concurrently
470470
// with no synchronization. If you need to change this code think carefully about how that concurrency
471471
// may affect the results.
472-
if (ac->alloc_limit == 0 && palloc_context->combined_limit != 0)
472+
if (ac->alloc_limit == 0 && palloc_context->m_CombinedLimit != 0)
473473
{
474-
palloc_context->combined_limit = 0;
474+
palloc_context->m_CombinedLimit = 0;
475475
}
476476
}
477477
}
478478
}
479479
else
480480
{
481-
fn(&g_global_alloc_context.gc_allocation_context, param);
482-
if (g_global_alloc_context.gc_allocation_context.alloc_limit == 0 && g_global_alloc_context.combined_limit != 0)
481+
fn(&g_global_alloc_context.m_GCAllocContext, param);
482+
if (g_global_alloc_context.m_GCAllocContext.alloc_limit == 0 && g_global_alloc_context.m_CombinedLimit != 0)
483483
{
484-
g_global_alloc_context.combined_limit = 0;
484+
g_global_alloc_context.m_CombinedLimit = 0;
485485
}
486486
}
487487
}

src/coreclr/vm/gcheaputilities.h

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ extern "C" {
1616
// This struct allows adding some state that is only visible to the EE onto the standard gc_alloc_context
1717
struct ee_alloc_context
1818
{
19-
// Any allocation that would overlap combined_limit needs to be handled by the allocation slow path.
20-
// combined_limit is the minimum of:
19+
// Any allocation that would overlap m_CombinedLimit needs to be handled by the allocation slow path.
20+
// m_CombinedLimit is the minimum of:
2121
// - gc_alloc_context.alloc_limit (the end of the current AC)
2222
// - the sampling_limit
2323
//
24-
// In the simple case that randomized sampling is disabled, combined_limit is always equal to alloc_limit.
24+
// In the simple case that randomized sampling is disabled, m_CombinedLimit is always equal to alloc_limit.
2525
//
2626
// There are two different useful interpretations for the sampling_limit. One is to treat the sampling_limit
2727
// as an address and when we allocate an object that overlaps that address we should emit a sampling event.
@@ -32,46 +32,46 @@ struct ee_alloc_context
3232
// flexible to handle those cases.
3333
//
3434
// The sampling limit isn't stored in any separate field explicitly, instead it is implied:
35-
// - if combined_limit == alloc_limit there is no sampled byte in the AC. In the budget interpretation
35+
// - if m_CombinedLimit == alloc_limit there is no sampled byte in the AC. In the budget interpretation
3636
// we can allocate (alloc_limit - alloc_ptr) unsampled bytes. We'll need a new random number after
3737
// that to determine whether future allocated bytes should be sampled.
3838
// This occurs either because the sampling feature is disabled, or because the randomized selection
3939
// of sampled bytes didn't select a byte in this AC.
40-
// - if combined_limit < alloc_limit there is a sample limit in the AC. sample_limit = combined_limit.
41-
uint8_t* combined_limit;
42-
gc_alloc_context gc_allocation_context;
40+
// - if m_CombinedLimit < alloc_limit there is a sample limit in the AC. sample_limit = m_CombinedLimit.
41+
uint8_t* m_CombinedLimit;
42+
gc_alloc_context m_GCAllocContext;
4343

4444
void init()
4545
{
4646
LIMITED_METHOD_CONTRACT;
47-
combined_limit = 0;
48-
gc_allocation_context.init();
47+
m_CombinedLimit = 0;
48+
m_GCAllocContext.init();
4949
}
5050

5151
uint8_t* getCombinedLimit()
5252
{
5353
LIMITED_METHOD_CONTRACT;
54-
return combined_limit;
54+
return m_CombinedLimit;
5555
}
5656

5757
static size_t getAllocPtrFieldOffset()
5858
{
5959
LIMITED_METHOD_CONTRACT;
60-
return offsetof(ee_alloc_context, gc_allocation_context) + offsetof(gc_alloc_context, alloc_ptr);
60+
return offsetof(ee_alloc_context, m_GCAllocContext) + offsetof(gc_alloc_context, alloc_ptr);
6161
}
6262

6363
static size_t getCombinedLimitFieldOffset()
6464
{
6565
LIMITED_METHOD_CONTRACT;
66-
return offsetof(ee_alloc_context, combined_limit);
66+
return offsetof(ee_alloc_context, m_CombinedLimit);
6767
}
6868

69-
// Regenerate the randomized sampling limit and update the combined_limit field.
69+
// Regenerate the randomized sampling limit and update the m_CombinedLimit field.
7070
inline void UpdateCombinedLimit()
7171
{
7272
// The randomized sampling feature is being submitted in stages. At this point the sampling is never
73-
// activated so combined_limit is always equal to alloc_limit.
74-
combined_limit = gc_allocation_context.alloc_limit;
73+
// activated so m_CombinedLimit is always equal to alloc_limit.
74+
m_CombinedLimit = m_GCAllocContext.alloc_limit;
7575
}
7676
};
7777

src/coreclr/vm/gchelpers.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,17 +223,17 @@ inline Object* Alloc(size_t size, GC_ALLOC_FLAGS flags)
223223
if (GCHeapUtilities::UseThreadAllocationContexts())
224224
{
225225
ee_alloc_context *threadContext = GetThreadEEAllocContext();
226-
GCStress<gc_on_alloc>::MaybeTrigger(&threadContext->gc_allocation_context);
227-
retVal = GCHeapUtilities::GetGCHeap()->Alloc(&threadContext->gc_allocation_context, size, flags);
226+
GCStress<gc_on_alloc>::MaybeTrigger(&threadContext->m_GCAllocContext);
227+
retVal = GCHeapUtilities::GetGCHeap()->Alloc(&threadContext->m_GCAllocContext, size, flags);
228228
threadContext->UpdateCombinedLimit();
229229

230230
}
231231
else
232232
{
233233
GlobalAllocLockHolder holder(&g_global_alloc_lock);
234234
ee_alloc_context *globalContext = &g_global_alloc_context;
235-
GCStress<gc_on_alloc>::MaybeTrigger(&globalContext->gc_allocation_context);
236-
retVal = GCHeapUtilities::GetGCHeap()->Alloc(&globalContext->gc_allocation_context, size, flags);
235+
GCStress<gc_on_alloc>::MaybeTrigger(&globalContext->m_GCAllocContext);
236+
retVal = GCHeapUtilities::GetGCHeap()->Alloc(&globalContext->m_GCAllocContext, size, flags);
237237
globalContext->UpdateCombinedLimit();
238238
}
239239

0 commit comments

Comments
 (0)