@@ -1920,7 +1920,7 @@ void WasmBinaryBuilder::readFunctions() {
1920
1920
// process body
1921
1921
assert (breakStack.empty ());
1922
1922
assert (breakTargetNames.empty ());
1923
- assert (delegateTargetNames .empty ());
1923
+ assert (exceptionTargetNames .empty ());
1924
1924
assert (breakStack.empty ());
1925
1925
assert (expressionStack.empty ());
1926
1926
assert (controlFlowStack.empty ());
@@ -1930,7 +1930,7 @@ void WasmBinaryBuilder::readFunctions() {
1930
1930
assert (depth == 0 );
1931
1931
assert (breakStack.empty ());
1932
1932
assert (breakTargetNames.empty ());
1933
- assert (delegateTargetNames .empty ());
1933
+ assert (exceptionTargetNames .empty ());
1934
1934
if (!expressionStack.empty ()) {
1935
1935
throwError (" stack not empty on function exit" );
1936
1936
}
@@ -3389,7 +3389,7 @@ Expression* WasmBinaryBuilder::getBlockOrSingleton(Type type) {
3389
3389
block->finalize (type);
3390
3390
// maybe we don't need a block here?
3391
3391
if (breakTargetNames.find (block->name ) == breakTargetNames.end () &&
3392
- delegateTargetNames .find (block->name ) == delegateTargetNames .end ()) {
3392
+ exceptionTargetNames .find (block->name ) == exceptionTargetNames .end ()) {
3393
3393
block->name = Name ();
3394
3394
if (block->list .size () == 1 ) {
3395
3395
return block->list [0 ];
@@ -3465,8 +3465,8 @@ WasmBinaryBuilder::getBreakTarget(int32_t offset) {
3465
3465
return ret;
3466
3466
}
3467
3467
3468
- Name WasmBinaryBuilder::getDelegateTargetName (int32_t offset) {
3469
- BYN_TRACE (" getDelegateTarget " << offset << std::endl);
3468
+ Name WasmBinaryBuilder::getExceptionTargetName (int32_t offset) {
3469
+ BYN_TRACE (" getExceptionTarget " << offset << std::endl);
3470
3470
// We always start parsing a function by creating a block label and pushing it
3471
3471
// in breakStack in getBlockOrSingleton, so if a 'delegate''s target is that
3472
3472
// block, it does not mean it targets that block; it throws to the caller.
@@ -3482,7 +3482,7 @@ Name WasmBinaryBuilder::getDelegateTargetName(int32_t offset) {
3482
3482
// if the delegate is in literally unreachable code, then we will not emit it
3483
3483
// anyhow, so do not note that the target has delegate to it
3484
3484
if (!willBeIgnored) {
3485
- delegateTargetNames .insert (ret.name );
3485
+ exceptionTargetNames .insert (ret.name );
3486
3486
}
3487
3487
return ret.name ;
3488
3488
}
@@ -5832,7 +5832,7 @@ void WasmBinaryBuilder::visitTryOrTryInBlock(Expression*& out) {
5832
5832
breakStack.pop_back ();
5833
5833
5834
5834
if (lastSeparator == BinaryConsts::Delegate) {
5835
- curr->delegateTarget = getDelegateTargetName (getU32LEB ());
5835
+ curr->delegateTarget = getExceptionTargetName (getU32LEB ());
5836
5836
}
5837
5837
5838
5838
// For simplicity, we make try's labels only can be targeted by delegates, and
@@ -5843,21 +5843,22 @@ void WasmBinaryBuilder::visitTryOrTryInBlock(Expression*& out) {
5843
5843
curr->name = getNextLabel ();
5844
5844
if (auto * block = curr->body ->dynCast <Block>()) {
5845
5845
if (block->name .is ()) {
5846
- if (delegateTargetNames.find (block->name ) != delegateTargetNames.end ()) {
5847
- BranchUtils::replaceDelegateTargets (block, block->name , curr->name );
5848
- delegateTargetNames.erase (block->name );
5846
+ if (exceptionTargetNames.find (block->name ) !=
5847
+ exceptionTargetNames.end ()) {
5848
+ BranchUtils::replaceExceptionTargets (block, block->name , curr->name );
5849
+ exceptionTargetNames.erase (block->name );
5849
5850
}
5850
5851
// maybe we don't need a block here?
5851
5852
if (block->list .size () == 1 ) {
5852
5853
curr->body = block->list [0 ];
5853
5854
}
5854
5855
}
5855
5856
}
5856
- if (delegateTargetNames .find (catchLabel) != delegateTargetNames .end ()) {
5857
+ if (exceptionTargetNames .find (catchLabel) != exceptionTargetNames .end ()) {
5857
5858
for (auto * catchBody : curr->catchBodies ) {
5858
- BranchUtils::replaceDelegateTargets (catchBody, catchLabel, curr->name );
5859
+ BranchUtils::replaceExceptionTargets (catchBody, catchLabel, curr->name );
5859
5860
}
5860
- delegateTargetNames .erase (catchLabel);
5861
+ exceptionTargetNames .erase (catchLabel);
5861
5862
}
5862
5863
curr->finalize (curr->type );
5863
5864
0 commit comments