Gabe Black has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/52074 )

Change subject: arch: Make the decoder reset() method virtual.
......................................................................

arch: Make the decoder reset() method virtual.

This is called very infrequently, and so it's virtual overhead is
practically irrelevant.

Change-Id: If92cd96f75234c65c4cdffe392c32cfdd9b0c8cb
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/52074
Reviewed-by: Daniel Carvalho <[email protected]>
Maintainer: Gabe Black <[email protected]>
Tested-by: kokoro <[email protected]>
---
M src/arch/generic/decoder.hh
M src/arch/riscv/decoder.cc
M src/arch/riscv/decoder.hh
M src/arch/sparc/decoder.hh
M src/arch/mips/decoder.hh
M src/arch/power/decoder.hh
M src/arch/x86/decoder.hh
M src/arch/arm/decoder.cc
M src/arch/arm/decoder.hh
9 files changed, 31 insertions(+), 25 deletions(-)

Approvals:
  Daniel Carvalho: Looks good to me, approved
  Gabe Black: Looks good to me, approved
  kokoro: Regressions pass




diff --git a/src/arch/arm/decoder.cc b/src/arch/arm/decoder.cc
index 835626f..7297161 100644
--- a/src/arch/arm/decoder.cc
+++ b/src/arch/arm/decoder.cc
@@ -67,11 +67,10 @@
 void
 Decoder::reset()
 {
+    InstDecoder::reset();
     bigThumb = false;
     offset = 0;
     emi = 0;
-    instDone = false;
-    outOfBytes = true;
     foundIt = false;
 }

diff --git a/src/arch/arm/decoder.hh b/src/arch/arm/decoder.hh
index 592a59c..d2e0c68 100644
--- a/src/arch/arm/decoder.hh
+++ b/src/arch/arm/decoder.hh
@@ -133,7 +133,7 @@
     Decoder(ISA* isa = nullptr);

     /** Reset the decoders internal state. */
-    void reset();
+    void reset() override;

     /**
      * Feed data to the decoder.
diff --git a/src/arch/generic/decoder.hh b/src/arch/generic/decoder.hh
index 658d860..e9ebba8 100644
--- a/src/arch/generic/decoder.hh
+++ b/src/arch/generic/decoder.hh
@@ -55,6 +55,12 @@

     virtual StaticInstPtr fetchRomMicroop(
             MicroPC micropc, StaticInstPtr curMacroop);
+    virtual void
+    reset()
+    {
+        instDone = false;
+        outOfBytes = true;
+    }

     void *moreBytesPtr() const { return _moreBytesPtr; }
     size_t moreBytesSize() const { return _moreBytesSize; }
diff --git a/src/arch/mips/decoder.hh b/src/arch/mips/decoder.hh
index 398e3f6..9480bd8 100644
--- a/src/arch/mips/decoder.hh
+++ b/src/arch/mips/decoder.hh
@@ -60,12 +60,6 @@
     {
     }

-    void
-    reset()
-    {
-        instDone = false;
-    }
-
     //Use this to give data to the decoder. This should be used
     //when there is control flow.
     void
diff --git a/src/arch/power/decoder.hh b/src/arch/power/decoder.hh
index b9a29f7..d4381ae 100644
--- a/src/arch/power/decoder.hh
+++ b/src/arch/power/decoder.hh
@@ -57,12 +57,6 @@
     {
     }

-    void
-    reset()
-    {
-        instDone = false;
-    }
-
     // Use this to give data to the predecoder. This should be used
     // when there is control flow.
     void
diff --git a/src/arch/riscv/decoder.cc b/src/arch/riscv/decoder.cc
index eaec4dc..4fbcc64 100644
--- a/src/arch/riscv/decoder.cc
+++ b/src/arch/riscv/decoder.cc
@@ -42,9 +42,7 @@
 {
     aligned = true;
     mid = false;
-    outOfBytes = true;
     emi = 0;
-    instDone = false;
 }

 void
diff --git a/src/arch/riscv/decoder.hh b/src/arch/riscv/decoder.hh
index 8290620..1d3a309 100644
--- a/src/arch/riscv/decoder.hh
+++ b/src/arch/riscv/decoder.hh
@@ -68,7 +68,7 @@
     Decoder(ISA* isa=nullptr) : InstDecoder(&machInst) { reset(); }

     void process() {}
-    void reset();
+    void reset() override;

     inline bool compressed(ExtMachInst inst) { return (inst & 0x3) < 0x3; }

diff --git a/src/arch/sparc/decoder.hh b/src/arch/sparc/decoder.hh
index 91bf7f9..20f797a 100644
--- a/src/arch/sparc/decoder.hh
+++ b/src/arch/sparc/decoder.hh
@@ -56,12 +56,6 @@

     void process() {}

-    void
-    reset()
-    {
-        instDone = false;
-    }
-
     // Use this to give data to the predecoder. This should be used
     // when there is control flow.
     void
diff --git a/src/arch/x86/decoder.hh b/src/arch/x86/decoder.hh
index d012d84..9bc0afe 100644
--- a/src/arch/x86/decoder.hh
+++ b/src/arch/x86/decoder.hh
@@ -302,7 +302,12 @@
         stack = old->stack;
     }

-    void reset() { state = ResetState; }
+    void
+    reset() override
+    {
+        InstDecoder::reset();
+        state = ResetState;
+    }

     void process();


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/52074
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: If92cd96f75234c65c4cdffe392c32cfdd9b0c8cb
Gerrit-Change-Number: 52074
Gerrit-PatchSet: 21
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Reviewer: Daniel Carvalho <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to