Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document panicking instructions #4

Open
ctiedt opened this issue Dec 31, 2024 · 0 comments
Open

Document panicking instructions #4

ctiedt opened this issue Dec 31, 2024 · 0 comments

Comments

@ctiedt
Copy link
Collaborator

ctiedt commented Dec 31, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant