diff options
author | Daniel Wirtz <dcode@dcode.io> | 2020-09-17 12:58:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-17 12:58:21 +0200 |
commit | 2841eddaabc7a5e24517e043a1aab8adc6d5c1e4 (patch) | |
tree | 17f8ed3d71237c4860fc07f7ba9bdc4d9691b76b /src/ir/effects.h | |
parent | e1d74ef2acdd88f06b9e58f91f30bb56b9a26fe8 (diff) | |
download | binaryen-2841eddaabc7a5e24517e043a1aab8adc6d5c1e4.tar.gz binaryen-2841eddaabc7a5e24517e043a1aab8adc6d5c1e4.tar.bz2 binaryen-2841eddaabc7a5e24517e043a1aab8adc6d5c1e4.zip |
Refactor Host expression to MemorySize and MemoryGrow (#3137)
Aligns the internal representations of `memory.size` and `memory.grow` with other more recent memory instructions by removing the legacy `Host` expression class and adding separate expression classes for `MemorySize` and `MemoryGrow`. Simplifies related APIs, but is also a breaking API change.
Diffstat (limited to 'src/ir/effects.h')
-rw-r--r-- | src/ir/effects.h | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/ir/effects.h b/src/ir/effects.h index 9d6e90936..b973d7446 100644 --- a/src/ir/effects.h +++ b/src/ir/effects.h @@ -428,7 +428,8 @@ struct EffectAnalyzer implicitTrap = true; break; } - default: {} + default: { + } } } } @@ -446,17 +447,27 @@ struct EffectAnalyzer implicitTrap = true; break; } - default: {} + default: { + } } } } void visitSelect(Select* curr) {} void visitDrop(Drop* curr) {} void visitReturn(Return* curr) { branchesOut = true; } - void visitHost(Host* curr) { + void visitMemorySize(MemorySize* curr) { + // memory.size accesses the size of the memory, and thus can be modeled as + // reading memory + readsMemory = true; + // Atomics are sequentially consistent with memory.size. + isAtomic = true; + } + void visitMemoryGrow(MemoryGrow* curr) { calls = true; - // memory.grow modifies the set of valid addresses, and thus can be modeled - // as modifying memory + // memory.grow technically does a read-modify-write operation on the memory + // size in the successful case, modifying the set of valid addresses, and + // just a read operation in the failure case + readsMemory = true; writesMemory = true; // Atomics are also sequentially consistent with memory.grow. isAtomic = true; |