cranelift: add a new resumable_trapnz instruction;
This is useful to have to allow resumable_trap to happen in loop headers, for instance. This is the correct way to implement interrupt checks in Spidermonkey, which are effectively resumable traps. Previous implementation was using traps, which is wrong, since traps semantically can't be resumed after.
This commit is contained in:
@@ -340,7 +340,21 @@ fn define_control_flow(
|
||||
r#"
|
||||
Trap when non-zero.
|
||||
|
||||
if ``c`` is zero, execution continues at the following instruction.
|
||||
If ``c`` is zero, execution continues at the following instruction.
|
||||
"#,
|
||||
&formats.cond_trap,
|
||||
)
|
||||
.operands_in(vec![c, code])
|
||||
.can_trap(true),
|
||||
);
|
||||
|
||||
ig.push(
|
||||
Inst::new(
|
||||
"resumable_trapnz",
|
||||
r#"
|
||||
A resumable trap to be called when the passed condition is non-zero.
|
||||
|
||||
If ``c`` is zero, execution continues at the following instruction.
|
||||
"#,
|
||||
&formats.cond_trap,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user