Skip to content

Commit ee5c475

Browse files
committed
internal/stackcheck: improve checking jumps
For jumps, a special warning is now emitted when the stack does not match the expected stack on the jump destination. Jumps going from inside a macro to outside are now also verified. This change also makes the stack validation more strict about the documented stack depth. The analysis previously allowed comments to elide items and bring them back later, but this lead to the confusing situation where a documented stack of `[]` would not check anything. When `[]` is written, it is a statement from the user that all tracked items have been consumed. The analysis model has now changed and no longer allows eliding items. For explicit elision, a wildcard can be used.
1 parent 48726ef commit ee5c475

File tree

9 files changed

+553
-274
lines changed

9 files changed

+553
-274
lines changed

asm/testdata/compiler-tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ include-macro-private:
686686
#define %im(x) {
687687
push em(5) ; [x]
688688
push 3 ; [y, x]
689-
sub ; []
689+
sub ; [x-y]
690690
}
691691
%im(5)
692692
output:

0 commit comments

Comments
 (0)