Skip to content

Commit 9a96626

Browse files
committed
Remove mixed atomic-non-atomic and 'read from initial value' support.
1 parent 15fd885 commit 9a96626

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
@@ -106,18 +106,8 @@ auto MiriGenMCShim::createHandle(const GenmcParams &config)
106106
auto *driverPtr = driver.get();
107107
auto initValGetter = [driverPtr](const AAccess &access)
108108
{
109-
const auto addr = access.getAddr();
110-
if (!driverPtr->initVals_.contains(addr))
111-
{
112-
return SVal(0xCC00CC00);
113-
// BUG_ON(!driverPtr->initVals_.contains(addr));
114-
}
115-
auto result = driverPtr->initVals_[addr];
116-
if (!result.is_init)
117-
{
118-
return SVal(0xFF00FF00);
119-
}
120-
return result.toSVal();
109+
// FIXME(genmc): Add proper support for initial values.
110+
return SVal(0xff);
121111
};
122112
driver->getExec().getGraph().setInitValGetter(initValGetter);
123113

@@ -213,9 +203,7 @@ void MiriGenMCShim::handleThreadFinish(ThreadId thread_id, uint64_t ret_val)
213203

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

216-
auto oldValSetter = [this, old_val](SAddr loc)
217-
{ this->handleOldVal(loc, old_val); };
218-
auto result = GenMCDriver::handleLoad(std::move(newLab), oldValSetter);
206+
auto result = GenMCDriver::handleLoad(std::move(newLab));
219207
return result;
220208
}
221209

@@ -234,13 +222,7 @@ void MiriGenMCShim::handleThreadFinish(ThreadId thread_id, uint64_t ret_val)
234222

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

237-
auto oldValSetter = [this, old_val](SAddr loc)
238-
{
239-
this->handleOldVal(loc,
240-
old_val); // TODO GENMC(HACK): is this the correct way to do it?
241-
};
242-
243-
return GenMCDriver::handleStore(std::move(wLab), oldValSetter);
225+
return GenMCDriver::handleStore(std::move(wLab));
244226
}
245227

246228
/**** 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)