Skip to content

Commit 74f1fa1

Browse files
committed
Remove mixed atomic-non-atomic and 'read from initial value' support.
1 parent 409164b commit 74f1fa1

File tree

9 files changed

+4
-201
lines changed

9 files changed

+4
-201
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

@@ -214,9 +204,7 @@ void MiriGenMCShim::handleThreadKill(ThreadId thread_id) {
214204

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

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

@@ -236,13 +224,7 @@ void MiriGenMCShim::handleThreadKill(ThreadId thread_id) {
236224

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

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

248230
/**** Memory (de)allocation ****/

genmc-sys/src_cpp/MiriInterface.hpp

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

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

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/atomics/stack_alloc_atomic.rs

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

tests/genmc/pass/atomics/stack_alloc_atomic.stderr

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

0 commit comments

Comments
 (0)