qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 06/20] disas/nanomips: Remove disasm methods from class


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH 06/20] disas/nanomips: Remove disasm methods from class
Date: Mon, 15 Aug 2022 13:45:19 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.12.0

On 15/8/22 09:26, Milica Lazarevic wrote:
NMD class methods with the disassembly_function type like
NMD::ABS_D, NMD::ABS_S, etc. are removed from the class. They're now
declared global static functions. Therefore, typedef of the function
pointer, disassembly_function is defined outside of the class.

Now that disassembly_function type functions are not part of the NMD
class we can't access them using the this pointer. Thus, the use of
the this pointer has been deleted.

Signed-off-by: Milica Lazarevic <milica.lazarevic@syrmia.com>
---
  disas/nanomips.cpp | 2546 ++++++++++++++++++++++----------------------
  disas/nanomips.h   |  640 +----------
  2 files changed, 1274 insertions(+), 1912 deletions(-)

diff --git a/disas/nanomips.cpp b/disas/nanomips.cpp
index 9e720d0e8d..205c4f3143 100644
--- a/disas/nanomips.cpp
+++ b/disas/nanomips.cpp
@@ -815,7 +815,7 @@ int NMD::Disassemble(const uint16 * data, std::string & dis,
                                  return -6;
                              }
                              type = table[i].type;
-                            dis = (this->*dis_fn)(op_code);
+                            dis = (dis_fn)(op_code);

  dis_fn(op_code);

                              return table[i].instructions_size;
                          } else {
                              dis = "reserved instruction";

diff --git a/disas/nanomips.h b/disas/nanomips.h
index 0e6670adf5..d27711b4e2 100644
--- a/disas/nanomips.h
+++ b/disas/nanomips.h
@@ -32,6 +32,7 @@ typedef uint16_t uint16;
  typedef uint64_t img_address;
typedef bool(*conditional_function)(uint64 instruction);
+typedef std::string(*disassembly_function)(uint64 instruction);

   typedef std::string (*nmd_disas_fn)(uint64 instruction);

enum TABLE_ENTRY_TYPE {
      instruction,
@@ -72,8 +73,6 @@ public:
private: - typedef std::string(NMD:: *disassembly_function)(uint64 instruction);
-
      struct Pool {
          TABLE_ENTRY_TYPE     type;
          struct Pool          *next_table;
@@ -90,643 +89,6 @@ private:
      int Disassemble(const uint16 *data, std::string & dis,
                      TABLE_ENTRY_TYPE & type, const Pool *table, int 
table_size);

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]