Skip to content

Commit b68e90d

Browse files
committed
Stack IR
1 parent 4994c67 commit b68e90d

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

src/wasm/wasm-stack.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2839,8 +2839,13 @@ void StackIRToBinaryWriter::write() {
28392839
WASM_UNREACHABLE("unexpected op");
28402840
}
28412841
}
2842+
// Indicate the debug location corresponding to the end opcode that
2843+
// terminates the function code.
28422844
if (func->epilogLocation.size()) {
28432845
parent.writeDebugLocation(*func->epilogLocation.begin());
2846+
} else {
2847+
// The end opcode has no debug location.
2848+
parent.writeNoDebugLocation();
28442849
}
28452850
writer.emitFunctionEnd();
28462851
}

test/lit/debug/source-map-smearing.wast

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
;; RUN: echo >> %t.wasm.map
33
;; RUN: cat %t.wasm.map | filecheck %s
44

5+
;; Also test with StackIR, which should have identical results.
6+
;;
7+
;; RUN: wasm-opt %s --generate-stack-ir -o %t.wasm -osm %t.map -g -q
8+
;; RUN: echo >> %t.wasm.map
9+
;; RUN: cat %t.wasm.map | filecheck %s
10+
511
;; Check that the debug locations do not smear beyond a function
612
;; epilogue to the next function. The encoded segment 'C' means that
713
;; the previous segment is indeed one-byte long.

test/lit/debug/source-map-stop.wast

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
;; RUN: wasm-opt %s -g -o %t.wasm -osm %t.wasm.map
44
;; RUN: wasm-opt %t.wasm -ism %t.wasm.map -S -o - | filecheck %s
55

6+
;; Also test with StackIR, which should have identical results.
7+
;;
8+
;; RUN: wasm-opt %s --generate-stack-ir -o %t.wasm -osm %t.map -g -q
9+
;; RUN: wasm-opt %t.wasm -ism %t.map -q -o - -S | filecheck %s
10+
611
;; Verify that writing to a source map and reading it back does not "smear"
712
;; debug info across adjacent instructions. The debug info in the output should
813
;; be identical to the input.

0 commit comments

Comments
 (0)