Lines Matching refs:class_id
31 // Classes 1 - 16 correspond to sizes 16 to 256 (size = class_id * 16).
120 static uptr Size(uptr class_id) {
121 if (class_id <= kMidClass)
122 return kMinSize * class_id;
123 class_id -= kMidClass;
124 uptr t = kMidSize << (class_id >> S);
125 return t + (t >> S) * (class_id & M);
139 static uptr MaxCached(uptr class_id) {
140 if (class_id == 0) return 0;
141 uptr n = (1UL << kMaxBytesCachedLog) / Size(class_id);
165 static bool SizeClassRequiresSeparateTransferBatch(uptr class_id) {
166 return Size(class_id) < sizeof(TransferBatch) -
167 sizeof(uptr) * (kMaxNumCached - MaxCached(class_id));
342 uptr class_id) {
343 CHECK_LT(class_id, kNumClasses);
344 RegionInfo *region = GetRegionInfo(class_id);
347 b = PopulateFreeList(stat, c, class_id, region);
352 NOINLINE void DeallocateBatch(AllocatorStats *stat, uptr class_id, Batch *b) {
353 RegionInfo *region = GetRegionInfo(class_id);
368 uptr class_id = GetSizeClass(p);
369 uptr size = SizeClassMap::Size(class_id);
375 if (class_id >= kNumClasses) return 0;
376 RegionInfo *region = GetRegionInfo(class_id);
390 uptr class_id = GetSizeClass(p);
391 uptr size = SizeClassMap::Size(class_id);
393 return reinterpret_cast<void*>(kSpaceBeg + (kRegionSize * (class_id + 1)) -
413 for (uptr class_id = 1; class_id < kNumClasses; class_id++) {
414 RegionInfo *region = GetRegionInfo(class_id);
422 for (uptr class_id = 1; class_id < kNumClasses; class_id++) {
423 RegionInfo *region = GetRegionInfo(class_id);
426 class_id,
427 SizeClassMap::Size(class_id),
451 for (uptr class_id = 1; class_id < kNumClasses; class_id++) {
452 RegionInfo *region = GetRegionInfo(class_id);
453 uptr chunk_size = SizeClassMap::Size(class_id);
454 uptr region_beg = kSpaceBeg + class_id * kRegionSize;
498 RegionInfo *GetRegionInfo(uptr class_id) {
499 CHECK_LT(class_id, kNumClasses);
501 return ®ions[class_id];
514 uptr class_id, RegionInfo *region) {
519 uptr size = SizeClassMap::Size(class_id);
520 uptr count = size < kPopulateSize ? SizeClassMap::MaxCached(class_id) : 1;
523 uptr region_beg = kSpaceBeg + kRegionSize * class_id;
555 if (SizeClassMap::SizeClassRequiresSeparateTransferBatch(class_id))
726 uptr class_id) {
727 CHECK_LT(class_id, kNumClasses);
728 SizeClassInfo *sci = GetSizeClassInfo(class_id);
731 PopulateFreeList(stat, c, sci, class_id);
738 NOINLINE void DeallocateBatch(AllocatorStats *stat, uptr class_id, Batch *b) {
739 CHECK_LT(class_id, kNumClasses);
740 SizeClassInfo *sci = GetSizeClassInfo(class_id);
845 uptr AllocateRegion(AllocatorStats *stat, uptr class_id) {
846 CHECK_LT(class_id, kNumClasses);
852 possible_regions.set(ComputeRegionId(res), static_cast<u8>(class_id));
856 SizeClassInfo *GetSizeClassInfo(uptr class_id) {
857 CHECK_LT(class_id, kNumClasses);
858 return &size_class_info_array[class_id];
862 SizeClassInfo *sci, uptr class_id) {
863 uptr size = SizeClassMap::Size(class_id);
864 uptr reg = AllocateRegion(stat, class_id);
866 uptr max_count = SizeClassMap::MaxCached(class_id);
870 if (SizeClassMap::SizeClassRequiresSeparateTransferBatch(class_id))
913 void *Allocate(SizeClassAllocator *allocator, uptr class_id) {
914 CHECK_NE(class_id, 0UL);
915 CHECK_LT(class_id, kNumClasses);
916 stats_.Add(AllocatorStatAllocated, SizeClassMap::Size(class_id));
917 PerClass *c = &per_class_[class_id];
919 Refill(allocator, class_id);
925 void Deallocate(SizeClassAllocator *allocator, uptr class_id, void *p) {
926 CHECK_NE(class_id, 0UL);
927 CHECK_LT(class_id, kNumClasses);
931 stats_.Sub(AllocatorStatAllocated, SizeClassMap::Size(class_id));
932 PerClass *c = &per_class_[class_id];
935 Drain(allocator, class_id);
940 for (uptr class_id = 0; class_id < kNumClasses; class_id++) {
941 PerClass *c = &per_class_[class_id];
943 Drain(allocator, class_id);
967 NOINLINE void Refill(SizeClassAllocator *allocator, uptr class_id) {
969 PerClass *c = &per_class_[class_id];
970 Batch *b = allocator->AllocateBatch(&stats_, this, class_id);
975 if (SizeClassMap::SizeClassRequiresSeparateTransferBatch(class_id))
979 NOINLINE void Drain(SizeClassAllocator *allocator, uptr class_id) {
981 PerClass *c = &per_class_[class_id];
983 if (SizeClassMap::SizeClassRequiresSeparateTransferBatch(class_id))
995 allocator->DeallocateBatch(&stats_, class_id, b);