WebAssembly, as a compilation target for any programming language, enables applications to run in browsers or other proxies--browsers that run programs in other languages?

Source: Internet
Author: User

Mozilla, Google, Microsoft and Apple have decided to develop a web-oriented binary format. The format, named webassembly, can be used as a compilation target for any programming language, enabling applications to run in browsers or other proxies.

A few years ago, we discussed the advantages of web-oriented universal bytecode on INFOQ (see discussion: Do we need a generic web bytecode?). "), outlining the difficulty of creating such a format. One of the main issues mentioned was the inability of major browser makers to agree: Mozilla pushed Asm.js, Google supported Pnaci, Apple was developing Fltjit, and Microsoft did not show any interest in any of them. But now, things have changed. All four major browser vendors have agreed to create a web-oriented binary format webassembly or wasm/wasm. Some call it bytecode, but wasm is not a traditional bytecode, Brendan eich points out: "webassembly is actually a compressed AST code, not a bunch of bytecode." Keep your voice down, don't tell anyone. If you want, you can still call it a byte code. ”

So far, the project has been secret, but now it has been published on GitHub and in the community group. Webassembly's intention was that programs written in languages other than JavaScript could run in browsers and other JS proxies on servers, mobile or IoT devices. This format will eventually replace Asm.js and Pnaci. Based on the project design document (which has not yet been finalized), WASM uses binary because it "provides greater efficiency: It reduces the download file size and speeds up decoding, so even large code libraries can be started quickly." "WASM has a corresponding text format that can be used by debuggers or other developer-oriented tools. These tools should be able to convert from one format to another without losing information.

webassembly implementation has taken a temporary first step: Convert the format to the appropriate asm.js code, so it can run on browsers that support asm.js: Firefox, Edge, Chrome. A Polyfill prototype has been built for this purpose, and preliminary results show that the compressed binary format is about 23 times times faster than the Asm.js 20-30%,wasm decoding speed compared to parsing the corresponding Asm.js source code. Wasm will get native support for browser VMs later.

webassembly will first bring the C + + program to the Web, but will later support any other language through enhanced implementations. A LLVM backend and clang transplant are already on the plan. Wasm will run in the same semantic space as JavaScript, support asynchronous calls from/to JavaScript, access all browser APIs, and follow the security policies that JavaScript programs follow. Client applications can be written entirely in wasm, or they can implement business logic with Wasm and implement the UI with Html/css/javascript.

Following the 20th birthday announcement of JavaScript, and the day the ECMA announced the final approval of the ES6 specification, webassembly was not a good news for JavaScript. Wasm will make it possible to write web code in any language that can be compiled into wasm,
JavaScript will compete directly with other languages. Can we expect Java or C # to compile into wasm?

Webassembly will benefit from developing asm.js and Pnaci lessons, as the team that created it included teams from Mozilla and Google. And the support of Microsoft and Apple has made it a very promising project. The only problem left is time: Typically, projects developed jointly by several large companies take a lot of time. In this case, the normalization process is very slow.

Efficient and fast

The WASM stack machine was designed to being encoded in a size-and load-time-efficient binary format. WebAssembly aims to execute at native-taking advantage of common hardware capabilities available on a wide range of platforms.

Safe

WebAssembly describes a memory-safe, sandboxed execution environment that could even be implemented inside existing JAVASCRI PT virtual machines. When embedded in the web, WebAssembly would enforce the Same-origin and permissions security policies of the browser.

Open and Debuggable

WebAssembly is designed to being pretty-printed in atextual format for debugging, testing, experimenting, optimizing, learnin G, teaching, and writing programs by hand. The textual format is used whenviewing the source of WASM modules on the web.

Part of the open web platform

WebAssembly is designed to maintain the versionless, feature-tested, and backwards-compatible nature of the web. WebAssembly modules'll is able to call in and out of the JavaScript context and access browser functionality through T He same Web APIs accessible from JavaScript. WebAssembly also supports non-webembeddings.

Excerpt from: http://webassembly.org/

WebAssembly, as a compilation target for any programming language, enables applications to run in browsers or other proxies--browsers that run programs in other languages?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.