Skip to content

Commit 28cdaf5

Browse files
committed
Remove mixed atomic-non-atomic and 'read from initial value' support.
1 parent ee5423f commit 28cdaf5

File tree

9 files changed

+4
-202
lines changed

9 files changed

+4
-202
lines changed

genmc-sys/src_cpp/MiriInterface.cpp

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -105,18 +105,8 @@ auto MiriGenMCShim::createHandle(const GenmcParams &config)
105105
auto *driverPtr = driver.get();
106106
auto initValGetter = [driverPtr](const AAccess &access)
107107
{
108-
const auto addr = access.getAddr();
109-
if (!driverPtr->initVals_.contains(addr))
110-
{
111-
return SVal(0xCC00CC00);
112-
// BUG_ON(!driverPtr->initVals_.contains(addr));
113-
}
114-
auto result = driverPtr->initVals_[addr];
115-
if (!result.is_init)
116-
{
117-
return SVal(0xFF00FF00);
118-
}
119-
return result.toSVal();
108+
// FIXME(genmc): Add proper support for initial values.
109+
return SVal(0xff);
120110
};
121111
driver->getExec().getGraph().setInitValGetter(initValGetter);
122112

@@ -209,9 +199,7 @@ void MiriGenMCShim::handleThreadFinish(ThreadId thread_id, uint64_t ret_val)
209199

210200
auto newLab = std::make_unique<ReadLabel>(pos, ord, loc, aSize, type);
211201

212-
auto oldValSetter = [this, old_val](SAddr loc)
213-
{ this->handleOldVal(loc, old_val); };
214-
auto result = GenMCDriver::handleLoad(std::move(newLab), oldValSetter);
202+
auto result = GenMCDriver::handleLoad(std::move(newLab));
215203
return result;
216204
}
217205

@@ -230,13 +218,7 @@ void MiriGenMCShim::handleThreadFinish(ThreadId thread_id, uint64_t ret_val)
230218

231219
std::unique_ptr<WriteLabel> wLab = std::make_unique<WriteLabel>(pos, ord, loc, aSize, type, val);
232220

233-
auto oldValSetter = [this, old_val](SAddr loc)
234-
{
235-
this->handleOldVal(loc,
236-
old_val); // TODO GENMC(HACK): is this the correct way to do it?
237-
};
238-
239-
return GenMCDriver::handleStore(std::move(wLab), oldValSetter);
221+
return GenMCDriver::handleStore(std::move(wLab));
240222
}
241223

242224
/**** Memory (de)allocation ****/

genmc-sys/src_cpp/MiriInterface.hpp

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -105,42 +105,6 @@ struct MiriGenMCShim : private GenMCDriver
105105
static std::unique_ptr<MiriGenMCShim> createHandle(const GenmcParams &config);
106106

107107
private:
108-
/**
109-
* @brief Try to insert the initial value of a memory location.
110-
* @param addr
111-
* @param value
112-
* */
113-
void handleOldVal(const SAddr addr, GenmcScalar value)
114-
{
115-
// TODO GENMC(CLEANUP): Pass this as a parameter:
116-
auto &g = getExec().getGraph();
117-
auto *coLab = g.co_max(addr);
118-
if (auto *wLab = llvm::dyn_cast<WriteLabel>(coLab))
119-
{
120-
if (value.is_init && wLab->isNotAtomic())
121-
wLab->setVal(value.toSVal());
122-
}
123-
else if (const auto *wLab = llvm::dyn_cast<InitLabel>(coLab))
124-
{
125-
if (value.is_init)
126-
{
127-
auto result = initVals_.insert(std::make_pair(addr, value));
128-
BUG_ON(result.second &&
129-
(*result.first).second !=
130-
value); /* Attempt to replace initial value */
131-
}
132-
}
133-
else
134-
{
135-
BUG(); /* Invalid label */
136-
}
137-
// either initLabel ==> update initValGetter
138-
// or WriteLabel ==> Update its value in place (only if non-atomic)
139-
}
140-
141-
// TODO GENMC(mixed-size accesses):
142-
std::unordered_map<SAddr, GenmcScalar> initVals_{};
143-
144108
std::vector<Action> globalInstructions;
145109
};
146110

tests/genmc/fail/simple/mixed-atomic-non-atomic/read_global_init.rs

Lines changed: 0 additions & 20 deletions
This file was deleted.

tests/genmc/fail/simple/mixed-atomic-non-atomic/read_global_init.stderr

Lines changed: 0 additions & 15 deletions
This file was deleted.

tests/genmc/fail/simple/mixed-atomic-non-atomic/wna_wrlx_rrlx.return1234.stderr

Lines changed: 0 additions & 15 deletions
This file was deleted.

tests/genmc/fail/simple/mixed-atomic-non-atomic/wna_wrlx_rrlx.return42.stderr

Lines changed: 0 additions & 15 deletions
This file was deleted.

tests/genmc/fail/simple/mixed-atomic-non-atomic/wna_wrlx_rrlx.rs

Lines changed: 0 additions & 58 deletions
This file was deleted.

tests/genmc/pass/simple/stack_alloc_atomic.rs

Lines changed: 0 additions & 18 deletions
This file was deleted.

tests/genmc/pass/simple/stack_alloc_atomic.stderr

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)