22
22
#include < cassert>
23
23
#include < cstdint>
24
24
#include < cstring>
25
- #include < memory>
26
25
#include < stdexcept>
27
26
#include < string>
28
27
#include < utility>
@@ -61,8 +60,8 @@ class uarch_record_state_access :
61
60
62
61
// NOLINTBEGIN(cppcoreguidelines-avoid-const-or-ref-data-members)
63
62
machine &m_m; // /< Macro machine
63
+ access_log &m_log; // /< Access log
64
64
// NOLINTEND(cppcoreguidelines-avoid-const-or-ref-data-members)
65
- std::shared_ptr<access_log> m_log; // /< Pointer to access log
66
65
67
66
static auto get_hash (hasher_type &hasher, const access_data &data) {
68
67
hash_type hash{};
@@ -72,35 +71,14 @@ class uarch_record_state_access :
72
71
73
72
public:
74
73
// / \brief Constructor from machine and uarch states.
75
- // / \param um Reference to uarch state.
76
74
// / \param m Reference to machine state.
77
- explicit uarch_record_state_access (machine &m, access_log::type log_type) :
75
+ // / \param log Reference to log.
76
+ explicit uarch_record_state_access (machine &m, access_log &log) :
78
77
m_m(m),
79
- m_log(std::make_shared<access_log>(log_type) ) {
78
+ m_log(log ) {
80
79
;
81
80
}
82
81
83
- // / \brief No copy constructor
84
- uarch_record_state_access (const uarch_record_state_access &) = delete ;
85
- // / \brief No copy assignment
86
- uarch_record_state_access &operator =(const uarch_record_state_access &) = delete ;
87
- // / \brief No move constructor
88
- uarch_record_state_access (uarch_record_state_access &&) = delete ;
89
- // / \brief No move assignment
90
- uarch_record_state_access &operator =(uarch_record_state_access &&) = delete ;
91
- // / \brief Default destructor
92
- ~uarch_record_state_access () = default ;
93
-
94
- // / \brief Returns const pointer to access log.
95
- std::shared_ptr<const access_log> get_log () const {
96
- return m_log;
97
- }
98
-
99
- // / \brief Returns pointer to access log.
100
- std::shared_ptr<access_log> get_log () {
101
- return m_log;
102
- }
103
-
104
82
private:
105
83
static std::pair<uint64_t , int > adjust_access (uint64_t paddr, int log2_size) {
106
84
static_assert (cartesi::log2_size_v<uint64_t > <= machine_merkle_tree::get_log2_word_size (),
@@ -115,7 +93,7 @@ class uarch_record_state_access :
115
93
}
116
94
117
95
void log_access (access &&a, const char *text) const {
118
- m_log-> push_access (std::move (a), text);
96
+ m_log. push_access (std::move (a), text);
119
97
}
120
98
121
99
static void log_access_type (access &a, access_type type) {
@@ -150,7 +128,7 @@ class uarch_record_state_access :
150
128
}
151
129
152
130
void log_read_data_if_requested (access &a, uint64_t paddr, int log2_size) const {
153
- if (m_log-> get_log_type ().has_large_data ()) {
131
+ if (m_log. get_log_type ().has_large_data ()) {
154
132
std::ignore = log_read_data (a, paddr, log2_size);
155
133
}
156
134
}
@@ -165,7 +143,7 @@ class uarch_record_state_access :
165
143
}
166
144
167
145
void log_written_data_if_requested (access &a, uint64_t paddr, int log2_size) const {
168
- if (m_log-> get_log_type ().has_large_data ()) {
146
+ if (m_log. get_log_type ().has_large_data ()) {
169
147
log_written_data (a, paddr, log2_size);
170
148
}
171
149
}
@@ -320,11 +298,11 @@ class uarch_record_state_access :
320
298
friend i_accept_scoped_note<uarch_record_state_access>;
321
299
322
300
void do_push_begin_bracket (const char *text) {
323
- m_log-> push_begin_bracket (text);
301
+ m_log. push_begin_bracket (text);
324
302
}
325
303
326
304
void do_push_end_bracket (const char *text) {
327
- m_log-> push_end_bracket (text);
305
+ m_log. push_end_bracket (text);
328
306
}
329
307
330
308
auto do_make_scoped_note (const char *text) {
0 commit comments