Lines Matching defs:BG
182 for (BatchGroupT &BG : Region->FreeListInfo.BlockList) {
183 // `BG::Batches` are `TransferBatches`. +1 for `BatchGroup`.
184 BatchClassUsedInFreeLists += BG.Batches.size() + 1;
185 for (const auto &It : BG.Batches)
199 for (BatchGroupT &BG : Region->FreeListInfo.BlockList) {
200 if (LIKELY(!BG.Batches.empty())) {
201 for (const auto &It : BG.Batches)
670 BatchGroupT *BG = Region->FreeListInfo.BlockList.front();
672 if (BG == nullptr) {
674 BG = reinterpret_cast<BatchGroupT *>(
677 BG->Batches.clear();
680 BG->CompactPtrGroupBase = 0;
681 // `BG` is also the block of BatchClassId. Note that this is different
683 BG->PushedBlocks = 1;
684 BG->BytesInBGAtLastCheckpoint = 0;
685 BG->MaxCachedPerBatch =
688 Region->FreeListInfo.BlockList.push_front(BG);
697 if (BG->Batches.empty()) {
706 compactPtr(SizeClassMap::BatchClassId, reinterpret_cast<uptr>(BG)));
708 DCHECK_EQ(BG->PushedBlocks, 1U);
710 BG->PushedBlocks += 1;
711 BG->Batches.push_front(TB);
714 TransferBatchT *CurBatch = BG->Batches.front();
719 static_cast<u16>(BG->MaxCachedPerBatch - CurBatch->getCount());
729 BG->Batches.push_front(CurBatch);
730 UnusedSlots = static_cast<u16>(BG->MaxCachedPerBatch - 1);
738 BG->PushedBlocks += Size;
743 // FreeListInfo.BlockList - > BG -> BG -> BG
751 // Each BlockGroup(BG) will associate with unique group id and the free blocks
764 BatchGroupT *BG =
766 BG->Batches.clear();
771 BG->CompactPtrGroupBase = CompactPtrGroupBase;
772 BG->Batches.push_front(TB);
773 BG->PushedBlocks = 0;
774 BG->BytesInBGAtLastCheckpoint = 0;
775 BG->MaxCachedPerBatch = TransferBatchT::MaxNumCached;
777 return BG;
780 auto InsertBlocks = [&](BatchGroupT *BG, CompactPtrT *Array, u32 Size) {
781 SinglyLinkedList<TransferBatchT> &Batches = BG->Batches;
786 DCHECK_GE(BG->MaxCachedPerBatch, CurBatch->getCount());
788 static_cast<u16>(BG->MaxCachedPerBatch - CurBatch->getCount());
794 UnusedSlots = BG->MaxCachedPerBatch;
802 BG->PushedBlocks += Size;
953 BatchGroupT *BG = Region->FreeListInfo.BlockList.front();
958 TransferBatchT *TB = reinterpret_cast<TransferBatchT *>(BG);
995 BatchGroupT *BG = Region->FreeListInfo.BlockList.front();
1004 C->deallocate(SizeClassMap::BatchClassId, BG);
1361 for (BatchGroupT *BG = Region->FreeListInfo.BlockList.front(),
1363 BG != nullptr;) {
1378 decompactGroupBase(CompactPtrBase, BG->CompactPtrGroupBase);
1382 // TransferBatches are pushed in front of BG.Batches. The first one may
1384 const uptr NumBlocks = (BG->Batches.size() - 1) * BG->MaxCachedPerBatch +
1385 BG->Batches.front()->getCount();
1388 if (BytesInBG <= BG->BytesInBGAtLastCheckpoint) {
1389 BG->BytesInBGAtLastCheckpoint = BytesInBG;
1390 Prev = BG;
1391 BG = BG->Next;
1395 const uptr PushedBytesDelta = BytesInBG - BG->BytesInBGAtLastCheckpoint;
1440 Prev = BG;
1441 BG = BG->Next;
1446 // If `BG` is the first BatchGroupT in the list, we only need to advance
1447 // `BG` and call FreeListInfo.BlockList::pop_front(). No update is needed
1450 // (BG) (BG->Next)
1451 // Prev Cur BG
1461 // (BG) (BG->Next)
1462 // Prev Cur BG
1471 // Prev Cur BG
1482 BatchGroupT *Cur = BG;
1483 BG = BG->Next;
1544 for (BatchGroupT &BG : GroupsToRelease) {
1546 decompactGroupBase(CompactPtrBase, BG.CompactPtrGroupBase);
1561 const uptr NumBlocks = (BG.Batches.size() - 1) * BG.MaxCachedPerBatch +
1562 BG.Batches.front()->getCount();
1565 for (const auto &It : BG.Batches) {
1566 if (&It != BG.Batches.front())
1567 DCHECK_EQ(It.getCount(), BG.MaxCachedPerBatch);
1569 DCHECK_EQ(compactPtrGroup(It.get(I)), BG.CompactPtrGroupBase);
1581 BG.Batches, DecompactPtr, Region->RegionBeg, /*RegionIndex=*/0,
1613 for (BatchGroupT *BG = Region->FreeListInfo.BlockList.front(),
1616 if (BG == nullptr || GroupsToRelease.empty()) {
1622 DCHECK(!BG->Batches.empty());
1624 if (BG->CompactPtrGroupBase <
1626 Prev = BG;
1627 BG = BG->Next;
1635 if (BG->CompactPtrGroupBase == Cur->CompactPtrGroupBase) {
1636 BG->PushedBlocks += Cur->PushedBlocks;
1639 BG->BytesInBGAtLastCheckpoint = Cur->BytesInBGAtLastCheckpoint;
1640 const uptr MaxCachedPerBatch = BG->MaxCachedPerBatch;
1646 BG->Batches.append_back(&Cur->Batches);
1652 BG->Batches.append_back(&Cur->Batches);
1654 if (BG->Batches.front()->getCount() == MaxCachedPerBatch) {
1656 BG->Batches.push_front(NonFullBatch);
1660 BG->Batches.front()->getCount()),
1662 BG->Batches.front()->appendFromTransferBatch(NonFullBatch,
1667 BG->Batches.push_front(NonFullBatch);
1686 Prev = BG;
1687 BG = BG->Next;
1691 // At here, the `BG` is the first BatchGroup with CompactPtrGroupBase
1693 // `GroupsToRelease::front()` (which is `Cur` below) before `BG`.
1699 // Afterwards, we don't need to advance `BG` because the order between
1700 // `BG` and the new `GroupsToRelease::front()` hasn't been checked.
1705 DCHECK_EQ(Cur->Next, BG);