File tree Expand file tree Collapse file tree 3 files changed +12
-4
lines changed
Expand file tree Collapse file tree 3 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -28,12 +28,20 @@ struct MemoryPacking : public Pass {
2828 bool modifiesBinaryenIR () override { return false ; }
2929
3030 void run (PassRunner* runner, Module* module ) override {
31- // Conservatively refuse to change segments if bulk memory is enabled to
32- // avoid invalidating segment indices or segment contents referenced from
31+ if (!module ->memory .exists ) {
32+ return ;
33+ }
34+
35+ // Conservatively refuse to change segments if any are passive to avoid
36+ // invalidating segment indices or segment contents referenced from
3337 // memory.init instructions.
3438 // TODO: optimize in the presence of memory.init instructions
35- if (!module ->memory .exists || module ->features .hasBulkMemory ()) {
36- return ;
39+ if (module ->features .hasBulkMemory ()) {
40+ for (auto segment : module ->memory .segments ) {
41+ if (segment.isPassive ) {
42+ return ;
43+ }
44+ }
3745 }
3846
3947 std::vector<Memory::Segment> packed;
File renamed without changes.
File renamed without changes.
You can’t perform that action at this time.
0 commit comments