arch: Use const StaticInstPtr references where possible

This patch optimises the passing of StaticInstPtr by avoiding copying
the reference-counting pointer. This avoids first incrementing and
then decrementing the reference-counting pointer.
This commit is contained in:
Andreas Hansson
2014-09-27 09:08:36 -04:00
parent deb2200671
commit 341dbf2662
47 changed files with 194 additions and 191 deletions

View File

@@ -946,12 +946,13 @@ FullO3CPU<Impl>::processInterrupts(const Fault &interrupt)
this->interrupts->updateIntrInfo(this->threadContexts[0]);
DPRINTF(O3CPU, "Interrupt %s being handled\n", interrupt->name());
this->trap(interrupt, 0, NULL);
this->trap(interrupt, 0, nullptr);
}
template <class Impl>
void
FullO3CPU<Impl>::trap(const Fault &fault, ThreadID tid, StaticInstPtr inst)
FullO3CPU<Impl>::trap(const Fault &fault, ThreadID tid,
const StaticInstPtr &inst)
{
// Pass the thread's TC into the invoke method.
fault->invoke(this->threadContexts[tid], inst);

View File

@@ -376,7 +376,7 @@ class FullO3CPU : public BaseO3CPU
{ return globalSeqNum++; }
/** Traps to handle given fault. */
void trap(const Fault &fault, ThreadID tid, StaticInstPtr inst);
void trap(const Fault &fault, ThreadID tid, const StaticInstPtr &inst);
/** HW return from error interrupt. */
Fault hwrei(ThreadID tid);

View File

@@ -83,12 +83,13 @@ class BaseO3DynInst : public BaseDynInst<Impl>
public:
/** BaseDynInst constructor given a binary instruction. */
BaseO3DynInst(StaticInstPtr staticInst, StaticInstPtr macroop,
BaseO3DynInst(const StaticInstPtr &staticInst, const StaticInstPtr &macroop,
TheISA::PCState pc, TheISA::PCState predPC,
InstSeqNum seq_num, O3CPU *cpu);
/** BaseDynInst constructor given a static inst pointer. */
BaseO3DynInst(StaticInstPtr _staticInst, StaticInstPtr _macroop);
BaseO3DynInst(const StaticInstPtr &_staticInst,
const StaticInstPtr &_macroop);
~BaseO3DynInst();

View File

@@ -49,8 +49,8 @@
#include "debug/O3PipeView.hh"
template <class Impl>
BaseO3DynInst<Impl>::BaseO3DynInst(StaticInstPtr staticInst,
StaticInstPtr macroop,
BaseO3DynInst<Impl>::BaseO3DynInst(const StaticInstPtr &staticInst,
const StaticInstPtr &macroop,
TheISA::PCState pc, TheISA::PCState predPC,
InstSeqNum seq_num, O3CPU *cpu)
: BaseDynInst<Impl>(staticInst, macroop, pc, predPC, seq_num, cpu)
@@ -59,8 +59,8 @@ BaseO3DynInst<Impl>::BaseO3DynInst(StaticInstPtr staticInst,
}
template <class Impl>
BaseO3DynInst<Impl>::BaseO3DynInst(StaticInstPtr _staticInst,
StaticInstPtr _macroop)
BaseO3DynInst<Impl>::BaseO3DynInst(const StaticInstPtr &_staticInst,
const StaticInstPtr &_macroop)
: BaseDynInst<Impl>(_staticInst, _macroop)
{
initVars();