Skip to content

Commit fd89bb6

Browse files
committed
Add ee_alloc_context
This change is some preparatory refactoring for the randomized allocation sampling feature. We need to add more state onto allocation context but we don't want to do a breaking change of the GC interface. The new state only needs to be visible to the EE but we want it physically near the existing alloc context state for good cache locality. To accomplish this we created a new ee_alloc_context struct which contains an instance of gc_alloc_context within it. In a future PR we will add a field called combined_limit which should be used by fast allocation helpers to determine when to go down the slow path. Most of the time combined_limit has the same value as alloc_limit, but periodically we need to emit an allocation sampling event on an object that is somewhere in the middle of an AC. Using combined_limit rather than alloc_limit as the slow path trigger allows us to keep all the sampling event logic in the slow path. This PR introduces the abstraction for combined_limit and changes all the fast allocation helpers to use it, but it does not physically create the field yet. For now combined_limit is just an alias back to alloc_limit. There is also a small change in globals. Previously g_global_alloc_context was gc_alloc_context, now it is a gc_alloc_context* which points at g_global_ee_alloc_context.gc_allocation_context. Overall this PR should not cause any change in runtime behavior and compiled code should be largely identical to before assuming modest inlining and optimization by the compiler.
1 parent 42b2b19 commit fd89bb6

24 files changed

+152
-70
lines changed

src/coreclr/debug/daccess/dacdbiimpl.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6551,10 +6551,10 @@ HRESULT DacHeapWalker::Init(CORDB_ADDRESS start, CORDB_ADDRESS end)
65516551
j++;
65526552
}
65536553
}
6554-
if ((&g_global_alloc_context)->alloc_ptr != nullptr)
6554+
if (g_global_alloc_context->alloc_ptr != nullptr)
65556555
{
6556-
mAllocInfo[j].Ptr = (CORDB_ADDRESS)(&g_global_alloc_context)->alloc_ptr;
6557-
mAllocInfo[j].Limit = (CORDB_ADDRESS)(&g_global_alloc_context)->alloc_limit;
6556+
mAllocInfo[j].Ptr = (CORDB_ADDRESS)g_global_alloc_context->alloc_ptr;
6557+
mAllocInfo[j].Limit = (CORDB_ADDRESS)g_global_alloc_context->alloc_limit;
65586558
}
65596559

65606560
mThreadCount = j;

src/coreclr/debug/daccess/request.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5493,8 +5493,8 @@ HRESULT ClrDataAccess::GetGlobalAllocationContext(
54935493
}
54945494

54955495
SOSDacEnter();
5496-
*allocPtr = (CLRDATA_ADDRESS)((&g_global_alloc_context)->alloc_ptr);
5497-
*allocLimit = (CLRDATA_ADDRESS)((&g_global_alloc_context)->alloc_limit);
5496+
*allocPtr = (CLRDATA_ADDRESS)(g_global_alloc_context->alloc_ptr);
5497+
*allocLimit = (CLRDATA_ADDRESS)(g_global_alloc_context->alloc_limit);
54985498
SOSDacLeave();
54995499
return hr;
55005500
}

src/coreclr/debug/runtimeinfo/datadescriptor.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,14 @@ CDAC_TYPE_END(ThreadStore)
132132

133133
CDAC_TYPE_BEGIN(RuntimeThreadLocals)
134134
CDAC_TYPE_INDETERMINATE(RuntimeThreadLocals)
135-
CDAC_TYPE_FIELD(RuntimeThreadLocals, AllocContext, AllocContext, offsetof(RuntimeThreadLocals, alloc_context))
135+
CDAC_TYPE_FIELD(RuntimeThreadLocals, /*EEAllocContext*/, AllocContext, offsetof(RuntimeThreadLocals, alloc_context))
136136
CDAC_TYPE_END(RuntimeThreadLocals)
137137

