Skip to content

Commit

Permalink
Save instruction pointer for async messages
Browse files Browse the repository at this point in the history
This ensures that if we panic due to sending a message to the current
process, we print the correct stacktrace; instead of trying to get the
location of the instruction _after_ the send.

This fixes https://gitlab.com/inko-lang/inko/-/issues/294.

Changelog: fixed
  • Loading branch information
yorickpeterse committed Oct 22, 2022
1 parent c362caf commit ea303b4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions vm/src/machine.rs
Expand Up @@ -570,6 +570,11 @@ impl<'a> Machine<'a> {
let reg = ins.arg(0);
let rec = state.context.get_register(ins.arg(1));
let method = ins.arg(2);

// We save in case of a panic, otherwise we may be missing
// stack frames in the resulting stack trace.
state.save();

let res = process::send_async_message(
self.state, thread, process, task, rec, method,
)?;
Expand Down

0 comments on commit ea303b4

Please sign in to comment.