xo-imgui: ex: display both from+to spaces + refactor&streamline
This commit is contained in:
parent
4c824edbe4
commit
a956320470
2 changed files with 11 additions and 0 deletions
|
|
@ -147,6 +147,8 @@ namespace xo {
|
|||
static up<GC> make(const Config & config);
|
||||
|
||||
const Config & config() const { return config_; }
|
||||
std::uint8_t nursery_polarity() const { return nursery_polarity_; }
|
||||
std::uint8_t tenured_polarity() const { return tenured_polarity_; }
|
||||
const GCRunstate & runstate() const { return runstate_; }
|
||||
const GcStatistics & native_gc_statistics() const { return gc_statistics_; }
|
||||
GcStatisticsExt get_gc_statistics() const;
|
||||
|
|
@ -345,6 +347,13 @@ namespace xo {
|
|||
/** garbage collector configuration **/
|
||||
Config config_;
|
||||
|
||||
/** keep track of the identity of from-space and to-space.
|
||||
* assist for animation (see xo-imgui/example/ex2).
|
||||
* polarity alternates between 0 and 1 on each GC
|
||||
**/
|
||||
std::uint8_t nursery_polarity_ = 0;
|
||||
std::uint8_t tenured_polarity_ = 0;
|
||||
|
||||
/** contains allocated objects, along with unreachable garbage to be collected.
|
||||
* roles reverse after each incremental, or full, collection.
|
||||
**/
|
||||
|
|
|
|||
|
|
@ -501,6 +501,7 @@ namespace xo {
|
|||
up<ArenaAlloc> tmp = std::move(nursery_[role2int(role::to_space)]);
|
||||
nursery_[role2int(role::to_space)] = std::move(nursery_[role2int(role::from_space)]);
|
||||
nursery_[role2int(role::from_space)] = std::move(tmp);
|
||||
nursery_polarity_ = 1 - nursery_polarity_;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -509,6 +510,7 @@ namespace xo {
|
|||
up<ArenaAlloc> tmp = std::move(tenured_[role2int(role::to_space)]);
|
||||
tenured_[role2int(role::to_space)] = std::move(tenured_[role2int(role::from_space)]);
|
||||
tenured_[role2int(role::from_space)] = std::move(tmp);
|
||||
tenured_polarity_ = 1 - tenured_polarity_;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue