Skip to content

Document panicking instructions #4

@ctiedt

Description

@ctiedt

The current specification does not state if instructions may panic. Off the top of my head, here are instructions for which this should be clarified:

  • panic - self-explanatory.
  • syscall - I'm not sure any current soil implementation uses panicking syscalls, but they could be useful for error handling. Also, invalid syscall numbers may cause a panic.
  • memory instructions - Out-of-bounds accesses are specified to cause panics. However, it might be helpful to annotate the memory instructions as panicking.
  • Division (div and fdiv) - Divide by zero causes a panic in all implementations that I am aware of, but the specification does not state this.
  • tryend, ret - If these instruction appear without a trystart or call respectively before, they should likely panic.
  • jump, cjump, call - jumps to illegal addresses should panic.

There is also the question of handling instructions that specify invalid registers. However, since the set of valid registers is well-defined, bytecode containing invalid registers should be considered as malformed or invalid from the start. We might specify that a VM should refuse to execute such code at all or immediately end execution without the possibility of error recovery.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions