webassembly - WebAssembly MVP 在浏览器中的现状

标签 webassembly

https://webassembly.github.io/demo/说:“实现了完整的执行语义。”听起来 MVP 已经完成,但到底缺少什么,或者我做错了什么?

浪费:

(module
    (memory 1)

    (export "growMemory" $growMemory)
    (func $growMemory (param $0 i32) (result i32) (grow_memory (get_local $0)))

    (export "getMemorySize" $getMemorySize)
    (func $getMemorySize (result i32) (memory_size))
)

JS代码:
var xhr = new XMLHttpRequest();
xhr.open('GET', 'build/test.wasm', true);
xhr.responseType = 'arraybuffer';
xhr.onload = function() {
    var module = Wasm.instantiateModule(new Uint8Array(xhr.response));
    console.log(module.exports.getMemorySize());
    console.log(module.exports.growMemory(1));
    console.log(module.exports.getMemorySize());
};
xhr.send(null);

Chrome Canary 加载了 WASM 文件,但似乎没有实现增长内存:
65536
0
65536

Firefox Nightly 加载失败:
TypeError: wasm validation error at offset 124: bad expression code

此外,页面大小似乎是 0x10000 而不是 0x1000。但我在设计或规范中找不到它。

最佳答案

2017 年 3 月更新:

WebAssembly MVP 有 reached consensus :

WebAssembly CG members representing four browsers, Chrome, Edge, Firefox, and WebKit, have reached consensus that the design of the initial (MVP) WebAssembly API and binary format is complete to the extent that no further design work is possible without implementation experience and significant usage. This marks the end of the Browser Preview and signals that browsers can begin shipping WebAssembly on-by-default. From this point forward, future features will be designed to ensure backwards compatibility.

This consensus includes a JavaScript API and binary format accompanied by a reference interpreter. You can test out WebAssembly today using the Emscripten toolchain by following the developer’s guide and reading more on MDN.

The next steps will be to form a W3C Working Group, to produce a specification for the initial version of WebAssembly, and to continue iterating on future features in the current Community Group. To get involved, you can join design discussions and contribute to the the WebAssembly GitHub project.



当前webassembly.org站点记录了在 MVP 之后要遵循的以下后续步骤:

The WebAssembly community group and contributors plan to:

  • distill the design and spec interpreter repos into a single unified specification in the spec repo
  • propose a new charter for a W3C WebAssembly Working Group
  • graduate the WebAssembly LLVM backend from experimental to stable (and update Emscripten)
  • prototype additional WebAssembly integration into browser developer tools
  • Start work on post-MVP features


2016 年 11 月更新:

目前有一个浏览器预览版,正在征求开发者的反馈。来自 webassembly.org :

The WebAssembly Community Group has an initial (MVP) binary format release candidate and JavaScript API which are implemented in several browsers. The CG is now soliciting feedback from the broader community as part of a Browser Preview period. The tentative goal of the CG is for the Browser Preview to conclude in Q1 2017, though significant findings during the Browser Preview could potentially extend the duration. When the Browser Preview concludes, the CG will produce a draft specification of WebAssembly and browser vendors can start to ship conforming implementations on-by-default.

Developers should be aware that between the Browser Preview and public launch of WebAssembly, there will be at least one breaking change which will require developers to update their toolchain and binaries. These changes will be announced ahead of time and are listed below.

See Getting Started to start experimenting and Feedback for how and where to direct feedback.



原答案:

我们同步了演示的浏览器之间的功能奇偶校验,并打算从现在开始同步更新所有浏览器 + 演示,朝着 MVP 迈进。

我们有一些目前有效的东西,但它并不稳定。当我们使用更大和更多样化的代码库时,我们希望能够解决问题,看看可以改进什么,并获得信心,即 MVP 后的功能将可以毫无困难地实现。我们还希望开发人员提供反馈,以确保我们构建的内容可用!

它缺少一些功能,例如 Wasm 的 API。 JavaScript 对象、内存和指针共享 Wasm实例。我们也没有确定二进制格式,目前最大的变化是后期排序,但还有很多较小的变化。

浏览器集成也缺乏:我们希望提供 View 源代码和一些调试支持。还有一些性能调整和大量的安全测试。

要跟踪这些问题,我建议查看 designspec问题跟踪器。

关于你的具体问题,我们还没有说完grow_memory在 Chrome 。不过工作已经开始了。

关于webassembly - WebAssembly MVP 在浏览器中的现状,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36678553/

相关文章:

java - 使用 WebAssembly,有什么方法可以获取 .jar 并在浏览器中运行它?

google-chrome - WebAssembly 后 MVP 后原生客户端的 future

visual-studio-code - 在 VSCode Web 扩展中加载 wasm

javascript - 无法在 'put' : An object could not be cloned 上执行 'IDBObjectStore'

javascript - EM_JS : How to convert int argc, char **argv 到 JS 字符串数组?

python - 将 Python 编译为 WebAssembly

javascript - 使用C#创建WebAssembly

c# - 如何从 Blazor WebAssembly 中的 Razor 页面访问 body 标签或其他标签?

go - 如何将go指针作为wasm上下文数据传递?