ROSE 0.11.145.134
|
Smart pointer that locks an instruction AST.
This class is primarily used internally to implement temporary instruction locks in order to prevent the instruction from being evicted by an InstructionCache. Users will generally interact directly with InstructionPtr instead, and these LockedInstruction pointers are returned as temporaries.
A LockedInstruction pointer is like a shared-ownership smart pointer except instead of adjusting a reference count it adjusts a lock count. Any SgAsmInstruction AST node that has a positive lock count will not be evicted from an InstructionCache.
Definition at line 137 of file InstructionCache.h.
#include <Rose/BinaryAnalysis/InstructionCache.h>
Public Member Functions | |
LockedInstruction () | |
Construct a null pointer. | |
LockedInstruction (SgAsmInstruction *insn) | |
Point to a specific instruction. | |
LockedInstruction (const InstructionPtr &insn) | |
Point to a specific instruction. | |
LockedInstruction (const LockedInstruction &other) | |
Copy constructor. | |
LockedInstruction & | operator= (const LockedInstruction &other) |
Assignment. | |
~LockedInstruction () | |
Destructor. | |
void | reset () |
Reset to null. | |
SgAsmInstruction & | operator* () const |
Dereference. | |
SgAsmInstruction * | operator-> () const |
Dereference. | |
SgAsmInstruction * | get () const |
Get the raw pointer. | |
operator bool () const | |
Test whether this pointer is non-null. | |
|
explicit |
Point to a specific instruction.
The lock count for the instruction is incremented if insn
is non-null.
|
explicit |
Point to a specific instruction.
The instruction is loaded into memory (if it had been evicted) and is then locked into the cache by incrementing its lock count.
Rose::BinaryAnalysis::LockedInstruction::LockedInstruction | ( | const LockedInstruction & | other | ) |
Copy constructor.
The copy constructor increments the lock count on the instruction if other
is non-null.
Rose::BinaryAnalysis::LockedInstruction::~LockedInstruction | ( | ) |
Destructor.
The destructor decrements the lock count if this
was non-null.
LockedInstruction & Rose::BinaryAnalysis::LockedInstruction::operator= | ( | const LockedInstruction & | other | ) |
Assignment.
The lock counts for this
and other
are adjusted appropriately.
Thread safety: This method is thread safe.
void Rose::BinaryAnalysis::LockedInstruction::reset | ( | ) |
Reset to null.
After this call, the pointer will be a null pointer. If it had been pointing to anything previously, then the lock count for that object is decremented.
Thread safety: This method is thread safe.
SgAsmInstruction & Rose::BinaryAnalysis::LockedInstruction::operator* | ( | ) | const |
Dereference.
Dereferences this pointer to return a reference to the underlying SgAsmInstruction node. This pointer must not be a null pointer.
Thread safety: This method is thread safe.
|
inline |
Dereference.
Dereference this pointer to return a pointer to the SgAsmInstruction node. This pointer must not be a null pointer.
Thread safety: This method is thread safe.
Definition at line 501 of file InstructionCache.h.
SgAsmInstruction * Rose::BinaryAnalysis::LockedInstruction::get | ( | ) | const |
Get the raw pointer.
Thread safety: This method is thread safe.
|
explicit |
Test whether this pointer is non-null.
Returns true if this pointer is non-null, false if null.
Thread safety: This method is thread safe.