138+
CDAC_TYPE_BEGIN(EEAllocContext)
139+
CDAC_TYPE_INDETERMINATE(EEAllocContext)
140+
CDAC_TYPE_FIELD(EEAllocContext, /*GCAllocContext*/, GCAllocationContext, offsetof(ee_alloc_context, gc_allocation_context))
141+
CDAC_TYPE_END(EEAllocContext)
142+
138143
CDAC_TYPE_BEGIN(GCAllocContext)
139144
CDAC_TYPE_INDETERMINATE(GCAllocContext)
140145
CDAC_TYPE_FIELD(GCAllocContext, /*pointer*/, Pointer, offsetof(gc_alloc_context, alloc_ptr))

src/coreclr/inc/dacvars.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ DEFINE_DACVAR(ProfControlBlock, dac__g_profControlBlock, ::g_profControlBlock)
140140
DEFINE_DACVAR(PTR_DWORD, dac__g_card_table, ::g_card_table)
141141
DEFINE_DACVAR(PTR_BYTE, dac__g_lowest_address, ::g_lowest_address)
142142
DEFINE_DACVAR(PTR_BYTE, dac__g_highest_address, ::g_highest_address)
143-
DEFINE_DACVAR(gc_alloc_context, dac__g_global_alloc_context, ::g_global_alloc_context)
143+
DEFINE_DACVAR(UNKNOWN_POINTER_TYPE, dac__g_global_alloc_context, ::g_global_alloc_context)
144144

145145
DEFINE_DACVAR(IGCHeap, dac__g_pGCHeap, ::g_pGCHeap)
146146

src/coreclr/vm/amd64/JitHelpers_Slow.asm

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ endif
169169

170170

171171
extern g_global_alloc_lock:dword
172-
extern g_global_alloc_context:qword
172+
extern g_global_ee_alloc_context:qword
173173

174174
LEAF_ENTRY JIT_TrialAllocSFastSP, _TEXT
175175

@@ -180,15 +180,15 @@ LEAF_ENTRY JIT_TrialAllocSFastSP, _TEXT
180180
inc [g_global_alloc_lock]
181181
jnz JIT_NEW
182182

183-
mov rax, [g_global_alloc_context + OFFSETOF__gc_alloc_context__alloc_ptr] ; alloc_ptr
184-
mov r10, [g_global_alloc_context + OFFSETOF__gc_alloc_context__alloc_limit] ; limit_ptr
183+
mov rax, [g_global_ee_alloc_context + OFFSETOF__ee_alloc_context__alloc_ptr] ; alloc_ptr
184+
mov r10, [g_global_ee_alloc_context + OFFSETOF__ee_alloc_context__combined_limit] ; combined_limit
185185

186186
add r8, rax
187187

188188
cmp r8, r10
189189
ja AllocFailed
190190

191-
mov qword ptr [g_global_alloc_context + OFFSETOF__gc_alloc_context__alloc_ptr], r8 ; update the alloc ptr
191+
mov qword ptr [g_global_ee_alloc_context + OFFSETOF__ee_alloc_context__alloc_ptr], r8 ; update the alloc ptr
192192
mov [rax], rcx
193193
mov [g_global_alloc_lock], -1
194194

@@ -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__gc_alloc_context__alloc_ptr] ; alloc_ptr
212-
mov r10, [g_global_alloc_context + OFFSETOF__gc_alloc_context__alloc_limit] ; limit_ptr
211+
mov rax, [g_global_ee_alloc_context + OFFSETOF__ee_alloc_context__alloc_ptr] ; alloc_ptr
212+
mov r10, [g_global_ee_alloc_context + OFFSETOF__ee_alloc_context__combined_limit] ; combined_limit
213213

214214
add r8, rax
215215

@@ -219,7 +219,7 @@ NESTED_ENTRY JIT_BoxFastUP, _TEXT
219219
test rdx, rdx
220220
je NullRef
221221

222-
mov qword ptr [g_global_alloc_context + OFFSETOF__gc_alloc_context__alloc_ptr], r8 ; update the alloc ptr
222+
mov qword ptr [g_global_ee_alloc_context + OFFSETOF__ee_alloc_context__alloc_ptr], r8 ; update the alloc ptr
223223
mov [rax], rcx
224224
mov [g_global_alloc_lock], -1
225225

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

290-
mov rax, [g_global_alloc_context + OFFSETOF__gc_alloc_context__alloc_ptr] ; alloc_ptr
291-
mov r10, [g_global_alloc_context + OFFSETOF__gc_alloc_context__alloc_limit] ; limit_ptr
290+
mov rax, [g_global_ee_alloc_context + OFFSETOF__ee_alloc_context__alloc_ptr] ; alloc_ptr
291+
mov r10, [g_global_ee_alloc_context + OFFSETOF__ee_alloc_context__combined_limit] ; combined_limit
292292

293293
add r8, rax
294294

295295
cmp r8, r10
296296
ja AllocFailed
297297

298-
mov qword ptr [g_global_alloc_context + OFFSETOF__gc_alloc_context__alloc_ptr], r8 ; update the alloc ptr
298+
mov qword ptr [g_global_ee_alloc_context + OFFSETOF__ee_alloc_context__alloc_ptr], r8 ; update the alloc ptr
299299
mov [rax], r11
300300
mov [g_global_alloc_lock], -1
301301

@@ -343,16 +343,16 @@ 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__gc_alloc_context__alloc_ptr] ; alloc_ptr
347-
mov r10, [g_global_alloc_context + OFFSETOF__gc_alloc_context__alloc_limit] ; limit_ptr
346+
mov rax, [g_global_ee_alloc_context + OFFSETOF__ee_alloc_context__alloc_ptr] ; alloc_ptr
347+
mov r10, [g_global_ee_alloc_context + OFFSETOF__ee_alloc_context__combined_limit] ; combined_limit
348348

349349
add r8, rax
350350
jc AllocFailed
351351

352352
cmp r8, r10
353353
ja AllocFailed
354354

355-
mov qword ptr [g_global_alloc_context + OFFSETOF__gc_alloc_context__alloc_ptr], r8 ; update the alloc ptr
355+
mov qword ptr [g_global_ee_alloc_context + OFFSETOF__ee_alloc_context__alloc_ptr], r8 ; update the alloc ptr
356356
mov [rax], rcx
357357
mov [g_global_alloc_lock], -1
358358

@@ -396,15 +396,15 @@ 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__gc_alloc_context__alloc_ptr] ; alloc_ptr
400-
mov r10, [g_global_alloc_context + OFFSETOF__gc_alloc_context__alloc_limit] ; limit_ptr
399+
mov rax, [g_global_ee_alloc_context + OFFSETOF__ee_alloc_context__alloc_ptr] ; alloc_ptr
400+
mov r10, [g_global_ee_alloc_context + OFFSETOF__ee_alloc_context__combined_limit] ; combined_limit
401401

402402
add r8, rax
403403

404404
cmp r8, r10
405405
ja AllocFailed
406406

407-
mov qword ptr [g_global_alloc_context + OFFSETOF__gc_alloc_context__alloc_ptr], r8 ; update the alloc ptr
407+
mov qword ptr [g_global_ee_alloc_context + OFFSETOF__ee_alloc_context__alloc_ptr], r8 ; update the alloc ptr
408408
mov [rax], rcx
409409
mov [g_global_alloc_lock], -1
410410

