diff options
Diffstat (limited to 'src/passes')
-rw-r--r-- | src/passes/Heap2Local.cpp | 4 | ||||
-rw-r--r-- | src/passes/Print.cpp | 38 |
2 files changed, 30 insertions, 12 deletions
diff --git a/src/passes/Heap2Local.cpp b/src/passes/Heap2Local.cpp index f2846671c..796e0fa05 100644 --- a/src/passes/Heap2Local.cpp +++ b/src/passes/Heap2Local.cpp @@ -402,7 +402,9 @@ struct Heap2LocalOptimizer { } // Drop the RTT (as it may have side effects; leave it to other passes). - contents.push_back(builder.makeDrop(allocation->rtt)); + if (allocation->rtt) { + contents.push_back(builder.makeDrop(allocation->rtt)); + } // Replace the allocation with a null reference. This changes the type // from non-nullable to nullable, but as we optimize away the code that // the allocation reaches, we will handle that. diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp index 6198218d8..6a41961a2 100644 --- a/src/passes/Print.cpp +++ b/src/passes/Print.cpp @@ -1985,15 +1985,18 @@ struct PrintExpressionContents } void visitStructNew(StructNew* curr) { - if (printUnreachableReplacement(curr->rtt)) { + if (printUnreachableReplacement(curr)) { return; } - printMedium(o, "struct.new_"); + printMedium(o, "struct.new"); if (curr->isWithDefault()) { - o << "default_"; + printMedium(o, "_default"); } - o << "with_rtt "; - TypeNamePrinter(o, wasm).print(curr->rtt->type.getHeapType()); + if (curr->rtt) { + printMedium(o, "_with_rtt"); + } + o << ' '; + TypeNamePrinter(o, wasm).print(curr->type.getHeapType()); } void printFieldName(HeapType type, Index index) { @@ -2035,16 +2038,29 @@ struct PrintExpressionContents printFieldName(heapType, curr->index); } void visitArrayNew(ArrayNew* curr) { - printMedium(o, "array.new_"); + if (printUnreachableReplacement(curr)) { + return; + } + printMedium(o, "array.new"); if (curr->isWithDefault()) { - o << "default_"; + printMedium(o, "_default"); + } + if (curr->rtt) { + printMedium(o, "_with_rtt"); } - o << "with_rtt "; - TypeNamePrinter(o, wasm).print(curr->rtt->type.getHeapType()); + o << ' '; + TypeNamePrinter(o, wasm).print(curr->type.getHeapType()); } void visitArrayInit(ArrayInit* curr) { - printMedium(o, "array.init "); - TypeNamePrinter(o, wasm).print(curr->rtt->type.getHeapType()); + if (printUnreachableReplacement(curr)) { + return; + } + printMedium(o, "array.init"); + if (!curr->rtt) { + printMedium(o, "_static"); + } + o << ' '; + TypeNamePrinter(o, wasm).print(curr->type.getHeapType()); } void visitArrayGet(ArrayGet* curr) { if (printUnreachableReplacement(curr->ref)) { |