xo-gc: + MutationLogEntry.hpp [WIP]
This commit is contained in:
parent
67bed95cc2
commit
2c2332c0a9
1 changed files with 47 additions and 0 deletions
47
include/xo/gc/MutationLogEntry.hpp
Normal file
47
include/xo/gc/MutationLogEntry.hpp
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
/** @file MutationLogEntry.hpp
|
||||
*
|
||||
* @author Roland Conybeare, Mar 2026
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "GCObject.hpp"
|
||||
|
||||
namespace xo {
|
||||
namespace mm {
|
||||
|
||||
/** @brief Track a cross-generational pointer
|
||||
*
|
||||
* GC must update pointer when collecting space that target occupies
|
||||
*
|
||||
* Design notes:
|
||||
* - parent must be located at the beginning of an allocation,
|
||||
* (so that it's immediately preceded by allocation header)
|
||||
* - destination can be something like
|
||||
* obj<AGCObject>
|
||||
* but also something else such as
|
||||
* {obj<AType>, obj<ASyntaxStateMachine>, ..}
|
||||
* - for collector need to traverse data pointer *data
|
||||
**/
|
||||
class MutationLogEntry {
|
||||
public:
|
||||
MutationLogEntry(void * parent, void ** p_data, obj<AGCObject> snap);
|
||||
|
||||
private:
|
||||
/** address of object containing logged mutation **/
|
||||
void * parent_ = nullptr;
|
||||
/** address of target member of object at address @ref parent_,
|
||||
* driving this log entry.
|
||||
**/
|
||||
void ** p_data_ = nullptr;
|
||||
/** AGCObject i/face pointer, asof assignment responsible for this log entry.
|
||||
* If *p_data_ matches snap_.data(), then AGCObject interface is snap_.iface().
|
||||
* Otherwise log entry has been superseded by another assignment.
|
||||
**/
|
||||
obj<AGCObject> snap_;
|
||||
};
|
||||
|
||||
} /*namespace mm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end MutationLogEntry.hpp */
|
||||
Loading…
Add table
Add a link
Reference in a new issue