src/coreclr/vm/amd64/asmconstants.h

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,18 @@ ASMCONSTANTS_C_ASSERT(OFFSETOF__Thread__m_pFrame
111111
#define Thread_m_pFrame OFFSETOF__Thread__m_pFrame
112112

113113

114-
#define OFFSETOF__gc_alloc_context__alloc_ptr 0x0
115-
ASMCONSTANT_OFFSETOF_ASSERT(gc_alloc_context, alloc_ptr);
116-
117-
#define OFFSETOF__gc_alloc_context__alloc_limit 0x8
118-
ASMCONSTANT_OFFSETOF_ASSERT(gc_alloc_context, alloc_limit);
114+
#define OFFSETOF__ee_alloc_context__alloc_ptr 0x0
115+
ASMCONSTANTS_C_ASSERT(OFFSETOF__ee_alloc_context__alloc_ptr == offsetof(ee_alloc_context, gc_allocation_context) +
116+
offsetof(gc_alloc_context, alloc_ptr));
117+
118+
// combined_limit is a new field we plan to add as part of the randomized allocation sampling feature. In preparation
119+
// for adding that feature we are doing some refactoring. Once the feature is complete, either
120+
// combined_limit = alloc_limit when sampling is disabled or combined_limit = MIN(sampling_limit, alloc_limit) when sampling
121+
// is enabled. Because sampling is never enabled right now and the combined_limit field doesn't exist yet, this offset
122+
// continues to point at the alloc_limit field.
123+
#define OFFSETOF__ee_alloc_context__combined_limit 0x8
124+
ASMCONSTANTS_C_ASSERT(OFFSETOF__ee_alloc_context__combined_limit == offsetof(ee_alloc_context, gc_allocation_context) +
125+
offsetof(gc_alloc_context, alloc_limit));
119126

120127
#define OFFSETOF__ThreadExceptionState__m_pCurrentTracker 0x000
121128
ASMCONSTANTS_C_ASSERT(OFFSETOF__ThreadExceptionState__m_pCurrentTracker

src/coreclr/vm/common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ typedef VPTR(class VirtualCallStubManager) PTR_VirtualCallStubManager;
159159
typedef VPTR(class VirtualCallStubManagerManager) PTR_VirtualCallStubManagerManager;
160160
typedef VPTR(class IGCHeap) PTR_IGCHeap;
161161
typedef VPTR(class ModuleBase) PTR_ModuleBase;
162+
typedef DPTR(struct gc_alloc_context) PTR_gc_alloc_context;
162163

163164
//
164165
// _UNCHECKED_OBJECTREF is for code that can't deal with DEBUG OBJECTREFs

src/coreclr/vm/comutilnative.cpp

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

849849
INT64 currentAllocated = 0;
850850
Thread *pThread = GetThread();
851-
gc_alloc_context* ac = &t_runtime_thread_locals.alloc_context;
851+
gc_alloc_context* ac = &t_runtime_thread_locals.alloc_context.gc_allocation_context;
852852
currentAllocated = ac->alloc_bytes + ac->alloc_bytes_uoh - (ac->alloc_limit - ac->alloc_ptr);
853853

854854
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);
1837+
GCHeapUtilities::GetGCHeap()->StressHeap(&t_runtime_thread_locals.alloc_context.gc_allocation_context);
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: 2 additions & 2 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;
446+
return &t_runtime_thread_locals.alloc_context.gc_allocation_context;
447447
}
448448

449449
void GCToEEInterface::GcEnumAllocContexts(enum_alloc_context_func* fn, void* param)
@@ -469,7 +469,7 @@ void GCToEEInterface::GcEnumAllocContexts(enum_alloc_context_func* fn, void* par
469469
}
470470
else
471471
{
472-
fn(&g_global_alloc_context, param);
472+
fn(g_global_alloc_context, param);
473473
}
474474
}
475475

src/coreclr/vm/gcheaputilities.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ bool g_sw_ww_enabled_for_gc_heap = false;
4141

4242
#endif // FEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP
4343

44-
GVAL_IMPL_INIT(gc_alloc_context, g_global_alloc_context, {});
44+
ee_alloc_context g_global_ee_alloc_context = {};
45+
GPTR_IMPL_INIT(gc_alloc_context, g_global_alloc_context, &(g_global_ee_alloc_context.gc_allocation_context));
4546

