Skip to main content

How is WASM cross-platform when ASM is not?

My understanding​

  • WebAssembly is like Assembly, except that
    • it runs cross-platform
    • it runs isolated
    • it runs on browsers
  • But how is WASM fast and cross-platform simultaneously?
    • Does it pack multiple precompiled binary executables for multiple CPU vendors, like Apple's Universal Binary?
    • But then whenever a new type of CPU gets announced, they wouldn't be able to run existing WASMs
  • WebAssembly's runtime environments (RE) are low-level virtual stack machines (akin to JVM or Flash VM)
  • Seems like WASM is closer to intermediate Java Byte Code instead of the genuinely low-level Assembly.
    • But then, why is it faster?
    • JS Interpreter can skip the parsing
    • It can ship in a much more compact file format

Question​

  • Is WASM only creating intermediate bytecodes from existing C/C++/Rust codes, just like Java JVM, not compiling to bare metal?
  • What is the relationship between WebAssembly and Assembly?
  • Does WASM borrow any idea, technology, or philosophy from Assembly?

Stack Overflow​

References​

  1. "WebAssembly." Wikipedia, Wikimedia Foundation, 9 Sept. 2022, en.wikipedia.org/wiki/WebAssembly. Accessed 20 Sept. 2022.