MCPcopy Create free account
hub / github.com/beefytech/Beef / Dbg_ObjectAlloc

Method Dbg_ObjectAlloc

BeefRT/dbg/DbgInternal.cpp:293–314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

291}
292
293bf::System::Object* Internal::Dbg_ObjectAlloc(bf::System::Reflection::TypeInstance* typeInst, intptr size)
294{
295 BF_ASSERT((BFRTFLAGS & BfRtFlags_ObjectHasDebugFlags) != 0);
296 Object* result;
297
298 intptr allocSize = size;
299
300 uint8* allocBytes = (uint8*)BfObjectAllocate(allocSize, typeInst->_GetType());
301 result = (bf::System::Object*)allocBytes;
302 auto classVData = typeInst->mTypeClassVData;
303 (void)classVData;
304
305#ifndef BFRT_NODBGFLAGS
306 intptr dbgAllocInfo = (intptr)BF_RETURN_ADDRESS;
307 result->mClassVData = (intptr)classVData | (intptr)BfObjectFlag_Allocated /*| BFGC::sAllocFlags*/;
308 BF_FULL_MEMORY_FENCE(); // Since we depend on mDbAllocInfo to determine if we are allocated, we need to set this last after we're set up
309 result->mDbgAllocInfo = dbgAllocInfo;
310 BF_FULL_MEMORY_FENCE();
311 result->mClassVData = (result->mClassVData & ~BF_OBJECTFLAG_MARK_ID_MASK) | BFGC::sAllocFlags;
312#endif
313 return result;
314}
315
316//#define DBG_OBJECTEND
317

Callers

nothing calls this directly

Calls 6

BfObjectAllocateFunction · 0.85
BfRawAllocateFunction · 0.85
_GetTypeMethod · 0.80
StompAllocFunction · 0.50
mallocFunction · 0.50
AllocMethod · 0.45

Tested by

no test coverage detected