4647
enum GC_LOAD_STATUS {
4748
GC_LOAD_STATUS_BEFORE_START,

src/coreclr/vm/gcheaputilities.h

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,45 @@ GPTR_DECL(IGCHeap, g_pGCHeap);
1212
#ifndef DACCESS_COMPILE
1313
extern "C" {
1414
#endif // !DACCESS_COMPILE
15+
16+
// This struct allows adding some state that is only visible to the EE onto the standard gc_alloc_context
17+
// Right now there is no additional state, but we are planning to add a field as part of the randomized allocation
18+
// sampling feature. Adding the struct now is some preparatory refactoring to make that change easier.
19+
typedef struct _ee_alloc_context
20+
{
21+
gc_alloc_context gc_allocation_context;
22+
23+
void init()
24+
{
25+
LIMITED_METHOD_CONTRACT;
26+
gc_allocation_context.init();
27+
}
28+
29+
// Once the randomized allocation sampling feature is enabled, this will return the lower of the alloc_limit
30+
// or the sampling_limit. When sampling is disabled combined limit is always the same as alloc_limit.
31+
// Right now the feature is not yet complete so this method always returns alloc_limit.
32+
uint8_t* getCombinedLimit()
33+
{
34+
LIMITED_METHOD_CONTRACT;
35+
return gc_allocation_context.alloc_limit;
36+
}
37+
38+
static size_t getAllocPtrFieldOffset()
39+
{
40+
LIMITED_METHOD_CONTRACT;
41+
return offsetof(_ee_alloc_context, gc_allocation_context) + offsetof(gc_alloc_context, alloc_ptr);
42+
}
43+
44+
// Once the randomized allocation sampling feature is enabled, this will return the offset of the combined_limit
45+
// field. Right now it returns the offset of the alloc_limit field instead.
46+
static size_t getCombinedLimitFieldOffset()
47+
{
48+
LIMITED_METHOD_CONTRACT;
49+
return offsetof(_ee_alloc_context, gc_allocation_context) + offsetof(gc_alloc_context, alloc_limit);
50+
}
51+
52+
} ee_alloc_context;
53+
1554
GPTR_DECL(uint8_t,g_lowest_address);
1655
GPTR_DECL(uint8_t,g_highest_address);
1756
GPTR_DECL(uint32_t,g_card_table);
@@ -21,7 +60,11 @@ GVAL_DECL(GCHeapType, g_heap_type);
2160
// for all allocations. In order to avoid extra indirections in assembly
2261
// allocation helpers, the EE owns the global allocation context and the
2362
// GC will update it when it needs to.
24-
GVAL_DECL(gc_alloc_context, g_global_alloc_context);
63+
extern "C" ee_alloc_context g_global_ee_alloc_context;
64+
65+
// This is a pointer into the g_global_ee_alloc_context.gc_allocation_context, the GC visible portion
66+
// of the global alloc context.
67+
GPTR_DECL(gc_alloc_context, g_global_alloc_context);
2568
#ifndef DACCESS_COMPILE
2669
}
2770
#endif // !DACCESS_COMPILE

src/coreclr/vm/gchelpers.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ inline gc_alloc_context* GetThreadAllocContext()
4646

4747
assert(GCHeapUtilities::UseThreadAllocationContexts());
4848

49-
return &t_runtime_thread_locals.alloc_context;
49+
return &t_runtime_thread_locals.alloc_context.gc_allocation_context;
5050
}
5151

5252
// When not using per-thread allocation contexts, we (the EE) need to take care that
@@ -229,7 +229,7 @@ inline Object* Alloc(size_t size, GC_ALLOC_FLAGS flags)
229229
else
230230
{
231231
GlobalAllocLockHolder holder(&g_global_alloc_lock);
232-
gc_alloc_context *globalContext = &g_global_alloc_context;
232+
gc_alloc_context *globalContext = g_global_alloc_context;
233233
GCStress<gc_on_alloc>::MaybeTrigger(globalContext);
234234
retVal = GCHeapUtilities::GetGCHeap()->Alloc(globalContext, size, flags);
235235
}

