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

Fix most of the spec tests #148

Merged
merged 1 commit into from
Oct 6, 2016
Merged

Fix most of the spec tests #148

merged 1 commit into from
Oct 6, 2016

Conversation

binji
Copy link
Member

@binji binji commented Oct 6, 2016

The only ones that are failing are imports, exports, linking and start.

Fixes:

  • Make sure to assign loc_ for WasmVar
  • Imports must occur before any definition, not just a definition of the
    same kind
  • Check that load/store alignment is not larger than natural alignment
  • Always check type stack at the end of the check_block; that way an
    empty block is still validated
  • Only allow one memory or table, including imports
  • Don't allow importing or exporting mutable globals
  • Loop label signature is for the fallthrough at the bottom, not the
    branch target. This was implemented properly in the AST checker, but
    not in binary-reader-interpreter
  • top_type_is_any will check if there is ANY anywhere on the type
    stack; previously this check did not look past the top label's type
    stack limit
  • drop_types_for_return may be called without having enough values on
    the type stack; for example, at the end of a function the ends with
    return
  • properly handle cleaning up the type stack for the interpreter when
    branching to the implicit function label
  • rename invoke -> action a few places

@binji
Copy link
Member Author

binji commented Oct 6, 2016

@KarlSchimpf @sbc100

This is a pretty big PR, but a lot of the bulk is just rebasing the tests. I can split it up if that would make it easier to review, though.

The only ones that are failing are imports, exports, linking and start.

Fixes:
* Make sure to assign loc_ for WasmVar
* Imports must occur before any definition, not just a definition of the
  same kind
* Check that load/store alignment is not larger than natural alignment
* Always check type stack at the end of the check_block; that way an
  empty block is still validated
* Only allow one memory or table, including imports
* Don't allow importing or exporting mutable globals
* Loop label signature is for the fallthrough at the bottom, not the
  branch target. This was implemented properly in the AST checker, but
  not in binary-reader-interpreter
* `top_type_is_any` will check if there is ANY anywhere on the type
  stack; previously this check did not look past the top label's type
  stack limit
* `drop_types_for_return` may be called without having enough values on
  the type stack; for example, at the end of a function the ends with
  return
* properly handle cleaning up the type stack for the interpreter when
  branching to the implicit function label
* rename invoke -> action a few places
Copy link
Contributor

@KarlSchimpf KarlSchimpf left a comment

Choose a reason for hiding this comment

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

LGTM.

@@ -146,6 +146,7 @@
APPEND_FIELD_TO_LIST(module, export_field, EXPORT, export_, loc_, \
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm curious why this file is checked in (it is a generated source file)?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I'd rather not, but it makes it easier for developers who don't have bison + re2c to compile. By default it is not used.

@binji binji merged commit 5063373 into master Oct 6, 2016
@binji binji deleted the fix-spec branch October 6, 2016 20:30
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.

None yet

2 participants