Skip to content

Commit

Permalink
Check if kNumBaseClasses is less than or equal to number of configure…
Browse files Browse the repository at this point in the history
…d size classes.

PiperOrigin-RevId: 572048960
Change-Id: Ib460fcf541a8c52fcfb5b2f89f17879c50897313
  • Loading branch information
v-gogte authored and copybara-github committed Oct 9, 2023
1 parent 87d8e40 commit 62c7065
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
16 changes: 8 additions & 8 deletions tcmalloc/experimental_pow2_size_class.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace tcmalloc_internal {
#if TCMALLOC_PAGE_SHIFT == 13
static_assert(kMaxSize == 262144, "kMaxSize mismatch");
static const int kCount = 17;
static_assert(kCount <= kNumClasses);
static_assert(kCount <= kNumBaseClasses);
static constexpr SizeClassInfo kExperimentalPow2SizeClassesList[kCount] = {
// <bytes>, <pages>, <batch size> <fixed>
{ 0, 0, 0}, // +Inf%
Expand All @@ -63,7 +63,7 @@ constexpr absl::Span<const SizeClassInfo> kExperimentalPow2SizeClasses(kExperime
#elif TCMALLOC_PAGE_SHIFT == 15
static_assert(kMaxSize == 262144, "kMaxSize mismatch");
static const int kCount = 17;
static_assert(kCount <= kNumClasses);
static_assert(kCount <= kNumBaseClasses);
static constexpr SizeClassInfo kExperimentalPow2SizeClassesList[kCount] = {
// <bytes>, <pages>, <batch size> <fixed>
{ 0, 0, 0}, // +Inf%
Expand All @@ -88,7 +88,7 @@ constexpr absl::Span<const SizeClassInfo> kExperimentalPow2SizeClasses(kExperime
#elif TCMALLOC_PAGE_SHIFT == 18
static_assert(kMaxSize == 262144, "kMaxSize mismatch");
static const int kCount = 17;
static_assert(kCount <= kNumClasses);
static_assert(kCount <= kNumBaseClasses);
static constexpr SizeClassInfo kExperimentalPow2SizeClassesList[kCount] = {
// <bytes>, <pages>, <batch size> <fixed>
{ 0, 0, 0}, // +Inf%
Expand All @@ -113,7 +113,7 @@ constexpr absl::Span<const SizeClassInfo> kExperimentalPow2SizeClasses(kExperime
#elif TCMALLOC_PAGE_SHIFT == 12
static_assert(kMaxSize == 8192, "kMaxSize mismatch");
static const int kCount = 12;
static_assert(kCount <= kNumClasses);
static_assert(kCount <= kNumBaseClasses);
static constexpr SizeClassInfo kExperimentalPow2SizeClassesList[kCount] = {
// <bytes>, <pages>, <batch size> <fixed>
{ 0, 0, 0}, // +Inf%
Expand All @@ -137,7 +137,7 @@ constexpr absl::Span<const SizeClassInfo> kExperimentalPow2SizeClasses(kExperime
#if TCMALLOC_PAGE_SHIFT == 13
static_assert(kMaxSize == 262144, "kMaxSize mismatch");
static const int kCount = 17;
static_assert(kCount <= kNumClasses);
static_assert(kCount <= kNumBaseClasses);
static constexpr SizeClassInfo kExperimentalPow2SizeClassesList[kCount] = {
// <bytes>, <pages>, <batch size> <fixed>
{ 0, 0, 0}, // +Inf%
Expand All @@ -162,7 +162,7 @@ constexpr absl::Span<const SizeClassInfo> kExperimentalPow2SizeClasses(kExperime
#elif TCMALLOC_PAGE_SHIFT == 15
static_assert(kMaxSize == 262144, "kMaxSize mismatch");
static const int kCount = 17;
static_assert(kCount <= kNumClasses);
static_assert(kCount <= kNumBaseClasses);
static constexpr SizeClassInfo kExperimentalPow2SizeClassesList[kCount] = {
// <bytes>, <pages>, <batch size> <fixed>
{ 0, 0, 0}, // +Inf%
Expand All @@ -187,7 +187,7 @@ constexpr absl::Span<const SizeClassInfo> kExperimentalPow2SizeClasses(kExperime
#elif TCMALLOC_PAGE_SHIFT == 18
static_assert(kMaxSize == 262144, "kMaxSize mismatch");
static const int kCount = 17;
static_assert(kCount <= kNumClasses);
static_assert(kCount <= kNumBaseClasses);
static constexpr SizeClassInfo kExperimentalPow2SizeClassesList[kCount] = {
// <bytes>, <pages>, <batch size> <fixed>
{ 0, 0, 0}, // +Inf%
Expand All @@ -212,7 +212,7 @@ constexpr absl::Span<const SizeClassInfo> kExperimentalPow2SizeClasses(kExperime
#elif TCMALLOC_PAGE_SHIFT == 12
static_assert(kMaxSize == 8192, "kMaxSize mismatch");
static const int kCount = 12;
static_assert(kCount <= kNumClasses);
static_assert(kCount <= kNumBaseClasses);
static constexpr SizeClassInfo kExperimentalPow2SizeClassesList[kCount] = {
// <bytes>, <pages>, <batch size> <fixed>
{ 0, 0, 0}, // +Inf%
Expand Down
16 changes: 8 additions & 8 deletions tcmalloc/legacy_size_classes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace tcmalloc_internal {
#if TCMALLOC_PAGE_SHIFT == 13
static_assert(kMaxSize == 262144, "kMaxSize mismatch");
static const int kCount = 86;
static_assert(kCount <= kNumClasses);
static_assert(kCount <= kNumBaseClasses);
static constexpr SizeClassInfo kLegacySizeClassesList[kCount] = {
// <bytes>, <pages>, <batch size> <fixed>
{ 0, 0, 0}, // +Inf%
Expand Down Expand Up @@ -132,7 +132,7 @@ constexpr absl::Span<const SizeClassInfo> kLegacySizeClasses(kLegacySizeClassesL
#elif TCMALLOC_PAGE_SHIFT == 15
static_assert(kMaxSize == 262144, "kMaxSize mismatch");
static const int kCount = 78;
static_assert(kCount <= kNumClasses);
static_assert(kCount <= kNumBaseClasses);
static constexpr SizeClassInfo kLegacySizeClassesList[kCount] = {
// <bytes>, <pages>, <batch size> <fixed>
{ 0, 0, 0}, // +Inf%
Expand Down Expand Up @@ -218,7 +218,7 @@ constexpr absl::Span<const SizeClassInfo> kLegacySizeClasses(kLegacySizeClassesL
#elif TCMALLOC_PAGE_SHIFT == 18
static_assert(kMaxSize == 262144, "kMaxSize mismatch");
static const int kCount = 89;
static_assert(kCount <= kNumClasses);
static_assert(kCount <= kNumBaseClasses);
static constexpr SizeClassInfo kLegacySizeClassesList[kCount] = {
// <bytes>, <pages>, <batch size> <fixed>
{ 0, 0, 0}, // +Inf%
Expand Down Expand Up @@ -315,7 +315,7 @@ constexpr absl::Span<const SizeClassInfo> kLegacySizeClasses(kLegacySizeClassesL
#elif TCMALLOC_PAGE_SHIFT == 12
static_assert(kMaxSize == 8192, "kMaxSize mismatch");
static const int kCount = 46;
static_assert(kCount <= kNumClasses);
static_assert(kCount <= kNumBaseClasses);
static constexpr SizeClassInfo kLegacySizeClassesList[kCount] = {
// <bytes>, <pages>, <batch size> <fixed>
{ 0, 0, 0}, // +Inf%
Expand Down Expand Up @@ -373,7 +373,7 @@ constexpr absl::Span<const SizeClassInfo> kLegacySizeClasses(kLegacySizeClassesL
#if TCMALLOC_PAGE_SHIFT == 13
static_assert(kMaxSize == 262144, "kMaxSize mismatch");
static const int kCount = 86;
static_assert(kCount <= kNumClasses);
static_assert(kCount <= kNumBaseClasses);
static constexpr SizeClassInfo kLegacySizeClassesList[kCount] = {
// <bytes>, <pages>, <batch size> <fixed>
{ 0, 0, 0}, // +Inf%
Expand Down Expand Up @@ -467,7 +467,7 @@ constexpr absl::Span<const SizeClassInfo> kLegacySizeClasses(kLegacySizeClassesL
#elif TCMALLOC_PAGE_SHIFT == 15
static_assert(kMaxSize == 262144, "kMaxSize mismatch");
static const int kCount = 78;
static_assert(kCount <= kNumClasses);
static_assert(kCount <= kNumBaseClasses);
static constexpr SizeClassInfo kLegacySizeClassesList[kCount] = {
// <bytes>, <pages>, <batch size> <fixed>
{ 0, 0, 0}, // +Inf%
Expand Down Expand Up @@ -553,7 +553,7 @@ constexpr absl::Span<const SizeClassInfo> kLegacySizeClasses(kLegacySizeClassesL
#elif TCMALLOC_PAGE_SHIFT == 18
static_assert(kMaxSize == 262144, "kMaxSize mismatch");
static const int kCount = 89;
static_assert(kCount <= kNumClasses);
static_assert(kCount <= kNumBaseClasses);
static constexpr SizeClassInfo kLegacySizeClassesList[kCount] = {
// <bytes>, <pages>, <batch size> <fixed>
{ 0, 0, 0}, // +Inf%
Expand Down Expand Up @@ -650,7 +650,7 @@ constexpr absl::Span<const SizeClassInfo> kLegacySizeClasses(kLegacySizeClassesL
#elif TCMALLOC_PAGE_SHIFT == 12
static_assert(kMaxSize == 8192, "kMaxSize mismatch");
static const int kCount = 46;
static_assert(kCount <= kNumClasses);
static_assert(kCount <= kNumBaseClasses);
static constexpr SizeClassInfo kLegacySizeClassesList[kCount] = {
// <bytes>, <pages>, <batch size> <fixed>
{ 0, 0, 0}, // +Inf%
Expand Down
16 changes: 8 additions & 8 deletions tcmalloc/size_classes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace tcmalloc_internal {
#if TCMALLOC_PAGE_SHIFT == 13
static_assert(kMaxSize == 262144, "kMaxSize mismatch");
static const int kCount = 82;
static_assert(kCount <= kNumClasses);
static_assert(kCount <= kNumBaseClasses);
static constexpr SizeClassInfo kSizeClassesList[kCount] = {
// <bytes>, <pages>, <batch size> <fixed>
{ 0, 0, 0}, // +Inf%
Expand Down Expand Up @@ -128,7 +128,7 @@ constexpr absl::Span<const SizeClassInfo> kSizeClasses(kSizeClassesList);
#elif TCMALLOC_PAGE_SHIFT == 15
static_assert(kMaxSize == 262144, "kMaxSize mismatch");
static const int kCount = 74;
static_assert(kCount <= kNumClasses);
static_assert(kCount <= kNumBaseClasses);
static constexpr SizeClassInfo kSizeClassesList[kCount] = {
// <bytes>, <pages>, <batch size> <fixed>
{ 0, 0, 0}, // +Inf%
Expand Down Expand Up @@ -210,7 +210,7 @@ constexpr absl::Span<const SizeClassInfo> kSizeClasses(kSizeClassesList);
#elif TCMALLOC_PAGE_SHIFT == 18
static_assert(kMaxSize == 262144, "kMaxSize mismatch");
static const int kCount = 85;
static_assert(kCount <= kNumClasses);
static_assert(kCount <= kNumBaseClasses);
static constexpr SizeClassInfo kSizeClassesList[kCount] = {
// <bytes>, <pages>, <batch size> <fixed>
{ 0, 0, 0}, // +Inf%
Expand Down Expand Up @@ -303,7 +303,7 @@ constexpr absl::Span<const SizeClassInfo> kSizeClasses(kSizeClassesList);
#elif TCMALLOC_PAGE_SHIFT == 12
static_assert(kMaxSize == 8192, "kMaxSize mismatch");
static const int kCount = 42;
static_assert(kCount <= kNumClasses);
static_assert(kCount <= kNumBaseClasses);
static constexpr SizeClassInfo kSizeClassesList[kCount] = {
// <bytes>, <pages>, <batch size> <fixed>
{ 0, 0, 0}, // +Inf%
Expand Down Expand Up @@ -357,7 +357,7 @@ constexpr absl::Span<const SizeClassInfo> kSizeClasses(kSizeClassesList);
#if TCMALLOC_PAGE_SHIFT == 13
static_assert(kMaxSize == 262144, "kMaxSize mismatch");
static const int kCount = 85;
static_assert(kCount <= kNumClasses);
static_assert(kCount <= kNumBaseClasses);
static constexpr SizeClassInfo kSizeClassesList[kCount] = {
// <bytes>, <pages>, <batch size> <fixed>
{ 0, 0, 0}, // +Inf%
Expand Down Expand Up @@ -450,7 +450,7 @@ constexpr absl::Span<const SizeClassInfo> kSizeClasses(kSizeClassesList);
#elif TCMALLOC_PAGE_SHIFT == 15
static_assert(kMaxSize == 262144, "kMaxSize mismatch");
static const int kCount = 77;
static_assert(kCount <= kNumClasses);
static_assert(kCount <= kNumBaseClasses);
static constexpr SizeClassInfo kSizeClassesList[kCount] = {
// <bytes>, <pages>, <batch size> <fixed>
{ 0, 0, 0}, // +Inf%
Expand Down Expand Up @@ -535,7 +535,7 @@ constexpr absl::Span<const SizeClassInfo> kSizeClasses(kSizeClassesList);
#elif TCMALLOC_PAGE_SHIFT == 18
static_assert(kMaxSize == 262144, "kMaxSize mismatch");
static const int kCount = 88;
static_assert(kCount <= kNumClasses);
static_assert(kCount <= kNumBaseClasses);
static constexpr SizeClassInfo kSizeClassesList[kCount] = {
// <bytes>, <pages>, <batch size> <fixed>
{ 0, 0, 0}, // +Inf%
Expand Down Expand Up @@ -631,7 +631,7 @@ constexpr absl::Span<const SizeClassInfo> kSizeClasses(kSizeClassesList);
#elif TCMALLOC_PAGE_SHIFT == 12
static_assert(kMaxSize == 8192, "kMaxSize mismatch");
static const int kCount = 45;
static_assert(kCount <= kNumClasses);
static_assert(kCount <= kNumBaseClasses);
static constexpr SizeClassInfo kSizeClassesList[kCount] = {
// <bytes>, <pages>, <batch size> <fixed>
{ 0, 0, 0}, // +Inf%
Expand Down

0 comments on commit 62c7065

Please sign in to comment.