arch-x86,arch-arm: Remove static variables in decoders (#1643)

There were a number of variables in the arm and x86 decoders that are
static (e.g., the decode cache). It's a bit interesting that this
doesn't cause problems with multiple cores since each core has its own
decoder.

However, this causes segfaults if you run different cores on different
*host* threads. We are experimenting with running gem5 with multiple
host thread (i.e., in parallel), and removing these static variables
resolves the segfault.

This change also adds const to any other static variables to ensure that
they cannot be modified.

Signed-off-by: Jason Lowe-Power <jason@lowepower.com>
This commit is contained in:
Jason Lowe-Power
2024-10-17 08:17:34 -07:00
committed by GitHub
parent deb8f983a1
commit f55a4ce989
4 changed files with 13 additions and 20 deletions

View File

@@ -94,7 +94,7 @@ class Decoder : public InstDecoder
enums::DecoderFlavor decoderFlavor;
/// A cache of decoded instruction objects.
static GenericISA::BasicDecodeCache<Decoder, ExtMachInst> defaultCache;
GenericISA::BasicDecodeCache<Decoder, ExtMachInst> defaultCache;
friend class GenericISA::BasicDecodeCache<Decoder, ExtMachInst>;
/**