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

Function TCGetSpanAt

BeefRT/dbg/gc.cpp:786–803  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

784
785#ifdef BF32
786static tcmalloc_obj::Span* TCGetSpanAt(void* addr)
787{
788 int checkPageId = (int)((uintptr)addr >> kPageShift);
789 int checkRootIdx = checkPageId >> PageHeap::PageMap::LEAF_BITS;
790 int checkLeafIdx = checkPageId & (PageHeap::PageMap::LEAF_LENGTH - 1);
791
792 PageHeap::PageMap::Leaf* rootLeaf = Static::pageheap()->pagemap_.root_[checkRootIdx];
793 if (rootLeaf == NULL)
794 return NULL;
795 auto span = (tcmalloc_obj::Span*)rootLeaf->values[checkLeafIdx];
796// intptr pageSize = (intptr)1 << kPageShift;
797// int spanSize = pageSize * span->length;
798// void* spanStart = (void*)((intptr)span->start << kPageShift);
799// void* spanEnd = (void*)((intptr)spanStart + spanSize);
800// if ((addr >= spanStart) && (addr < spanEnd))
801// return span;
802 return span;
803}
804#else
805static tcmalloc_obj::Span* TCGetSpanAt(void* addr)
806{

Callers 4

IsHeapObjectMethod · 0.85
GCObjFreeFunction · 0.85
FinishCollectMethod · 0.85
MarkFromGCThreadMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected