Add optional cpu state to Variable.
- Used to preserve the CPU state for variables representing return values, since they may potentially be retrieved from registers, and these might be overwritten later in the same statement.
This commit is contained in:
@@ -6,22 +6,26 @@
|
|||||||
|
|
||||||
#include "Variable.h"
|
#include "Variable.h"
|
||||||
|
|
||||||
|
#include "CpuState.h"
|
||||||
#include "ObjectID.h"
|
#include "ObjectID.h"
|
||||||
#include "Type.h"
|
#include "Type.h"
|
||||||
#include "ValueLocation.h"
|
#include "ValueLocation.h"
|
||||||
|
|
||||||
|
|
||||||
Variable::Variable(ObjectID* id, const BString& name, Type* type,
|
Variable::Variable(ObjectID* id, const BString& name, Type* type,
|
||||||
ValueLocation* location)
|
ValueLocation* location, CpuState* state)
|
||||||
:
|
:
|
||||||
fID(id),
|
fID(id),
|
||||||
fName(name),
|
fName(name),
|
||||||
fType(type),
|
fType(type),
|
||||||
fLocation(location)
|
fLocation(location),
|
||||||
|
fCpuState(state)
|
||||||
{
|
{
|
||||||
fID->AcquireReference();
|
fID->AcquireReference();
|
||||||
fType->AcquireReference();
|
fType->AcquireReference();
|
||||||
fLocation->AcquireReference();
|
fLocation->AcquireReference();
|
||||||
|
if (fCpuState != NULL)
|
||||||
|
fCpuState->AcquireReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -30,4 +34,6 @@ Variable::~Variable()
|
|||||||
fID->ReleaseReference();
|
fID->ReleaseReference();
|
||||||
fType->ReleaseReference();
|
fType->ReleaseReference();
|
||||||
fLocation->ReleaseReference();
|
fLocation->ReleaseReference();
|
||||||
|
if (fCpuState != NULL)
|
||||||
|
fCpuState->ReleaseReference();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
#include <Referenceable.h>
|
#include <Referenceable.h>
|
||||||
|
|
||||||
|
|
||||||
|
class CpuState;
|
||||||
class ObjectID;
|
class ObjectID;
|
||||||
class Type;
|
class Type;
|
||||||
class ValueLocation;
|
class ValueLocation;
|
||||||
@@ -19,19 +20,22 @@ class ValueLocation;
|
|||||||
class Variable : public BReferenceable {
|
class Variable : public BReferenceable {
|
||||||
public:
|
public:
|
||||||
Variable(ObjectID* id, const BString& name,
|
Variable(ObjectID* id, const BString& name,
|
||||||
Type* type, ValueLocation* location);
|
Type* type, ValueLocation* location,
|
||||||
|
CpuState* state = NULL);
|
||||||
~Variable();
|
~Variable();
|
||||||
|
|
||||||
ObjectID* ID() const { return fID; }
|
ObjectID* ID() const { return fID; }
|
||||||
const BString& Name() const { return fName; }
|
const BString& Name() const { return fName; }
|
||||||
Type* GetType() const { return fType; }
|
Type* GetType() const { return fType; }
|
||||||
ValueLocation* Location() const { return fLocation; }
|
ValueLocation* Location() const { return fLocation; }
|
||||||
|
CpuState* GetCpuState() const { return fCpuState; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ObjectID* fID;
|
ObjectID* fID;
|
||||||
BString fName;
|
BString fName;
|
||||||
Type* fType;
|
Type* fType;
|
||||||
ValueLocation* fLocation;
|
ValueLocation* fLocation;
|
||||||
|
CpuState* fCpuState;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user