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

AssertEq seems to reject any operand other than invoke or const #34

Closed
kg opened this issue Aug 29, 2015 · 6 comments
Closed

AssertEq seems to reject any operand other than invoke or const #34

kg opened this issue Aug 29, 2015 · 6 comments

Comments

@kg
Copy link
Contributor

kg commented Aug 29, 2015

I can't figure out why it does this, but asserteq produces a syntax error if its operands are anything other than invoke or const. loads/loadu definitely don't work.

@rossberg
Copy link
Member

That's working as intended, and is hard-coded in the syntax, see the grammar. The only way to access a module externally is by invoking an export, so you shouldn't be able to (or need to) observe anything else in a test.

@kg
Copy link
Contributor Author

kg commented Aug 29, 2015

That's working as intended, and is hard-coded in the syntax

| AssertEq of string * Ast.expr list * Ast.expr list?

@rossberg
Copy link
Member

Right, that's the (script) AST. The parsing rule is:

  | LPAR ASSERTEQ LPAR INVOKE TEXT expr_list RPAR expr_list RPAR
    { AssertEq ($5, $6 (c0 ()), $8 (c0 ())) @@ at() }

Those expressions are evaluated in an empty dummy context, so you (intentionally) don't have access to any state. IOW, constant expressions only -- this is intended as a declarative assertion about the behaviour of exported functions.

@kg
Copy link
Contributor Author

kg commented Aug 29, 2015

OK, I see. So for the purposes of the ml-proto, we're acting as if each module has its own isolated heap (not the unified heap we will have post-dynamic-linking) and it's not exposed externally (unlike what will happen in embedded environments). And to do heap assertions you shove an assertion routine into the module? Awkward but reasonable, I guess. I don't like having to shove test code inside the module being tested :(

@rossberg
Copy link
Member

Yes. @titzer was particularly adamant about not having a richer assertion
language, see the discussion on PR #14.

On 29 August 2015 at 04:05, Katelyn Gadd [email protected] wrote:

OK, I see. So for the purposes of the ml-proto, we're acting as if each
module has its own isolated heap (not the unified heap we will have
post-dynamic-linking) and it's not exposed externally (unlike what will
happen in embedded environments). And to do heap assertions you shove an
assertion routine into the module? Awkward but reasonable, I guess. I don't
like having to shove test code inside the module being tested :(


Reply to this email directly or view it on GitHub
#34 (comment).

@lukewagner
Copy link
Member

@kg Even with dynamic linking, there will not be a single "unified heap" but, rather, explicit linking of new code into existing module instances. In ml-proto, the static-code/loaded-instance distinction is reflected by the Ast.modul / Eval.module_instance types. When we add dynamic linking, the logical extension would be to change Eval.module_instance to contain a list of Ast.modul. (To prepare for dynamic linking and to avoid confusion like in #306, I've been thinking we should rename Eval.module_instance to something that doesn't imply 1:1. Probably should update design repo first, though.)

littledan pushed a commit to littledan/spec that referenced this issue Mar 4, 2018
The new names are:
- `i32.extend8_s`
- `i32.extend16_s`
- `i64.extend8_s`
- `i64.extend16_s`

`i64.extend32_s` has also been added for consistency.

See issue WebAssembly#34.
eqrion pushed a commit to eqrion/wasm-spec that referenced this issue Jul 18, 2019
This commit fixes WebAssembly#34 by specifying that the flags field (which
indicates if a segment is passive) is a `varuint32` instead of a
`uint8`. It was discovered in WebAssembly#34 that the memory index located at that
position today is a `varuint32`, which can be validly encoded as `0x80
0x00` in addition to `0x00` (in addition to a number of other
encodings). This means that if the first field were repurposed as a
single byte of flags, it would break these existing modules that work
today.

It's not currently known how many modules in the wild actually take
advantage of such an encoding, but it's probably better to be safe than
sorry!

Closes WebAssembly#34
eqrion pushed a commit to eqrion/wasm-spec that referenced this issue Sep 18, 2019
* Add missing eq_ref
* Fix export index computation
* Remove bogus test
alexcrichton pushed a commit to alexcrichton/spec that referenced this issue Nov 18, 2019
* Rename LaneIdx{2,4,8,16,32} to ImmLaneIdx{2,4,8,16,32}

This makes it clear everywhere that `ImmLaneIdx` is an immediate operand and also makes the nomenclature for immediate operands consistent (both `ImmByte` and `ImmLaneIdx`  start with the prefix `Imm`) .

See WebAssembly/simd#33 .

* further clarify the representation hierarchies and immediate mode operands

* memarg is an immediate mode argument

* reference scalar load/stores spec

* Fix typo: floating-point value to integer-value

* Fix memarg

* Fix language in replace value

* Update "hierarchy" of types paragraph
alexcrichton pushed a commit to alexcrichton/spec that referenced this issue Nov 19, 2019
ErikMcClure pushed a commit to innative-sdk/spec that referenced this issue Jun 15, 2020
[spec] fixed resultype typo in configuration validity
rossberg added a commit to effect-handlers/wasm-spec that referenced this issue Feb 15, 2021
dhil pushed a commit to dhil/webassembly-spec that referenced this issue Oct 3, 2023
dhil added a commit to dhil/webassembly-spec that referenced this issue Jul 31, 2024
Merge with WebAssembly/main and wasm-3.0 branch.
rossberg added a commit that referenced this issue Nov 6, 2024
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

3 participants