Made a sizecass_t to wrap the sizeclass

This is useful as codegen is nicer if we use size_t, but the semantics
is uint8_t, and is stored as that in many places in the metadata.
Ultimately should introduce a wrapper to check this invariant.
This commit is contained in:
Matthew Parkinson
2019-06-26 17:40:26 +01:00
parent 830b06a616
commit 7a8eaec2cc
9 changed files with 81 additions and 69 deletions

View File

@@ -1,6 +1,7 @@
#pragma once
#include "../ds/bits.h"
#include "../mem/sizeclass.h"
#include <cstdint>
@@ -165,7 +166,7 @@ namespace snmalloc
#endif
}
void sizeclass_alloc(uint8_t sc)
void sizeclass_alloc(sizeclass_t sc)
{
UNUSED(sc);
@@ -175,7 +176,7 @@ namespace snmalloc
#endif
}
void sizeclass_dealloc(uint8_t sc)
void sizeclass_dealloc(sizeclass_t sc)
{
UNUSED(sc);
@@ -194,7 +195,7 @@ namespace snmalloc
#endif
}
void sizeclass_alloc_slab(uint8_t sc)
void sizeclass_alloc_slab(sizeclass_t sc)
{
UNUSED(sc);
@@ -204,7 +205,7 @@ namespace snmalloc
#endif
}
void sizeclass_dealloc_slab(uint8_t sc)
void sizeclass_dealloc_slab(sizeclass_t sc)
{
UNUSED(sc);
@@ -251,7 +252,7 @@ namespace snmalloc
#endif
}
void remote_free(uint8_t sc)
void remote_free(sizeclass_t sc)
{
UNUSED(sc);
@@ -267,7 +268,7 @@ namespace snmalloc
#endif
}
void remote_receive(uint8_t sc)
void remote_receive(sizeclass_t sc)
{
UNUSED(sc);
@@ -348,7 +349,7 @@ namespace snmalloc
<< "Count" << csv.endl;
}
for (uint8_t i = 0; i < N; i++)
for (sizeclass_t i = 0; i < N; i++)
{
if (sizeclass[i].count.is_unused())
continue;