forked from OSchip/llvm-project
Change 'StoreRef' back to 'Store' in GRState, shrinking the size of GRState back by one pointer.
llvm-svn: 126020
This commit is contained in:
parent
e9fb6b891e
commit
ff6fd0f4b0
|
@ -83,7 +83,7 @@ private:
|
||||||
|
|
||||||
GRStateManager *stateMgr;
|
GRStateManager *stateMgr;
|
||||||
Environment Env; // Maps a Stmt to its current SVal.
|
Environment Env; // Maps a Stmt to its current SVal.
|
||||||
StoreRef St; // Maps a location to its current value.
|
Store store; // Maps a location to its current value.
|
||||||
GenericDataMap GDM; // Custom data stored by a client of this class.
|
GenericDataMap GDM; // Custom data stored by a client of this class.
|
||||||
unsigned refCount;
|
unsigned refCount;
|
||||||
|
|
||||||
|
@ -91,26 +91,19 @@ private:
|
||||||
/// state with the exception of using the specified Store.
|
/// state with the exception of using the specified Store.
|
||||||
const GRState *makeWithStore(const StoreRef &store) const;
|
const GRState *makeWithStore(const StoreRef &store) const;
|
||||||
|
|
||||||
|
void setStore(const StoreRef &storeRef);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/// This ctor is used when creating the first GRState object.
|
/// This ctor is used when creating the first GRState object.
|
||||||
GRState(GRStateManager *mgr, const Environment& env,
|
GRState(GRStateManager *mgr, const Environment& env,
|
||||||
StoreRef st, GenericDataMap gdm)
|
StoreRef st, GenericDataMap gdm);
|
||||||
: stateMgr(mgr),
|
|
||||||
Env(env),
|
|
||||||
St(st),
|
|
||||||
GDM(gdm),
|
|
||||||
refCount(0) {}
|
|
||||||
|
|
||||||
/// Copy ctor - We must explicitly define this or else the "Next" ptr
|
/// Copy ctor - We must explicitly define this or else the "Next" ptr
|
||||||
/// in FoldingSetNode will also get copied.
|
/// in FoldingSetNode will also get copied.
|
||||||
GRState(const GRState& RHS)
|
GRState(const GRState& RHS);
|
||||||
: llvm::FoldingSetNode(),
|
|
||||||
stateMgr(RHS.stateMgr),
|
~GRState();
|
||||||
Env(RHS.Env),
|
|
||||||
St(RHS.St),
|
|
||||||
GDM(RHS.GDM),
|
|
||||||
refCount(0) {}
|
|
||||||
|
|
||||||
/// Return the GRStateManager associated with this state.
|
/// Return the GRStateManager associated with this state.
|
||||||
GRStateManager &getStateManager() const { return *stateMgr; }
|
GRStateManager &getStateManager() const { return *stateMgr; }
|
||||||
|
@ -122,13 +115,10 @@ public:
|
||||||
/// The environment is the mapping from expressions to values.
|
/// The environment is the mapping from expressions to values.
|
||||||
const Environment& getEnvironment() const { return Env; }
|
const Environment& getEnvironment() const { return Env; }
|
||||||
|
|
||||||
|
/// Return the store associated with this state. The store
|
||||||
/// getStore - Return the store associated with this state. The store
|
|
||||||
/// is a mapping from locations to values.
|
/// is a mapping from locations to values.
|
||||||
Store getStore() const { return St.getStore(); }
|
Store getStore() const { return store; }
|
||||||
#if 0
|
|
||||||
void setStore(Store s) { St = s; }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/// getGDM - Return the generic data map associated with this state.
|
/// getGDM - Return the generic data map associated with this state.
|
||||||
GenericDataMap getGDM() const { return GDM; }
|
GenericDataMap getGDM() const { return GDM; }
|
||||||
|
@ -140,7 +130,7 @@ public:
|
||||||
/// have the same Environment, Store, and GenericDataMap.
|
/// have the same Environment, Store, and GenericDataMap.
|
||||||
static void Profile(llvm::FoldingSetNodeID& ID, const GRState* V) {
|
static void Profile(llvm::FoldingSetNodeID& ID, const GRState* V) {
|
||||||
V->Env.Profile(ID);
|
V->Env.Profile(ID);
|
||||||
ID.AddPointer(V->St.getStore());
|
ID.AddPointer(V->store);
|
||||||
V->GDM.Profile(ID);
|
V->GDM.Profile(ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ void ExplodedGraph::reclaimRecentlyAllocatedNodes() {
|
||||||
// Conditions 5, 6, and 7.
|
// Conditions 5, 6, and 7.
|
||||||
const GRState *state = node->getState();
|
const GRState *state = node->getState();
|
||||||
const GRState *pred_state = pred->getState();
|
const GRState *pred_state = pred->getState();
|
||||||
if (state->St != pred_state->St || state->GDM != pred_state->GDM ||
|
if (state->store != pred_state->store || state->GDM != pred_state->GDM ||
|
||||||
progPoint.getLocationContext() != pred->getLocationContext())
|
progPoint.getLocationContext() != pred->getLocationContext())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,31 @@ using namespace ento;
|
||||||
// FIXME: Move this elsewhere.
|
// FIXME: Move this elsewhere.
|
||||||
ConstraintManager::~ConstraintManager() {}
|
ConstraintManager::~ConstraintManager() {}
|
||||||
|
|
||||||
|
GRState::GRState(GRStateManager *mgr, const Environment& env,
|
||||||
|
StoreRef st, GenericDataMap gdm)
|
||||||
|
: stateMgr(mgr),
|
||||||
|
Env(env),
|
||||||
|
store(st.getStore()),
|
||||||
|
GDM(gdm),
|
||||||
|
refCount(0) {
|
||||||
|
stateMgr->getStoreManager().incrementReferenceCount(store);
|
||||||
|
}
|
||||||
|
|
||||||
|
GRState::GRState(const GRState& RHS)
|
||||||
|
: llvm::FoldingSetNode(),
|
||||||
|
stateMgr(RHS.stateMgr),
|
||||||
|
Env(RHS.Env),
|
||||||
|
store(RHS.store),
|
||||||
|
GDM(RHS.GDM),
|
||||||
|
refCount(0) {
|
||||||
|
stateMgr->getStoreManager().incrementReferenceCount(store);
|
||||||
|
}
|
||||||
|
|
||||||
|
GRState::~GRState() {
|
||||||
|
if (store)
|
||||||
|
stateMgr->getStoreManager().decrementReferenceCount(store);
|
||||||
|
}
|
||||||
|
|
||||||
GRStateManager::~GRStateManager() {
|
GRStateManager::~GRStateManager() {
|
||||||
for (std::vector<GRState::Printer*>::iterator I=Printers.begin(),
|
for (std::vector<GRState::Printer*>::iterator I=Printers.begin(),
|
||||||
E=Printers.end(); I!=E; ++I)
|
E=Printers.end(); I!=E; ++I)
|
||||||
|
@ -53,8 +78,8 @@ GRStateManager::removeDeadBindings(const GRState* state,
|
||||||
state, RegionRoots);
|
state, RegionRoots);
|
||||||
|
|
||||||
// Clean up the store.
|
// Clean up the store.
|
||||||
NewState.St = StoreMgr->removeDeadBindings(NewState.getStore(), LCtx,
|
NewState.setStore(StoreMgr->removeDeadBindings(NewState.getStore(), LCtx,
|
||||||
SymReaper, RegionRoots);
|
SymReaper, RegionRoots));
|
||||||
state = getPersistentState(NewState);
|
state = getPersistentState(NewState);
|
||||||
return ConstraintMgr->removeDeadBindings(state, SymReaper);
|
return ConstraintMgr->removeDeadBindings(state, SymReaper);
|
||||||
}
|
}
|
||||||
|
@ -323,10 +348,19 @@ const GRState* GRStateManager::getPersistentState(GRState& State) {
|
||||||
|
|
||||||
const GRState* GRState::makeWithStore(const StoreRef &store) const {
|
const GRState* GRState::makeWithStore(const StoreRef &store) const {
|
||||||
GRState NewSt = *this;
|
GRState NewSt = *this;
|
||||||
NewSt.St = store;
|
NewSt.setStore(store);
|
||||||
return getStateManager().getPersistentState(NewSt);
|
return getStateManager().getPersistentState(NewSt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GRState::setStore(const StoreRef &newStore) {
|
||||||
|
Store newStoreStore = newStore.getStore();
|
||||||
|
if (newStoreStore)
|
||||||
|
stateMgr->getStoreManager().incrementReferenceCount(newStoreStore);
|
||||||
|
if (store)
|
||||||
|
stateMgr->getStoreManager().decrementReferenceCount(store);
|
||||||
|
store = newStoreStore;
|
||||||
|
}
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// State pretty-printing.
|
// State pretty-printing.
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
Loading…
Reference in New Issue