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 opcode 0x1C, typed select. #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bnoordhuis
Copy link

Copy link
Owner

@sunfishcode sunfishcode left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

| Mnemonic | Opcode | Immediates | Signature | Families |
| ----------- | ------ | --------------------------------------------------- | ------------------------------------------- | -------- |
| `select` | 0x1b | | `($T[1], $T[1], $condition: i32) : ($T[1])` | |
| `select` | 0x1c | `$signature`: [array] of [value types]; length is 1 | `($T[1], $T[1], $condition: i32) : ($T[1])` | |
Copy link
Owner

Choose a reason for hiding this comment

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

I don't think "array" is correct here because "array" as defined in this document includes an encoding of the length, which the actual binary encoding for typed select doesn't have. Instead of saying it's an array with "length is 1", could we just say there's a single type? The spec does have wording leaving open the possibility of having more types, but the binary encoding doesn't reflect that.

Copy link
Author

Choose a reason for hiding this comment

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

The octets for typed select look like this: 1C 01 7F - the last one is the actual type; the second one is always 1 but I think that qualifies as array-like?

(Just guessing but I suspect it's to allow future extension for a select where the two operands have different types?)

Copy link
Owner

Choose a reason for hiding this comment

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

Ah, you're right. I misread the spec. Could you then move the length is 1 out and add it as a Validation requirement?

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.

2 participants