Shrinking alloy memory interface so that alloy-sandbox doesn't need xe.

This commit is contained in:
Ben Vanik
2014-08-19 21:02:15 -07:00
parent 76d524b655
commit 48a0e5c601
23 changed files with 230 additions and 192 deletions

View File

@@ -61,4 +61,43 @@ uint64_t Memory::SearchAligned(uint64_t start, uint64_t end,
return 0;
}
SimpleMemory::SimpleMemory(size_t capacity) : memory_(capacity) {
membase_ = reinterpret_cast<uint8_t*>(memory_.data());
reserve_address_ = capacity - 8;
}
SimpleMemory::~SimpleMemory() = default;
uint8_t SimpleMemory::LoadI8(uint64_t address) {
return poly::load<uint8_t>(membase_ + address);
}
uint16_t SimpleMemory::LoadI16(uint64_t address) {
return poly::load<uint16_t>(membase_ + address);
}
uint32_t SimpleMemory::LoadI32(uint64_t address) {
return poly::load<uint32_t>(membase_ + address);
}
uint64_t SimpleMemory::LoadI64(uint64_t address) {
return poly::load<uint64_t>(membase_ + address);
}
void SimpleMemory::StoreI8(uint64_t address, uint8_t value) {
poly::store<uint8_t>(membase_ + address, value);
}
void SimpleMemory::StoreI16(uint64_t address, uint16_t value) {
poly::store<uint16_t>(membase_ + address, value);
}
void SimpleMemory::StoreI32(uint64_t address, uint32_t value) {
poly::store<uint32_t>(membase_ + address, value);
}
void SimpleMemory::StoreI64(uint64_t address, uint64_t value) {
poly::store<uint64_t>(membase_ + address, value);
}
} // namespace alloy