-
Notifications
You must be signed in to change notification settings - Fork 745
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Parser] Support prologue and epilogue sourcemap annotations #6370
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
;; RUN: wasm-opt %s -o %t.wasm -osm %t.map -g -q | ||
;; RUN: wasm-opt %t.wasm -ism %t.map -q -o - -S | filecheck %s | ||
|
||
;; RUN: wasm-opt %s --new-wat-parser -S -o - | filecheck %s | ||
|
||
(module | ||
;;@ src.cpp:0:1 | ||
(func $foo (param $x i32) (param $y i32) | ||
;;@ src.cpp:10:1 | ||
(if | ||
|
@@ -12,8 +15,11 @@ | |
;;@ src.cpp:40:1 | ||
(local.get $y) | ||
) | ||
;; For the legacy parser | ||
;;@ src.cpp:50:1 | ||
(then | ||
;; For the new parser | ||
;;@ src.cpp:50:1 | ||
(return) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like the old parser doesn't roundtrip this properly and the new one does, is that correct? Perhaps add a comment to clarify that so it's obvious why we have these two 50:1 annotations? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They can both round-trip properly, but the old one only if the annotation is on the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it hard to match the old behavior? This doesn't seem like a dangerous breaking change to me, as our text format in general is not entirely standard nor stable, but we should document it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There would be some very ad-hoc plumbing required to carry the annotation from the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds ok to me. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you have a suggestion about where to document it? The changelog might make sense, but more so if we were actually enabling the new parser at the same time. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, the changelog. I agree it makes more sense when we enable the new parser. Maybe we can put a note in the changelog up above the current release notes, in preparation for enabling the new parser, to remind us, or something like that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
) | ||
) | ||
|
@@ -24,10 +30,12 @@ | |
;;@ src.cpp:80:1 | ||
(local.get $y) | ||
) | ||
;;@ src.cpp:90:1 | ||
) | ||
) | ||
|
||
;; CHECK: (func $foo (param $x i32) (param $y i32) | ||
;; CHECK: ;;@ src.cpp:0:1 | ||
;; CHECK-NEXT: (func $foo (param $x i32) (param $y i32) | ||
;; CHECK-NEXT: ;;@ src.cpp:10:1 | ||
;; CHECK-NEXT: (if | ||
;; CHECK-NEXT: ;;@ src.cpp:20:1 | ||
|
@@ -49,3 +57,5 @@ | |
;; CHECK-NEXT: ;;@ src.cpp:80:1 | ||
;; CHECK-NEXT: (local.get $y) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: ;;@ src.cpp:90:1 | ||
;; CHECK-NEXT: ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just moved code, but I a question: can there be more than one
srcAnnotationKind
? (seems like if so then the last wins?)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes and yes. Is there some other existing behavior I should try to match instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't think of one, so lgtm.