@@ -222,18 +222,25 @@ macro_rules! for_each_extended_op {
222222 /// Do nothing.
223223 nop = Nop ;
224224
225- /// A special opcode to use an indirect function call to reenter the
226- /// host from the interpreter .
225+ /// A special opcode to halt interpreter execution and yield control
226+ /// back to the host .
227227 ///
228- /// This is used to implement host intrinsics such as `memory.grow`
229- /// for example where that needs to reenter the host from the
230- /// interpreter.
228+ /// This opcode results in `DoneReason::CallIndirectHost` where the
229+ /// `id` here is shepherded along to the embedder. It's up to the
230+ /// embedder to determine what to do with the `id` and the current
231+ /// state of registers and the stack.
231232 ///
232- /// The `sig` immediate here is the Nth signature in the
233- /// `for_each_host_signature!` macro below. The 0th "argument", in
234- /// register x0, is the function pointer that's being called and all
235- /// further arguments follow after that in registers.
236- call_indirect_host = CallIndirectHost { sig: u8 } ;
233+ /// In Wasmtime this is used to implement interpreter-to-host calls.
234+ /// This is modeled as a `call` instruction where the first
235+ /// parameter is the native function pointer to invoke and all
236+ /// remaining parameters for the native function are in following
237+ /// parameter positions (e.g. `x1`, `x2`, ...). The results of the
238+ /// host call are then store in `x0`.
239+ ///
240+ /// Handling this in Wasmtime is done through a "relocation" which
241+ /// is resolved at link-time when raw bytecode from Cranelift is
242+ /// assembled into the final object that Wasmtime will interpret.
243+ call_indirect_host = CallIndirectHost { id: u8 } ;
237244 }
238245 } ;
239246}
0 commit comments