xo-gc: use DArenaVector for DX1Collector.object_types_
Original implementation predated DArenaVector, using it is more natural
This commit is contained in:
parent
5548b5e6ce
commit
8de4bbd83f
1 changed files with 7 additions and 3 deletions
|
|
@ -89,7 +89,8 @@ namespace xo {
|
||||||
* Always limited by ArenaConfig.size_
|
* Always limited by ArenaConfig.size_
|
||||||
**/
|
**/
|
||||||
void reserve(size_type z);
|
void reserve(size_type z);
|
||||||
void resize(size_type z);
|
/** resize to size @p z. Return true on success. May fail iff oom. **/
|
||||||
|
bool resize(size_type z);
|
||||||
void shrink_to_fit();
|
void shrink_to_fit();
|
||||||
/** reset vector to empty state **/
|
/** reset vector to empty state **/
|
||||||
void clear();
|
void clear();
|
||||||
|
|
@ -184,7 +185,7 @@ namespace xo {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void
|
bool
|
||||||
DArenaVector<T>::resize(size_type z) {
|
DArenaVector<T>::resize(size_type z) {
|
||||||
// new arena size in bytes
|
// new arena size in bytes
|
||||||
size_t req_z = z * sizeof(T);
|
size_t req_z = z * sizeof(T);
|
||||||
|
|
@ -192,7 +193,8 @@ namespace xo {
|
||||||
if (z > size_) {
|
if (z > size_) {
|
||||||
// expand arena to accomodate
|
// expand arena to accomodate
|
||||||
|
|
||||||
store_.expand(req_z);
|
if (!store_.expand(req_z))
|
||||||
|
return false;
|
||||||
|
|
||||||
// run ctors
|
// run ctors
|
||||||
if constexpr (std::is_trivially_constructible_v<T>) {
|
if constexpr (std::is_trivially_constructible_v<T>) {
|
||||||
|
|
@ -226,6 +228,8 @@ namespace xo {
|
||||||
store_.alloc(xo::reflect::typeseq::id<std::byte>(), req_z);
|
store_.alloc(xo::reflect::typeseq::id<std::byte>(), req_z);
|
||||||
|
|
||||||
this->size_ = z;
|
this->size_ = z;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue