gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-01 00:42:28 26 4
gpt4 key购买 nike

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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com