170
170
// calls, so that you know when to start an asynchronous operation and
171
171
// when to propagate results back.
172
172
//
173
- // * asyncify_get_catch_counter(): call this to get the current value of the
174
- // internal "__asyncify_catch_counter" variable (only when assertions
175
- // or ignore mode are enabled).
176
- //
177
173
// These four functions are exported so that you can call them from the
178
174
// outside. If you want to manage things from inside the wasm, then you
179
175
// couldn't have called them before they were created by this pass. To work
251
247
//
252
248
// --pass-arg=asyncify-ignore-unwind-from-catch
253
249
//
254
- // This enables extra check before unwind, if it called from within catch
255
- // block then it silently ignored (-fwasm-exceptions support)
250
+ // This enables additional check to be performed before unwinding. In
251
+ // cases where the unwind operation is triggered from the catch block,
252
+ // it will be silently ignored (-fwasm-exceptions support)
256
253
//
257
254
// --pass-arg=asyncify-verbose
258
255
//
@@ -1154,15 +1151,17 @@ struct AsyncifyFlow : public Pass {
1154
1151
} else if (doesCall (curr)) {
1155
1152
results.push_back (makeCallSupport (curr));
1156
1153
continue ;
1157
- } else if (auto * iTry = curr->dynCast <Try>()) {
1154
+ } else if (auto * try_ = curr->dynCast <Try>()) {
1158
1155
if (item.phase == Work::Scan) {
1159
1156
work.push_back (Work{curr, Work::Finish});
1160
- work.push_back (Work{iTry->body , Work::Scan});
1157
+ work.push_back (Work{try_->body , Work::Scan});
1158
+ // catchBodies are ignored because we assume that pause/resume will
1159
+ // not happen inside them
1161
1160
continue ;
1162
1161
}
1163
- iTry ->body = results.back ();
1162
+ try_ ->body = results.back ();
1164
1163
results.pop_back ();
1165
- results.push_back (iTry );
1164
+ results.push_back (try_ );
1166
1165
continue ;
1167
1166
}
1168
1167
// We must handle all control flow above, and all things that can change
@@ -1244,7 +1243,7 @@ struct AsyncifyFlow : public Pass {
1244
1243
}
1245
1244
};
1246
1245
1247
- // Add catch block counters to verify that unwind is not called from catch block
1246
+ // Add catch block counters to verify that unwind is not called from catch block.
1248
1247
struct AsyncifyAddCatchCounters : public Pass {
1249
1248
bool isFunctionParallel () override { return true ; }
1250
1249
@@ -1269,7 +1268,7 @@ struct AsyncifyAddCatchCounters : public Pass {
1269
1268
makeBinary (SubInt32,
1270
1269
makeGlobalGet (ASYNCIFY_CATCH_COUNTER, Type::i32),
1271
1270
makeConst (int32_t (amount))));
1272
- };
1271
+ }
1273
1272
};
1274
1273
CountersBuilder builder (*module_);
1275
1274
BranchUtils::BranchTargets branchTargets (func->body );
0 commit comments