summaryrefslogtreecommitdiff
path: root/src/sim/faults.hh
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/faults.hh
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/faults.hh')
-rw-r--r--src/sim/faults.hh20
1 files changed, 10 insertions, 10 deletions
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__