cpu: Use a unique_ptr to manage cached disassembly.

This is a fairly minor improvement, but avoids having to manually keep
track of that string pointer.

Change-Id: Ic3d4ddd9445920a110b36ab0cd64ff2289cf0139
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/42967
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
This commit is contained in:
Gabe Black
2021-03-15 01:55:31 -07:00
parent c0317722ec
commit d79d8498a4
4 changed files with 14 additions and 24 deletions

View File

@@ -283,7 +283,7 @@ class StaticInst : public RefCounted, public StaticInstFlags
* String representation of disassembly (lazily evaluated via
* disassemble()).
*/
mutable std::string *cachedDisassembly = nullptr;
mutable std::unique_ptr<std::string> cachedDisassembly;
/**
* Internal function to generate disassembly string.
@@ -301,7 +301,7 @@ class StaticInst : public RefCounted, public StaticInstFlags
{}
public:
virtual ~StaticInst();
virtual ~StaticInst() {};
virtual Fault execute(ExecContext *xc,
Trace::InstRecord *traceData) const = 0;