Gabe Black has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/53583 )
Change subject: cpu-minor: Get rid of the MinorDynInst::init function.
......................................................................
cpu-minor: Get rid of the MinorDynInst::init function.
Just initialize the global MinorDynInst::bubbleInst with a lambda to
avoid having a init() function somebody needs to remember to call, and
which needs to only be called once (or which should only do something
once).
Change-Id: Ied6397e52ccefd6e6bdca012a01f004a47d6f26e
---
M src/cpu/minor/dyn_inst.cc
M src/cpu/minor/dyn_inst.hh
M src/cpu/minor/cpu.cc
3 files changed, 21 insertions(+), 17 deletions(-)
diff --git a/src/cpu/minor/cpu.cc b/src/cpu/minor/cpu.cc
index cd9a11a..b8e9711 100644
--- a/src/cpu/minor/cpu.cc
+++ b/src/cpu/minor/cpu.cc
@@ -76,8 +76,6 @@
fatal("The Minor model doesn't support checking (yet)\n");
}
- minor::MinorDynInst::init();
-
pipeline = new minor::Pipeline(*this, params);
activityRecorder = pipeline->getActivityRecorder();
diff --git a/src/cpu/minor/dyn_inst.cc b/src/cpu/minor/dyn_inst.cc
index 8a07647..dfff813 100644
--- a/src/cpu/minor/dyn_inst.cc
+++ b/src/cpu/minor/dyn_inst.cc
@@ -77,18 +77,13 @@
return os;
}
-MinorDynInstPtr MinorDynInst::bubbleInst = NULL;
-
-void
-MinorDynInst::init()
-{
- if (!bubbleInst) {
- bubbleInst = new MinorDynInst(nullStaticInstPtr);
- assert(bubbleInst->isBubble());
- /* Make bubbleInst immortal */
- bubbleInst->incref();
- }
-}
+MinorDynInstPtr MinorDynInst::bubbleInst = []() {
+ auto *inst = new MinorDynInst(nullStaticInstPtr);
+ assert(inst->isBubble());
+ // Make bubbleInst immortal.
+ inst->incref();
+ return inst;
+}();
bool
MinorDynInst::isLastOpInInst() const
diff --git a/src/cpu/minor/dyn_inst.hh b/src/cpu/minor/dyn_inst.hh
index 96a1649..ec986cd 100644
--- a/src/cpu/minor/dyn_inst.hh
+++ b/src/cpu/minor/dyn_inst.hh
@@ -267,9 +267,6 @@
* a whole instruction or the last microop from a macroop */
bool isLastOpInInst() const;
- /** Initialise the class */
- static void init();
-
/** Print (possibly verbose) instruction information for
* MinorTrace using the given Named object's name */
void minorTraceInst(const Named &named_object,
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/53583
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: Ied6397e52ccefd6e6bdca012a01f004a47d6f26e
Gerrit-Change-Number: 53583
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <gabe.bl...@gmail.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s