Add a hook to the wasm FuncEnvironment for emitting loop headers.

This will allow wasm implementations that wish to insert code into
every loop, for example to insert an interrupt check or a safepoint.
do so without relying on asynchronous signals.
This commit is contained in:
Dan Gohman
2018-03-18 13:47:17 -07:00
parent 492fa1283c
commit d99b43e4b7
2 changed files with 9 additions and 0 deletions

View File

@@ -137,6 +137,7 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
builder.ins().jump(loop_body, &[]);
state.push_loop(loop_body, next, num_return_values(ty));
builder.switch_to_block(loop_body);
environ.translate_loop_header(builder.cursor());
}
Operator::If { ty } => {
let val = state.pop1();