Skip to content

interp: name the function of a rollback from its instruction - #6014

Open
davecheney wants to merge 1 commit into
tinygo-org:devfrom
davecheney:interp-errorat-detail
Open

davecheney wants to merge 1 commit into
tinygo-org:devfrom
davecheney:interp-errorat-detail

Conversation

@davecheney

Copy link
Copy Markdown
Contributor

Each rollback site builds a recoverableError that records its message, the function being interpreted and, at two sites, the opcode of the failing instruction. errorAt already stores that instruction in the Error it returns, so every site repeats the function, which the Error can derive, and keeps the opcode apart from a message that could simply include it.

This change adds rollbackAt, which builds a recoverableError from a message and wraps it with errorAt, and has Error name the function of any recoverable error when it is formatted. Rollback messages stay ad hoc, written where the rollback happens, and the two that name an opcode include it in the message. The messages are unchanged, and the remaining recoverable errors, such as an integer used as a pointer, now also name the function.

Each rollback site builds a recoverableError that records its message, the function being interpreted and, at two sites, the opcode of the failing instruction. errorAt already stores that instruction in the Error it returns, so every site repeats the function, which the Error can derive, and keeps the opcode apart from a message that could simply include it.

This change adds rollbackAt, which builds a recoverableError from a message and wraps it with errorAt, and has Error name the function of any recoverable error when it is formatted. Rollback messages stay ad hoc, written where the rollback happens, and the two that name an opcode include it in the message. The messages are unchanged except that an instruction the interpreter does not model now names its opcode, and the remaining recoverable errors, such as an integer used as a pointer, now also name the function.
@davecheney davecheney added this to the 0.45 milestone Oct 24, 2026
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

Successfully merging this pull request may close these issues.

1 participant