[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 0/20] Convert nanoMIPS disassembler from C++ to C
From: |
Milica Lazarevic |
Subject: |
[PATCH v2 0/20] Convert nanoMIPS disassembler from C++ to C |
Date: |
Mon, 5 Sep 2022 11:55:02 +0200 |
Hi,
This patchset converts the nanomips disassembler to plain C. C++ features
like class, std::string type, exception handling, and function overloading
have been removed and replaced with the equivalent C code.
===============================
Changes since previous version:
(1) disas/nanomips: Remove namespace img
Removed comments that refer to the deleted function.
(3) disas/nanomips: Delete NMD class fields
Class fields were introduced as global variables in the previous version.
Since it wasn't a thread-safe solution, in this version, one class field
(m_requested_instruction_categories) has been replaced with the only
value
it can have, while the other class field has been added as a parameter
where needed.
(4) disas/nanomips: Remove helper methods from class
Squashed patch #19 here.
(5) disas/nanomips: Remove __cond methods from class
Addressed the coding style issues.
(6) disas/nanomips: Remove disasm methods from class
Addressed the coding style issues.
(12) disas/nanomips: Replace std::string type
Changed the return types to char * when a function returns allocated
memory.
Switched to using some glib functions for memory allocation like g_malloc,
g_strdup_vprintf, and g_strdup_printf instead of strdup.
(13) disas/nanomips: Prevent memory leaking
Used the g_autofree attribute for dynamically allocated strings, instead
of
calling free(). Now, this patch is much smaller than in the previous
version.
(14) disas/nanomips: Introduce Dis_info struct
Same as in (3). Instead of using global variables, all the necessary
information
are packed into the struct and added as an argument wherever needed.
Regards,
Milica
Milica Lazarevic (20):
disas/nanomips: Remove namespace img
disas/nanomips: Extract enums out of the NMD class
disas/nanomips: Delete NMD class fields
disas/nanomips: Remove helper methods from class
disas/nanomips: Remove __cond methods from class
disas/nanomips: Remove disasm methods from class
disas/nanomips: Remove Pool tables from the class
disas/nanomips: Remove NMD class
disas/nanomips: Move typedefs etc to nanomips.cpp
disas/nanomips: Delete nanomips.h
disas/nanomips: Remove #inlcude <sstream>
disas/nanomips: Replace std::string type
disas/nanomips: Prevent memory leaking
disas/nanomips: Remove function overloading
disas/nanomips: Introduce Dis_info struct
disas/nanomips: Replace exception handling
disas/nanomips: Replace Cpp enums for C enums
disas/nanomips: Remove argument passing by ref
disas/nanomips: Add struct keyword
disas/nanomips: Rename nanomips.cpp to nanomips.c
disas/meson.build | 2 +-
disas/{nanomips.cpp => nanomips.c} | 7155 ++++++++++++++++++------------------
disas/nanomips.h | 1072 ------
3 files changed, 3557 insertions(+), 4672 deletions(-)
- [PATCH v2 0/20] Convert nanoMIPS disassembler from C++ to C,
Milica Lazarevic <=
- [PATCH v2 01/20] disas/nanomips: Remove namespace img, Milica Lazarevic, 2022/09/05
- [PATCH v2 02/20] disas/nanomips: Extract enums out of the NMD class, Milica Lazarevic, 2022/09/05
- [PATCH v2 05/20] disas/nanomips: Remove __cond methods from class, Milica Lazarevic, 2022/09/05
- [PATCH v2 03/20] disas/nanomips: Delete NMD class fields, Milica Lazarevic, 2022/09/05
- [PATCH v2 04/20] disas/nanomips: Remove helper methods from class, Milica Lazarevic, 2022/09/05