src/coreclr/vm/gcstress.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ namespace _GCStress
298298
// BUG(github #10318) - when not using allocation contexts, the alloc lock
299299
// must be acquired here. Until fixed, this assert prevents random heap corruption.
300300
_ASSERTE(GCHeapUtilities::UseThreadAllocationContexts());
301-
GCHeapUtilities::GetGCHeap()->StressHeap(&t_runtime_thread_locals.alloc_context);
301+
GCHeapUtilities::GetGCHeap()->StressHeap(&t_runtime_thread_locals.alloc_context.gc_allocation_context);
302302
}
303303

304304
FORCEINLINE

src/coreclr/vm/i386/jitinterfacex86.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -237,29 +237,29 @@ void JIT_TrialAlloc::EmitCore(CPUSTUBLINKER *psl, CodeLabel *noLock, CodeLabel *
237237

238238
if (flags & (ALIGN8 | SIZE_IN_EAX | ALIGN8OBJ))
239239
{
240-
// MOV EBX, [edx]gc_alloc_context.alloc_ptr
241-
psl->X86EmitOffsetModRM(0x8B, kEBX, kEDX, offsetof(gc_alloc_context, alloc_ptr));
240+
// MOV EBX, [edx]alloc_context.gc_allocation_context.alloc_ptr
241+
psl->X86EmitOffsetModRM(0x8B, kEBX, kEDX, ee_alloc_context::getAllocPtrFieldOffset());
242242
// add EAX, EBX
243243
psl->Emit16(0xC303);
244244
if (flags & ALIGN8)
245245
EmitAlignmentRoundup(psl, kEBX, kEAX, flags); // bump EAX up size by 12 if EBX unaligned (so that we are aligned)
246246
}
247247
else
248248
{
249-
// add eax, [edx]gc_alloc_context.alloc_ptr
250-
psl->X86EmitOffsetModRM(0x03, kEAX, kEDX, offsetof(gc_alloc_context, alloc_ptr));
249+
// add eax, [edx]alloc_context.gc_allocation_context.alloc_ptr
250+
psl->X86EmitOffsetModRM(0x03, kEAX, kEDX, ee_alloc_context::getAllocPtrFieldOffset());
251251
}
252252

253-
// cmp eax, [edx]gc_alloc_context.alloc_limit
254-
psl->X86EmitOffsetModRM(0x3b, kEAX, kEDX, offsetof(gc_alloc_context, alloc_limit));
253+
// cmp eax, [edx]alloc_context.combined_limit
254+
psl->X86EmitOffsetModRM(0x3b, kEAX, kEDX, ee_alloc_context::getCombinedLimitFieldOffset());
255255

256256
// ja noAlloc
257257
psl->X86EmitCondJump(noAlloc, X86CondCode::kJA);
258258

259259
// Fill in the allocation and get out.
260260

261-
// mov [edx]gc_alloc_context.alloc_ptr, eax
262-
psl->X86EmitIndexRegStore(kEDX, offsetof(gc_alloc_context, alloc_ptr), kEAX);
261+
// mov [edx]alloc_context.gc_allocation_context.alloc_ptr, eax
262+
psl->X86EmitIndexRegStore(kEDX, ee_alloc_context::getAllocPtrFieldOffset(), kEAX);
263263

264264
if (flags & (ALIGN8 | SIZE_IN_EAX | ALIGN8OBJ))
265265
{

src/coreclr/vm/i386/stublinkerx86.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2434,7 +2434,7 @@ namespace
24342434
{
24352435
gc_alloc_context* STDCALL GetAllocContextHelper()
24362436
{
2437-
return &t_runtime_thread_locals.alloc_context;
2437+
return &t_runtime_thread_locals.alloc_context.gc_allocation_context;
24382438
}
24392439
}
24402440
#endif

0 commit comments

Comments
 (0)