-
Notifications
You must be signed in to change notification settings - Fork 793
Debug info handling for new EH try-catch #3496
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
Changes from 4 commits
84a34aa
4990843
af57d4e
a211268
c1cc754
3446714
4ffc993
40276eb
3cfaf96
a9d679d
8b11e5f
2797834
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 |
---|---|---|
|
@@ -915,8 +915,9 @@ void WasmBinaryWriter::writeDebugLocationEnd(Expression* curr, Function* func) { | |
} | ||
} | ||
|
||
void WasmBinaryWriter::writeExtraDebugLocation( | ||
Expression* curr, Function* func, BinaryLocations::DelimiterId id) { | ||
void WasmBinaryWriter::writeExtraDebugLocation(Expression* curr, | ||
Function* func, | ||
size_t id) { | ||
if (func && !func->expressionLocations.empty()) { | ||
binaryLocations.delimiters[curr][id] = o.size(); | ||
} | ||
|
@@ -2828,12 +2829,29 @@ BinaryConsts::ASTNodes WasmBinaryBuilder::readExpression(Expression*& curr) { | |
break; | ||
case BinaryConsts::Else: | ||
curr = nullptr; | ||
continueControlFlow(BinaryLocations::Else, startPos); | ||
if (DWARF && currFunction) { | ||
assert(!controlFlowStack.empty()); | ||
auto currControlFlow = controlFlowStack.back(); | ||
currFunction | ||
->delimiterLocations[currControlFlow][BinaryLocations::Else] = | ||
startPos - codeSectionLocation; | ||
} | ||
break; | ||
case BinaryConsts::Catch: | ||
case BinaryConsts::CatchAll: { | ||
curr = nullptr; | ||
continueControlFlow(BinaryLocations::Catch, startPos); | ||
if (DWARF && currFunction) { | ||
assert(!controlFlowStack.empty()); | ||
auto currControlFlow = controlFlowStack.back(); | ||
// The new catch is appended at the end of the list of debug delimiters | ||
// for this instruction. | ||
auto delimiterId = | ||
currFunction->delimiterLocations[currControlFlow].size(); | ||
currFunction->delimiterLocations[currControlFlow][delimiterId] = | ||
startPos - codeSectionLocation; | ||
} | ||
break; | ||
} | ||
case BinaryConsts::RefNull: | ||
visitRefNull((curr = allocator.alloc<RefNull>())->cast<RefNull>()); | ||
break; | ||
|
@@ -3062,18 +3080,6 @@ void WasmBinaryBuilder::startControlFlow(Expression* curr) { | |
} | ||
} | ||
|
||
void WasmBinaryBuilder::continueControlFlow(BinaryLocations::DelimiterId id, | ||
BinaryLocation pos) { | ||
if (DWARF && currFunction) { | ||
assert(!controlFlowStack.empty()); | ||
auto currControlFlow = controlFlowStack.back(); | ||
// We are called after parsing the byte, so we need to subtract one to | ||
// get its position. | ||
Comment on lines
-3110
to
-3111
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. This is old code, but what does this subtracting one mean? Where do we do 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. Oh, I think the comment about subtracting one was just stale. A refactoring I did must have removed it, and forgot to update the comment... |
||
currFunction->delimiterLocations[currControlFlow][id] = | ||
pos - codeSectionLocation; | ||
} | ||
} | ||
|
||
void WasmBinaryBuilder::pushBlockElements(Block* curr, | ||
Type type, | ||
size_t start) { | ||
|
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.
@aheejin actually this fails to compile, since the binary code for CatchAll is 5, the same as for Else, so it says we have a duplicate entry in the switch.
Is it correct that CatchAll has the same code as Else?
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 that's correct; we are doing that to reuse the opcode because
else
cannot occur with atry
.