Skip to content

Commit 81169aa

Browse files
committed
refactor: rename pm-type-name
poor-type-name is more legible
1 parent 0f488cb commit 81169aa

File tree

4 files changed

+20
-20
lines changed

4 files changed

+20
-20
lines changed

src/i-state-access.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#include "dump.h"
2929
#include "i-prefer-shadow-state.h"
3030
#include "meta.h"
31-
#include "pm-type-name.h"
31+
#include "poor-type-name.h"
3232
#include "tlb.h"
3333

3434
namespace cartesi {
@@ -332,7 +332,7 @@ class i_state_access { // CRTP
332332
derived().template do_read_memory_word<T, A>(faddr, pma_index, pval);
333333
[[maybe_unused]] const auto fast_addr_name = std::is_same_v<fast_addr, uint64_t> ? "phys_addr" : "fast_addr";
334334
DSA_PRINTF("%s::read_memory_word<%s,%s>(%s{0x%" PRIx64 "}, %" PRIu64 ") = %" PRIu64 "(0x%" PRIx64 ")\n",
335-
get_name(), pm_type_name_v<T>, pm_type_name_v<A>, fast_addr_name, faddr, pma_index,
335+
get_name(), poor_type_name_v<T>, poor_type_name_v<A>, fast_addr_name, faddr, pma_index,
336336
static_cast<uint64_t>(*pval), static_cast<uint64_t>(*pval));
337337
}
338338

@@ -349,7 +349,7 @@ class i_state_access { // CRTP
349349
derived().template do_write_memory_word<T, A>(faddr, pma_index, val);
350350
[[maybe_unused]] const auto fast_addr_name = std::is_same_v<fast_addr, uint64_t> ? "phys_addr" : "fast_addr";
351351
DSA_PRINTF("%s::write_memory_word<%s,%s>(%s{0x%" PRIx64 "}, %" PRIu64 ", %" PRIu64 "(0x%" PRIx64 "))\n",
352-
get_name(), pm_type_name_v<T>, pm_type_name_v<A>, fast_addr_name, faddr, pma_index,
352+
get_name(), poor_type_name_v<T>, poor_type_name_v<A>, fast_addr_name, faddr, pma_index,
353353
static_cast<uint64_t>(val), static_cast<uint64_t>(val));
354354
}
355355

src/jsonrpc-machine.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -772,8 +772,8 @@ void jsonrpc_machine::do_send_cmio_response(uint16_t reason, const unsigned char
772772
request("machine.send_cmio_response", std::tie(reason, b64), result);
773773
}
774774

775-
access_log jsonrpc_machine::do_log_send_cmio_response(uint16_t reason, const unsigned char *data,
776-
uint64_t length, const access_log::type &log_type) {
775+
access_log jsonrpc_machine::do_log_send_cmio_response(uint16_t reason, const unsigned char *data, uint64_t length,
776+
const access_log::type &log_type) {
777777
not_default_constructible<access_log> result;
778778
std::string b64 = cartesi::encode_base64(data, length);
779779
request("machine.log_send_cmio_response", std::tie(reason, b64, log_type), result);

src/machine-c-api.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#include "i-machine.h"
3838
#include "interpret.h"
3939
#include "json-util.h"
40+
#include "local-machine.h"
4041
#include "machine-c-api-internal.h"
4142
#include "machine-config.h"
4243
#include "machine-merkle-tree.h"
@@ -45,7 +46,6 @@
4546
#include "machine.h"
4647
#include "os-features.h"
4748
#include "pmas-defines.h"
48-
#include "local-machine.h"
4949

5050
static_assert(AR_CMIO_RX_BUFFER_START_DEF == CM_AR_CMIO_RX_BUFFER_START);
5151
static_assert(AR_CMIO_RX_BUFFER_LOG2_SIZE_DEF == CM_AR_CMIO_RX_BUFFER_LOG2_SIZE);

src/pm-type-name.h src/poor-type-name.h

+14-14
Original file line numberDiff line numberDiff line change
@@ -14,35 +14,35 @@
1414
// with this program (see COPYING). If not, see <https://www.gnu.org/licenses/>.
1515
//
1616

17-
#ifndef PM_TYPE_NAME_H
18-
#define PM_TYPE_NAME_H
17+
#ifndef POOR_TYPE_NAME_H
18+
#define POOR_TYPE_NAME_H
1919

2020
namespace cartesi {
2121

2222
//?DD Poor man's rtti that works in microarchitecture
2323
template <typename T>
24-
struct pm_type_name {
24+
struct poor_type_name {
2525
static constexpr const char *value = "unknown";
2626
};
2727

2828
template <typename T>
29-
constexpr const char *pm_type_name_v = pm_type_name<T>::value;
29+
constexpr const char *poor_type_name_v = poor_type_name<T>::value;
3030

3131
// NOLINTBEGIN(cppcoreguidelines-macro-usage)
32-
#define PM_TYPE_NAME(type) \
32+
#define POOR_TYPE_NAME(type) \
3333
template <> \
34-
struct pm_type_name<type> { \
34+
struct poor_type_name<type> { \
3535
static constexpr const char *value = #type; \
3636
}
3737

38-
PM_TYPE_NAME(uint8_t);
39-
PM_TYPE_NAME(int8_t);
40-
PM_TYPE_NAME(uint16_t);
41-
PM_TYPE_NAME(int16_t);
42-
PM_TYPE_NAME(uint32_t);
43-
PM_TYPE_NAME(int32_t);
44-
PM_TYPE_NAME(uint64_t);
45-
PM_TYPE_NAME(int64_t);
38+
POOR_TYPE_NAME(uint8_t);
39+
POOR_TYPE_NAME(int8_t);
40+
POOR_TYPE_NAME(uint16_t);
41+
POOR_TYPE_NAME(int16_t);
42+
POOR_TYPE_NAME(uint32_t);
43+
POOR_TYPE_NAME(int32_t);
44+
POOR_TYPE_NAME(uint64_t);
45+
POOR_TYPE_NAME(int64_t);
4646
// NOLINTEND(cppcoreguidelines-macro-usage)
4747

4848
} // namespace cartesi

0 commit comments

Comments
 (0)