Skip to content

Conversation

tlively
Copy link
Member

@tlively tlively commented Oct 8, 2025

Give it opcode 0xe5 to be adjacent to resume_throw at 0xe4, and as a
result bump switch to 0xe6.

Redefine the execution semantics of resume_throw in terms of
resume_throw_ref.

As a drive-by, fix the nullability of reference operands in the initial
introduction of each other instruction.

Give it opcode 0xe5 to be adjacent to `resume_throw` at 0xe4, and as a
result bump `switch` to 0xe6.

Redefine the execution semantics of `resume_throw` in terms of
`resume_throw_ref`.

As a drive-by, fix the nullability of reference operands in the initial
introduction of each other instruction.
@tlively tlively requested a review from fgmccabe October 8, 2025 23:05
Copy link
Member

@rossberg rossberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM modulo nits

aborted with `resume_throw`; directly switched to via `switch`; or
partially applied with `cont.bind`.
There are five different ways in which suspended continuations are
consumed (`resume,resume_throw,resume_throw_ref,switch,cont.bind`).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit, while here:

Suggested change
consumed (`resume,resume_throw,resume_throw_ref,switch,cont.bind`).
consumed (`resume`, `resume_throw`, `resume_throw_ref`, `switch`, `cont.bind`).

- iff `S.conts[ca] = epsilon`

* `S; F; v^m (ref.cont ca) (resume_throw $ct $e hdl*) --> S''; F; prompt{hdl'*} E[(ref.exn |S'.exns|) throw_ref] end`
* `S; F; (ref.null t) (ref.cont ca) (resume_throw_ref $ct hdl*) --> S; F; trap`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make the rules non-overlapping:

Suggested change
* `S; F; (ref.null t) (ref.cont ca) (resume_throw_ref $ct hdl*) --> S; F; trap`
* `S; F; (ref.null t) (ref.cont ca) (resume_throw_ref $ct hdl*) --> S; F; trap`
- iff `S.conts[ca] = (E : n)`

@titzer
Copy link
Contributor

titzer commented Oct 9, 2025

Can you bump the opcode in the implementation in this PR, too?

The numbering will break in coordinating between tools that do use switch, but we should probably do that as early as possible.

@tlively tlively merged commit 9579cb9 into main Oct 9, 2025
1 check passed
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.

3 participants