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 <odanrc@yahoo.com.br>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
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();