Skip to content

Adjust label printing for blocks in folded form - #1609

Merged
binji merged 1 commit into
WebAssembly:masterfrom
takikawa:fix-labels-folded
Feb 24, 2021
Merged

binji merged 1 commit into
WebAssembly:masterfrom
takikawa:fix-labels-folded

Conversation

@takikawa

Copy link
Copy Markdown
Contributor

This PR makes label printing for blocks in folded form more consistent with non-folded forms.

For example, given the following input wat file:

(module
  (func
    block
      br 0
    end
    block
      br 0
    end))

If you do a roundtrip with wat2wasm and wasm2wat currently, you get different labels depending on if you supplied --fold-exprs or not:

Non-folded:

(module
  (type (;0;) (func))
  (func (;0;) (type 0)
    block  ;; label = @1
      br 0 (;@1;)
    end
    block  ;; label = @1
      br 0 (;@1;)
    end))

Folded:

(module
  (type (;0;) (func))
  (func (;0;) (type 0)
    (block  ;; label = @1
      (br 0 (;@1;)))
    (block  ;; label = @2    <<---- this is different
      (br 0 (;@2;)))))

This PR should make both use the same label depths.

This makes labels consistent with non-folded printing when
multiple blocks are in function or block body.
@binji
binji merged commit 2b9d936 into WebAssembly:master Feb 24, 2021
takikawa added a commit to takikawa/wabt that referenced this pull request Jun 12, 2021
This is similar to a previous bug (WebAssembly#1609) for other kinds
of block labels.
takikawa added a commit to takikawa/wabt that referenced this pull request Jun 29, 2021
This is similar to a previous bug (WebAssembly#1609) for other kinds
of block labels.
takikawa added a commit to takikawa/wabt that referenced this pull request Jun 29, 2021
This is similar to a previous bug (WebAssembly#1609) for other kinds
of block labels.
aheejin pushed a commit that referenced this pull request Jun 29, 2021
This is similar to a previous bug (#1609) for other kinds of block labels.

The tests check that 2+ adjacent try-delegate blocks will have labels that print correctly.

(split from #1675)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants