12#include "sparta/functional/ArchData.hpp"
14#include "sparta/utils/MathUtils.hpp"
16namespace sparta::serialization::checkpoint {
109 template <
class CheckpointableT,
typename... CpArgs>
112 static_assert(
false == std::is_pointer_v<CheckpointableT>,
113 "Checkpointable object cannot be a pointer");
114 constexpr size_t checkpointable_size =
115 utils::next_power_of_2(
sizeof(CheckpointableT));
116 auto &cp_component = checkpoint_components_.emplace_back(
117 new CheckpointComponent(cp_node_, checkpointable_size));
119 auto cp_mem = cp_component->getRawDataPtr();
120 return *(
new (cp_mem) CheckpointableT(cp_args...));
126 struct CheckpointComponent
129 ArchData::offset_type line_size)
130 : adata_(cp_node, line_size,
ArchData::DEFAULT_INITIAL_FILL,
131 ArchData::DEFAULT_INITIAL_FILL_SIZE,
133 dview_(&adata_, 0, line_size,
149 std::vector<std::unique_ptr<CheckpointComponent>> checkpoint_components_;
Basic Node framework in sparta device tree composite pattern.
uint8_t * getRawDataPtr(const offset_type offset)
return the raw data pointer for this line for direct read and write. No error checking is performed....
Contains a set of contiguous line of architectural data which can be referred to by any architected o...
void layout()
Organizes the Segments into overlapping regions as needed, eventually calling ArchDataSegment::place ...
View into a backend block of memory in an ArchData.
ArchData::Line * getLine() const
Get already-placed line.
Node in a composite tree representing a sparta Tree item.
Class to enable a modeler to register checkpointable objects in simulation.
CheckpointableT & allocateCheckpointable(CpArgs... cp_args)
Allocate a checkpointable type.
Checkpointable(sparta::TreeNode *cp_node)
Create a Checkpointable object used to allocate components for checkpointing.