xo-gc: utest: fix test regressions
All checks were successful
CI / smoke-test (push) Successful in 2m23s
All checks were successful
CI / smoke-test (push) Successful in 2m23s
This commit is contained in:
parent
d06daf0d6c
commit
d66affcd1e
4 changed files with 28 additions and 16 deletions
|
|
@ -168,6 +168,7 @@ namespace xo {
|
||||||
return accumulate_total_aux(*this, &DArena::reserved);
|
return accumulate_total_aux(*this, &DArena::reserved);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// editor bait: size()
|
||||||
size_type
|
size_type
|
||||||
DX1Collector::size_total() const noexcept
|
DX1Collector::size_total() const noexcept
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -325,11 +325,12 @@ namespace xo {
|
||||||
namespace {
|
namespace {
|
||||||
class Testcase {
|
class Testcase {
|
||||||
public:
|
public:
|
||||||
Testcase(uint32_t ng, uint32_t ns, size_t gcz, uint32_t otz, bool dbg_flag)
|
Testcase(uint32_t ng, uint32_t ns, size_t gcz, uint32_t otz, uint32_t xotz, bool dbg_flag)
|
||||||
: n_gen_{ng},
|
: n_gen_{ng},
|
||||||
n_survive_{ns},
|
n_survive_{ns},
|
||||||
gc_halfspace_z_{gcz},
|
gc_halfspace_z_{gcz},
|
||||||
object_type_z_{otz},
|
object_type_z_{otz},
|
||||||
|
expect_object_type_z_{xotz},
|
||||||
debug_flag_{dbg_flag}
|
debug_flag_{dbg_flag}
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
@ -340,7 +341,7 @@ namespace xo {
|
||||||
uint32_t n_survive_ = 0;
|
uint32_t n_survive_ = 0;
|
||||||
/** size of each generations' half-space, in bytes **/
|
/** size of each generations' half-space, in bytes **/
|
||||||
size_t gc_halfspace_z_ = 0;
|
size_t gc_halfspace_z_ = 0;
|
||||||
/** storage for object type array, in bytes
|
/** storage for object-type array, in bytes
|
||||||
* one 8-byte facet pointer per type
|
* one 8-byte facet pointer per type
|
||||||
**/
|
**/
|
||||||
uint32_t object_type_z_;
|
uint32_t object_type_z_;
|
||||||
|
|
@ -348,6 +349,8 @@ namespace xo {
|
||||||
/** size for error output arena **/
|
/** size for error output arena **/
|
||||||
size_t error_size_ = 0;
|
size_t error_size_ = 0;
|
||||||
#endif
|
#endif
|
||||||
|
/** expected size of object-type array, in bytes, after orderly init **/
|
||||||
|
uint32_t expect_object_type_z_ = 0;
|
||||||
/** true to enable debug output for this test case **/
|
/** true to enable debug output for this test case **/
|
||||||
bool debug_flag_ = false;
|
bool debug_flag_ = false;
|
||||||
};
|
};
|
||||||
|
|
@ -372,6 +375,7 @@ namespace xo {
|
||||||
{
|
{
|
||||||
auto gc = obj<ACollector,DX1Collector>(&gc_);
|
auto gc = obj<ACollector,DX1Collector>(&gc_);
|
||||||
|
|
||||||
|
// auto-install object types
|
||||||
CollectorTypeRegistry::instance().install_types(gc);
|
CollectorTypeRegistry::instance().install_types(gc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -381,14 +385,15 @@ namespace xo {
|
||||||
|
|
||||||
static std::vector<Testcase> s_testcase_v = {
|
static std::vector<Testcase> s_testcase_v = {
|
||||||
/**
|
/**
|
||||||
* debug_flag
|
* debug_flag
|
||||||
* object_type_z |
|
* expect_object_type_z |
|
||||||
* gc_halfspace_z | |
|
* object_type_z | |
|
||||||
* n_survive | | |
|
* gc_halfspace_z | | |
|
||||||
* n_gen | | | |
|
* n_survive | | | |
|
||||||
* v v v v v
|
* n_gen | | | | |
|
||||||
|
* v v v v v v
|
||||||
**/
|
**/
|
||||||
Testcase(1, 2, 16 * 1024, 128, T),
|
Testcase(1, 2, 16 * 1024, 128, 96, T),
|
||||||
};
|
};
|
||||||
|
|
||||||
# undef T
|
# undef T
|
||||||
|
|
@ -443,7 +448,9 @@ namespace xo {
|
||||||
|
|
||||||
Generation g0 = Generation::g0();
|
Generation g0 = Generation::g0();
|
||||||
|
|
||||||
REQUIRE(mm.allocated() == tc.object_type_z_);
|
// mm.allocated includes: { object-types, roots(=0), arenas(=0) }
|
||||||
|
//
|
||||||
|
REQUIRE(mm.allocated() == tc.expect_object_type_z_);
|
||||||
REQUIRE(gc.allocated(g0, Role::to_space()) == 0);
|
REQUIRE(gc.allocated(g0, Role::to_space()) == 0);
|
||||||
REQUIRE(gc.allocated(g0, Role::from_space()) == 0);
|
REQUIRE(gc.allocated(g0, Role::from_space()) == 0);
|
||||||
|
|
||||||
|
|
@ -478,7 +485,9 @@ namespace xo {
|
||||||
+ sizeof(DArray) + sizeof(obj<AGCObject>));
|
+ sizeof(DArray) + sizeof(obj<AGCObject>));
|
||||||
{
|
{
|
||||||
REQUIRE(z == 80);
|
REQUIRE(z == 80);
|
||||||
REQUIRE(mm.allocated() == tc.object_type_z_ + z);
|
// cf earlier assertion on mm.allocated();
|
||||||
|
// now adding cost of 3 specific objects
|
||||||
|
REQUIRE(mm.allocated() == tc.expect_object_type_z_ + z);
|
||||||
REQUIRE(gc.allocated(g0, Role::to_space()) == z);
|
REQUIRE(gc.allocated(g0, Role::to_space()) == z);
|
||||||
REQUIRE(gc.allocated(g1, Role::to_space()) == 0);
|
REQUIRE(gc.allocated(g1, Role::to_space()) == 0);
|
||||||
REQUIRE(gc.allocated(g0, Role::from_space()) == 0);
|
REQUIRE(gc.allocated(g0, Role::from_space()) == 0);
|
||||||
|
|
@ -494,7 +503,7 @@ namespace xo {
|
||||||
REQUIRE(mm->contains(Role::from_space(), l1.data()));
|
REQUIRE(mm->contains(Role::from_space(), l1.data()));
|
||||||
REQUIRE(!mm->contains_allocated(Role::from_space(), l1.data()));
|
REQUIRE(!mm->contains_allocated(Role::from_space(), l1.data()));
|
||||||
|
|
||||||
REQUIRE(mm.allocated() == tc.object_type_z_ + z);
|
REQUIRE(mm.allocated() == tc.expect_object_type_z_ + z);
|
||||||
REQUIRE(gc.allocated(g0, Role::to_space()) == z);
|
REQUIRE(gc.allocated(g0, Role::to_space()) == z);
|
||||||
REQUIRE(gc.allocated(g1, Role::to_space()) == 0);
|
REQUIRE(gc.allocated(g1, Role::to_space()) == 0);
|
||||||
REQUIRE(gc.allocated(g0, Role::from_space()) == 0);
|
REQUIRE(gc.allocated(g0, Role::from_space()) == 0);
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ namespace ut {
|
||||||
|
|
||||||
constexpr uint32_t c_space_z = 64*1024;
|
constexpr uint32_t c_space_z = 64*1024;
|
||||||
constexpr uint32_t c_n_gen = 1;
|
constexpr uint32_t c_n_gen = 1;
|
||||||
constexpr uint32_t c_n_survive = 0;
|
constexpr uint32_t c_n_survive = 1;
|
||||||
X1VerifyStats verify_stats;
|
X1VerifyStats verify_stats;
|
||||||
GCObjectStoreConfig gcos_config{ArenaConfig()
|
GCObjectStoreConfig gcos_config{ArenaConfig()
|
||||||
.with_name("gcos-arena-name-notused")
|
.with_name("gcos-arena-name-notused")
|
||||||
|
|
|
||||||
|
|
@ -273,11 +273,13 @@ namespace ut {
|
||||||
REQUIRE(ok);
|
REQUIRE(ok);
|
||||||
|
|
||||||
REQUIRE(gc_o.name() == cfg.name_);
|
REQUIRE(gc_o.name() == cfg.name_);
|
||||||
// nothing committed yet (?)
|
// nothing committed yet, execept object types.
|
||||||
REQUIRE(gc_o.size() == cfg.object_types_z_);
|
// committed memory will fit on 1 page
|
||||||
|
REQUIRE(gc_o.size() == getpagesize());
|
||||||
// no-op
|
// no-op
|
||||||
REQUIRE(gc_o.expand(0));
|
REQUIRE(gc_o.expand(0));
|
||||||
REQUIRE(gc_o.size() == cfg.object_types_z_);
|
// committed memory will still fit on 1 page,
|
||||||
|
REQUIRE(gc_o.size() == getpagesize());
|
||||||
|
|
||||||
// x0_o will be added as gc root. x0_o_orig will not
|
// x0_o will be added as gc root. x0_o_orig will not
|
||||||
auto x0_o = DFloat::box<AGCObject>(gc_o, 3.1415927);
|
auto x0_o = DFloat::box<AGCObject>(gc_o, 3.1415927);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue