Run-time memory bound checking.

This commit is contained in:
losfair
2019-03-19 21:27:49 +08:00
parent a006a368c5
commit 14da8abc23
2 changed files with 198 additions and 36 deletions

View File

@ -239,8 +239,8 @@ impl MemoryDescriptor {
pub fn memory_type(self) -> MemoryType {
match (self.maximum.is_some(), self.shared) {
(true, true) => MemoryType::SharedStatic,
(true, false) | (false, false) => MemoryType::Static,
//(false, false) => MemoryType::Dynamic,
(true, false) => MemoryType::Static,
(false, false) => MemoryType::Dynamic,
(false, true) => panic!("shared memory without a max is not allowed"),
}
}