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:
@@ -76,7 +76,7 @@ class StackTrace
|
||||
|
||||
public:
|
||||
StackTrace();
|
||||
StackTrace(ThreadContext *tc, StaticInstPtr inst);
|
||||
StackTrace(ThreadContext *tc, const StaticInstPtr &inst);
|
||||
~StackTrace();
|
||||
|
||||
void
|
||||
@@ -87,7 +87,7 @@ class StackTrace
|
||||
}
|
||||
|
||||
bool valid() const { return tc != NULL; }
|
||||
bool trace(ThreadContext *tc, StaticInstPtr inst);
|
||||
bool trace(ThreadContext *tc, const StaticInstPtr &inst);
|
||||
|
||||
public:
|
||||
const std::vector<Addr> &getstack() const { return stack; }
|
||||
@@ -111,7 +111,7 @@ class StackTrace
|
||||
};
|
||||
|
||||
inline bool
|
||||
StackTrace::trace(ThreadContext *tc, StaticInstPtr inst)
|
||||
StackTrace::trace(ThreadContext *tc, const StaticInstPtr &inst)
|
||||
{
|
||||
if (!inst->isCall() && !inst->isReturn())
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user