Improve check_bounds init check.

This commit is contained in:
Matthew Parkinson
2022-01-10 10:34:28 +00:00
committed by Matthew Parkinson
parent 419347ba4a
commit ef64f6c31b
5 changed files with 26 additions and 2 deletions

View File

@@ -335,6 +335,12 @@ namespace snmalloc
UNUSED(local_state);
return concretePagemap.get_bounds();
}
static bool is_initialised(LocalState* ls)
{
UNUSED(ls);
return concretePagemap.is_initialised();
}
};
private:

View File

@@ -278,6 +278,14 @@ namespace snmalloc
return body[p >> SHIFT];
}
/**
* Check if the pagemap has been initialised.
*/
[[nodiscard]] bool is_initialised() const
{
return body_opt != nullptr;
}
/**
* Return the starting address corresponding to a given entry within the
* Pagemap. Also checks that the reference actually points to a valid entry.