xo-gc: improve public/private between MutationLogStore and X1
This commit is contained in:
parent
f71d40e4a0
commit
5d3c088ba7
6 changed files with 133 additions and 142 deletions
|
|
@ -17,55 +17,26 @@ namespace xo {
|
|||
class MutationLogConfig {
|
||||
public:
|
||||
MutationLogConfig(std::uint32_t ngen,
|
||||
#ifdef OBSOLETE // in GCObjectStore
|
||||
std::uint32_t survive,
|
||||
#endif
|
||||
std::size_t mlog_z,
|
||||
bool enabled_flag,
|
||||
bool debug_flag);
|
||||
|
||||
#ifdef OBSOLETE
|
||||
/** generation that would contain an object that has survived
|
||||
* @p age collections. Equals the number of times object
|
||||
* has been promoted.
|
||||
*
|
||||
* Must be consistent
|
||||
**/
|
||||
Generation age2gen(object_age age) const noexcept {
|
||||
return Generation(age % n_survive_threshold_);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef OBSOLETE
|
||||
/** age threshold for promotion to generation @p g **/
|
||||
uint32_t promotion_threshold(Generation g) const noexcept {
|
||||
|
||||
// TODO: may consider replacing with table-lookup
|
||||
// Require: if two distinct ages promote to some gen g at the same time,
|
||||
// then they also promote to gen g+k at the same time for all k>0.
|
||||
|
||||
return g * n_survive_threshold_;
|
||||
}
|
||||
#endif
|
||||
|
||||
public:
|
||||
/** number of generations in use.
|
||||
* Same as @ref X1CollectorConfig::n_generation_
|
||||
**/
|
||||
std::uint32_t n_generation_ = 0;
|
||||
|
||||
#ifdef OBSOLETE
|
||||
/** Number of promotion steps.
|
||||
* An object that survives this number of collections
|
||||
* advances to the next generation.
|
||||
**/
|
||||
uint32_t n_survive_threshold_ = 2;
|
||||
#endif
|
||||
|
||||
/** storage for xgen pointer bookkeeping (aka remembered sets).
|
||||
* Use 3x this value per generation
|
||||
**/
|
||||
std::size_t mutation_log_z_ = 1024;
|
||||
|
||||
/** true if mlog feature enabled (i.e. incremental gc enabled).
|
||||
* false to disable (in which case only full gc supported)
|
||||
**/
|
||||
bool enabled_flag_ = false;
|
||||
|
||||
/** true to enable debug logging **/
|
||||
bool debug_flag_ = false;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -40,13 +40,40 @@ namespace xo {
|
|||
void visit_pools(const MemorySizeVisitor & visitor) const;
|
||||
|
||||
/** verify consistent mlog state,
|
||||
* on behalf of collector @p gc.
|
||||
* on behalf of gc-aware object store @p gc.
|
||||
* (using gc to identify location of objects).
|
||||
* Update counters in @p *p_verify_stats.
|
||||
**/
|
||||
void verify_ok(GCObjectStore * gc,
|
||||
X1VerifyStats * p_verify_stats) noexcept;
|
||||
|
||||
/** on behalf of gc-aware object store @p gc,
|
||||
* change the value of a child pointer at @p p_lhs
|
||||
* with parent object @p parent. p_lhs and parent must belong
|
||||
* to the same allocation.
|
||||
**/
|
||||
void assign_member(GCObjectStore * gc,
|
||||
void * parent,
|
||||
obj<AGCObject> * p_lhs,
|
||||
obj<AGCObject> rhs);
|
||||
|
||||
/** swap {to, from} roles
|
||||
**/
|
||||
void swap_roles(Generation upto) noexcept;
|
||||
|
||||
/** On behalf of collector @p gc:
|
||||
*
|
||||
* forward mutation logs, for generations 0 <= g < @p upto,
|
||||
* from from-space to to-space.
|
||||
**/
|
||||
void forward_mutation_log(DX1Collector * gc,
|
||||
Generation upto);
|
||||
|
||||
private:
|
||||
/** aux init function: create mutation log **/
|
||||
MutationLog _make_mlog(uint32_t igen, char tag_char,
|
||||
size_t mlog_z, std::size_t page_z);
|
||||
|
||||
/** Append a single mutation to log for generation @p dest_g
|
||||
* Mutation modifies @p parent at address @p addr,
|
||||
* to refer to @p rhs.
|
||||
|
|
@ -64,27 +91,10 @@ namespace xo {
|
|||
* pointer. This means can alway recover that pointer
|
||||
* by consulting the AllocHeader for the pointer target
|
||||
*/
|
||||
void append_mutation(Generation dest_g,
|
||||
void * parent,
|
||||
void ** addr,
|
||||
obj<AGCObject> rhs);
|
||||
|
||||
/** swap {to, from} roles
|
||||
**/
|
||||
void swap_roles(Generation upto) noexcept;
|
||||
|
||||
/** On behalf of collector @p gc:
|
||||
*
|
||||
* forward mutation logs, for generations 0 <= g < @p upto,
|
||||
* from from-space to to-space.
|
||||
**/
|
||||
void forward_mutation_log(DX1Collector * gc,
|
||||
Generation upto);
|
||||
|
||||
private:
|
||||
/** aux init function: create mutation log **/
|
||||
MutationLog _make_mlog(uint32_t igen, char tag_char,
|
||||
size_t mlog_z, std::size_t page_z);
|
||||
void _append_mutation(Generation dest_g,
|
||||
void * parent,
|
||||
void ** addr,
|
||||
obj<AGCObject> rhs);
|
||||
|
||||
/** On behalf of collctor @p gc:
|
||||
*
|
||||
|
|
|
|||
|
|
@ -51,8 +51,11 @@ namespace xo {
|
|||
|
||||
/** fetch configuration for mutation log store **/
|
||||
MutationLogConfig mlog_config() const noexcept {
|
||||
bool mlog_enabled_flag = allow_incremental_gc_;
|
||||
|
||||
return MutationLogConfig(n_generation_,
|
||||
mutation_log_z_,
|
||||
mlog_enabled_flag,
|
||||
debug_flag_);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue