Skip to content

Commit e21bb7b

Browse files
Start changing interpreter code
1 parent 7d9c79e commit e21bb7b

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
@@ -4082,15 +4082,18 @@ class ModuleRunnerBase : public ExpressionRunner<SubType> {
40824082

40834083
Flow visitLoad(Load* curr) {
40844084
VISIT(flow, curr->ptr)
4085-
auto info = getMemoryInstanceInfo(curr->memory);
4086-
auto memorySizeBytes = info.instance->getMemorySizeBytes(info.name);
4087-
auto addr = info.instance->getFinalAddress(
4088-
curr, flow.getSingleValue(), memorySizeBytes);
4089-
if (curr->isAtomic()) {
4090-
info.instance->checkAtomicAddress(addr, curr->bytes, memorySizeBytes);
4091-
}
4092-
auto ret = info.interface()->load(curr, addr, info.name);
4093-
return ret;
4085+
auto* memory = allMemories[curr->memory];
4086+
return memory->load(static_cast<uint32_t>(flow.getSingleValue().geti32()));
4087+
// auto info = getMemoryInstanceInfo(curr->memory);
4088+
// auto memorySize = info.instance->getMemorySize(info.name);
4089+
// auto addr =
4090+
// info.instance->getFinalAddress(curr, flow.getSingleValue(),
4091+
// memorySize);
4092+
// if (curr->isAtomic()) {
4093+
// info.instance->checkAtomicAddress(addr, curr->bytes, memorySize);
4094+
// }
4095+
// auto ret = info.interface()->load(curr, addr, info.name);
4096+
// return ret;
40944097
}
40954098
Flow visitStore(Store* curr) {
40964099
VISIT(ptr, curr->ptr)

0 commit comments

Comments
 (0)