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 Wasm-1.0/2.0 spec #48

Merged
merged 3 commits into from
Nov 23, 2023
Merged

Fix Wasm-1.0/2.0 spec #48

merged 3 commits into from
Nov 23, 2023

Conversation

f52985
Copy link
Collaborator

@f52985 f52985 commented Nov 23, 2023

This PR introduces following changes for Wasm 1.0 / 2.0 specs.

  1. Inject parenthesis at x* x'** properly so that they are correctly parsed (This issue seems to be happening repeatedly. Perhaps, changing parser so that they are parsed as intended even without parenthesis would be a better option in long term.)
  2. Change instrX* into exprX at instantiate function
  3. Change Step_read rule premises into Eval_expr at instantiate function. (Step_read requires exactly one reduction step to occur, i.e., disallows already-value instructions like I32.CONST 0.)

@f52985 f52985 requested a review from rossberg November 23, 2023 06:42
Copy link
Collaborator

@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.

Thanks!

Comment on lines 23 to 29
rule Eval/done:
z; val* ~>* z; val*

rule Eval/step:
z; admininstr* ~>* z''; val*
-- Step: z; admininstr* ~> z'; admininstr'*
-- Eval: z'; admininstr' ~>* z''; val*
Copy link
Collaborator

Choose a reason for hiding this comment

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

Declaratively, it would be more natural to have this more general relation (while leaving Eval_expr as is except invoking Steps):

Suggested change
rule Eval/done:
z; val* ~>* z; val*
rule Eval/step:
z; admininstr* ~>* z''; val*
-- Step: z; admininstr* ~> z'; admininstr'*
-- Eval: z'; admininstr' ~>* z''; val*
relation Steps: config ~>* config hint(show "E")
rule Steps/refl:
z; admininstr* ~>* z; admininstr*
rule Steps/trans:
z; admininstr* ~>* z''; admininstr''*
-- Step: z; admininstr* ~> z'; admininstr'*
-- Steps: z'; admininstr' ~>* z''; admininstr''*

Would that work in the backend as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, it should work well without any problem.

(It was already handled in hardcoded way. The rule premise Eval_expr: lhs ~> rhs is rougly translated to the AL statement 1. Let rhs be the result of computing $eval_expr(lhs), where eval_expr is a manually written algorithm)

@f52985
Copy link
Collaborator Author

f52985 commented Nov 23, 2023

I pushed a new commit introducing Steps relation.


relation Eval: config ~>* state; val* hint(show "E-expr")
relation Eval_expr: state; expr ~>* state; val* hint(show "E-expr")
relation Steps: config ~>* config hint(show "E")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: move up to other relations.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In that case, should I also move rules for Steps above rules for Step?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would move the relation decl after the others, so the rules can stay here, I think.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh I see, I thought you meant moving Steps relation above other Step relations.


relation Eval: config ~>* state; val* hint(show "E-expr")
relation Eval_expr: state; expr ~>* state; val* hint(show "E-expr")
relation Steps: config ~>* config hint(show "E")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here.

@f52985 f52985 merged commit d9c5654 into main Nov 23, 2023
1 check passed
@f52985 f52985 deleted the main-expr branch November 23, 2023 12:23
rossberg added a commit that referenced this pull request Mar 7, 2024
Clarify order of the memory.copy immediates
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