5

WASM is meant to be executed by general purpose computers. How does the low level WASM get converted to a form that the EOS virtual machine can understand?

3

WASM is the form that the virtual machine understands.

4

WebAssembly is indeed the instruction format that the virtual machine understands.

The actual interaction between the eos library and the wasm binary is done through WebAssembly modules. Every contract thus has to export an apply function, which serves as the entrypoint. It can also import functions to interact with the eos environment. A small subset of these functions are listed here.

Finally I'm pretty sure the eos virtual machine does not support the webassembly float types.

  • Not enough reputation to add a comment to @wanheda's so let me note it here: EOS WASM does support floating point though only through a software library so as to avoid inconsistencies between the different existing implementations. – Tiana Jan 17 at 18:40
1

"EOS virtual machine" == WAVM or binaryen, which is a WASM-specific VM.

  • Please add some more details or resources. – TeeAttack42 Aug 17 '18 at 12:27
  • here is github.com/go-interpreter/wagon, a standalone VM for interpreting WASM, which is easy to understand compared to binaryen(github.com/WebAssembly/binaryen) or WAVM(github.com/AndrewScheidecker/WAVM). You can see that wagon is a classic stack-based VM, who provides a stack, memory, and some instructions. Cause Wasm is well formed after compiling by AOT tools, When interpreting, A PC travels wasm bytecode, get the operators and run the instructions(actually binding a function), get the result and push into the stack. – Duan Bing Aug 17 '18 at 15:25
  • Until reaching the end of the bytecode, you can get the result. Interpreting is simple compared to designing the syntax in some way. I am not sure this is what you want to know. – Duan Bing Aug 17 '18 at 15:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.