Skip to content

Commit 1c67da4

Browse files
Start changing interpreter code
1 parent a0f2b9c commit 1c67da4

2 files changed

Lines changed: 15 additions & 10 deletions

File tree

src/ir/runtime-memory.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ class RuntimeMemory {
3030

3131
// variants for load8 etc?
3232
// Do we care about the order here?
33-
virtual Literal load(Address addr) const { return {}; }
33+
// todo: address types? Address::address32_t is strange
34+
virtual Literal load(uint32_t addr) const { return {}; }
35+
virtual Literal load(uint64_t addr) const { return {}; }
3436

3537
const Memory* getDefinition() const { return &memoryDefinition; }
3638

src/wasm-interpreter.h

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4107,15 +4107,18 @@ class ModuleRunnerBase : public ExpressionRunner<SubType> {
41074107

41084108
Flow visitLoad(Load* curr) {
41094109
VISIT(flow, curr->ptr)
4110-
auto info = getMemoryInstanceInfo(curr->memory);
4111-
auto memorySizeBytes = info.instance->getMemorySizeBytes(info.name);
4112-
auto addr = info.instance->getFinalAddress(
4113-
curr, flow.getSingleValue(), memorySizeBytes);
4114-
if (curr->isAtomic()) {
4115-
info.instance->checkAtomicAddress(addr, curr->bytes, memorySizeBytes);
4116-
}
4117-
auto ret = info.interface()->load(curr, addr, info.name);
4118-
return ret;
4110+
auto* memory = allMemories[curr->memory];
4111+
return memory->load(static_cast<uint32_t>(flow.getSingleValue().geti32()));
4112+
// auto info = getMemoryInstanceInfo(curr->memory);
4113+
// auto memorySize = info.instance->getMemorySize(info.name);
4114+
// auto addr =
4115+
// info.instance->getFinalAddress(curr, flow.getSingleValue(),
4116+
// memorySize);
4117+
// if (curr->isAtomic()) {
4118+
// info.instance->checkAtomicAddress(addr, curr->bytes, memorySize);
4119+
// }
4120+
// auto ret = info.interface()->load(curr, addr, info.name);
4121+
// return ret;
41194122
}
41204123
Flow visitStore(Store* curr) {
41214124
VISIT(ptr, curr->ptr)

0 commit comments

Comments
 (0)