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

Refactor validation #392

Merged
merged 10 commits into from
Aug 18, 2018
Merged

Refactor validation #392

merged 10 commits into from
Aug 18, 2018

Conversation

maurobringolf
Copy link
Collaborator

@maurobringolf maurobringolf commented Jun 7, 2018

Some refactor of validations improving a couple of things:

  • Mutable globals cannot be used in global initialization Fixes initializer expression cannot reference a mutable global #355.

  • ModuleContext is created before running validations and passed to the individual steps.

  • Validation fixtures now run all validation steps, not just type-checking and I removed the separate isConst tests since its API changed to Program -> Array<string> giving a list of errors too.

We should probably merge all validation visitors and then run one big traverse doing all the work at the same time?

xtuc and others added 2 commits May 28, 2018 10:17

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@maurobringolf maurobringolf force-pushed the refactor-validation branch from efe0844 to 7593a90 Compare June 7, 2018 22:45
Copy link
Owner

@xtuc xtuc left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks

errors.push(...isConst(ast, moduleContext));
errors.push(...importOrderValidate(ast));
errors.push(...typeChecker(ast, moduleContext));
});
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There are some inconsistencies in the way the repl constructs modules. It doesnt always pass a Program here, but sometimes ast is directly a Module node itself. I tried checking for it here, but it didnt fix all the tests, so it probably requires some changes to the repl?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I found the problem. The repl also used the type checker directly. I switched to the new getValidationErrors API.

@maurobringolf
Copy link
Collaborator Author

@xtuc I finally got around fixing this, except for one spec test. But I am not sure how it relates to the current changes in the specification: WebAssembly/spec#814. Do you know when the official testsuite is updated?

@xtuc
Copy link
Owner

xtuc commented Jun 13, 2018

@maurobringolf (sorry for the delai). I tried to upgrade our spec tests here #296, I will try to finish it eventually.

The issue with mutable global is that you can't really use them atm, no support but it's coming soon

@xtuc xtuc merged commit cffdbe4 into master Aug 18, 2018
@xtuc xtuc deleted the refactor-validation branch August 18, 2018 13:02
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.

initializer expression cannot reference a mutable global
2 participants