summaryrefslogtreecommitdiff
path: root/src/sim
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2014-09-27 09:08:36 -0400
committerAndreas Hansson <andreas.hansson@arm.com>2014-09-27 09:08:36 -0400
commit341dbf266258dcbdb1e5e9f09c244b8ac271faaf (patch)
treef071f9a91adeb0c1eb0888ae751c3ee0196bd65d /src/sim
parentdeb2200671d5b4856ca27d4286253db0d9e12a32 (diff)
downloadgem5-341dbf266258dcbdb1e5e9f09c244b8ac271faaf.tar.xz
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.
Diffstat (limited to 'src/sim')
-rw-r--r--src/sim/faults.cc10
-rw-r--r--src/sim/faults.hh20
2 files changed, 15 insertions, 15 deletions
diff --git a/src/sim/faults.cc b/src/sim/faults.cc
index c409aa95b..e2562fca6 100644
--- a/src/sim/faults.cc
+++ b/src/sim/faults.cc
@@ -39,7 +39,7 @@
#include "sim/full_system.hh"
#include "sim/process.hh"
-void FaultBase::invoke(ThreadContext * tc, StaticInstPtr inst)
+void FaultBase::invoke(ThreadContext * tc, const StaticInstPtr &inst)
{
if (FullSystem) {
DPRINTF(Fault, "Fault %s at PC: %s\n", name(), tc->pcState());
@@ -49,17 +49,17 @@ void FaultBase::invoke(ThreadContext * tc, StaticInstPtr inst)
}
}
-void UnimpFault::invoke(ThreadContext * tc, StaticInstPtr inst)
+void UnimpFault::invoke(ThreadContext * tc, const StaticInstPtr &inst)
{
panic("Unimpfault: %s\n", panicStr.c_str());
}
-void ReExec::invoke(ThreadContext *tc, StaticInstPtr inst)
+void ReExec::invoke(ThreadContext *tc, const StaticInstPtr &inst)
{
tc->pcState(tc->pcState());
}
-void GenericPageTableFault::invoke(ThreadContext *tc, StaticInstPtr inst)
+void GenericPageTableFault::invoke(ThreadContext *tc, const StaticInstPtr &inst)
{
bool handled = false;
if (!FullSystem) {
@@ -71,7 +71,7 @@ void GenericPageTableFault::invoke(ThreadContext *tc, StaticInstPtr inst)
}
-void GenericAlignmentFault::invoke(ThreadContext *tc, StaticInstPtr inst)
+void GenericAlignmentFault::invoke(ThreadContext *tc, const StaticInstPtr &inst)
{
panic("Alignment fault when accessing virtual address %#x\n", vaddr);
}
diff --git a/src/sim/faults.hh b/src/sim/faults.hh
index 4cdb24aee..0377c0893 100644
--- a/src/sim/faults.hh
+++ b/src/sim/faults.hh
@@ -54,8 +54,8 @@ class FaultBase : public RefCounted
{
public:
virtual FaultName name() const = 0;
- virtual void invoke(ThreadContext * tc,
- StaticInstPtr inst = StaticInst::nullStaticInstPtr);
+ virtual void invoke(ThreadContext * tc, const StaticInstPtr &inst =
+ StaticInst::nullStaticInstPtr);
};
class UnimpFault : public FaultBase
@@ -68,8 +68,8 @@ class UnimpFault : public FaultBase
{ }
FaultName name() const {return "Unimplemented simulator feature";}
- void invoke(ThreadContext * tc,
- StaticInstPtr inst = StaticInst::nullStaticInstPtr);
+ void invoke(ThreadContext * tc, const StaticInstPtr &inst =
+ StaticInst::nullStaticInstPtr);
};
class ReExec : public FaultBase
@@ -77,8 +77,8 @@ class ReExec : public FaultBase
public:
virtual FaultName name() const { return "Re-execution fault";}
ReExec() {}
- void invoke(ThreadContext *tc,
- StaticInstPtr inst = StaticInst::nullStaticInstPtr);
+ void invoke(ThreadContext *tc, const StaticInstPtr &inst =
+ StaticInst::nullStaticInstPtr);
};
class GenericPageTableFault : public FaultBase
@@ -88,8 +88,8 @@ class GenericPageTableFault : public FaultBase
public:
FaultName name() const {return "Generic page table fault";}
GenericPageTableFault(Addr va) : vaddr(va) {}
- void invoke(ThreadContext * tc,
- StaticInstPtr inst = StaticInst::nullStaticInstPtr);
+ void invoke(ThreadContext * tc, const StaticInstPtr &inst =
+ StaticInst::nullStaticInstPtr);
};
class GenericAlignmentFault : public FaultBase
@@ -99,8 +99,8 @@ class GenericAlignmentFault : public FaultBase
public:
FaultName name() const {return "Generic alignment fault";}
GenericAlignmentFault(Addr va) : vaddr(va) {}
- void invoke(ThreadContext * tc,
- StaticInstPtr inst = StaticInst::nullStaticInstPtr);
+ void invoke(ThreadContext * tc, const StaticInstPtr &inst =
+ StaticInst::nullStaticInstPtr);
};
#endif // __FAULTS_HH__