-
Notifications
You must be signed in to change notification settings - Fork 478
Binary encoder + various cleanup #261
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
Conversation
@@ -119,7 +119,7 @@ and func' = | |||
type memory = memory' Source.phrase | |||
and memory' = | |||
{ | |||
initial : Memory.size; | |||
min : Memory.size; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's perhaps subtle, but why is "initial" changing to "min" here and elsewhere? Apparently BinaryFormat.md calls it "minimum", but AstSemantics.md still calls it "initial".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, fair point. The naming in BinaryFormat is more symmetric, so I chose that. We should resolve it either way, happy to change back if that's preferred.
|
||
The file format is a (very dumb) form of *script* that cannot just define a module, but also batch a sequence of invocations. | ||
The S-expression format is a (very dumb) form of *script* that cannot just define a module, but in fact a sequence of them, and a batch of invocations, assertions, and conversions to each one. As such it is a superset of the binary format, with the additional functionality purely intended as testing infrastructure. (See [below][#scripts] for details.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll make one more argument against calling .wast a "superset" of a .wasm:
From a user perspective, as opposed to a ml-proto implementation perspective, .wast files are not modules; they are scripts that have a way to define modules inline. They don't satisfy the "isa" relationship, except via an awkward path where all modules but one are silently discarded, behavior which isn't useful outside of artificial testcases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoiding the word "superset" now.
Superseded by #268. |
Merge upstream spec changes into simd
* Update index of instructions. Fixes Issue WebAssembly#258 - Python script tweak, TRY has now two validation and two execution rules.
First step towards handling the binary format in the spec. The patch was getting large, so I decided to split it up. This part includes the encoder, and several additions to make it useful. For example, you can now invoke the interpreter like
to convert from text to binary. In a while, the same will also be possible in the inverse direction.
I also extended the script language with
(input <file>)
and(output <file>)
commands. Both are supposed to be able to handle both wast and wasm eventually. The former allows including other scripts or binary modules, the latter allows conversion as part of a script.Finally, the command line now supports an
-e <script>
option, which enables to give commands directly. This is useful, for example, when intermingled with binary module arguments, e.g., to invoke exports:Caveat: the binary format implemented in this patch already uses post-order. There currently is no compatible consumer (the decoder for the follow-up patch isn't quite ready yet), so this is completely untested. Uploading it anyway, to factor reviewing a little bit. Tests will follow once the decoder is ready.