WebAssembly:修订间差异
外观
删除的内容 添加的内容
无编辑摘要 标签:2017版源代码编辑 |
无编辑摘要 标签:2017版源代码编辑 |
||
第29行: | 第29行: | ||
| file format = <!-- or: | file formats = --> |
| file format = <!-- or: | file formats = --> |
||
}} |
}} |
||
'''WebAssembly''',簡稱'''Wasm''',是一個[[低级编程语言|低階程式語言]]。WebAssembly是[[可移植性]]的[[抽象語法樹]]<ref>{{cite web|url = https://github.com/WebAssembly/design/blob/master/Rationale.md#why-ast|title = design/Rationale.md at master · WebAssembly/design|work = [[GitHub]]|access-date = 2016-03-20|archive-date = 2021-03-08|archive-url = https://web.archive.org/web/20210308184924/https://github.com/WebAssembly/design/blob/master/Rationale.md#why-ast}}</ref>,被設計來提供比[[JavaScript]]更快速的[[編譯]]及執行<ref name="github.com">{{cite web|url = https://github.com/WebAssembly/design/blob/master/HighLevelGoals.md|title = design/HighLevelGoals.md at master · WebAssembly/design|work = [[GitHub]]|access-date = 2016-03-20|archive-date = 2019-06-06|archive-url = https://web.archive.org/web/20190606023801/https://github.com/WebAssembly/design/blob/master/HighLevelGoals.md}}</ref>。WebAssembly將讓開發者能運用自己熟悉的程式語言(最初以[[C語言|C]]/[[C++]]作為實作目標)編譯,再藉虛擬機器引擎在瀏覽器內執行<ref>{{cite web |url=http://techcrunch.com/2015/06/17/google-microsoft-mozilla-and-others-team-up-to-launch-webassembly-a-new-binary-format-for-the-web/#.xresx6:b1PE |title=Google, Microsoft, Mozilla And Others Team Up To Launch WebAssembly, A New Binary Format For The Web |work=TechCrunch |date=2015-06-17 |access-date=2015-06-20 |archive-date=2022-04-05 |archive-url=https://web.archive.org/web/20220405170059/https://techcrunch.com/2015/06/17/google-microsoft-mozilla-and-others-team-up-to-launch-webassembly-a-new-binary-format-for-the-web/#.xresx6:b1PE }}</ref>。WebAssembly的開發團隊分別來自[[Mozilla基金會|Mozilla]]、[[Google]]、[[微軟|Microsoft]]、[[蘋果公司|Apple]],代表著四大網路瀏覽器[[Firefox]]、[[Google Chrome|Chrome]]、[[Microsoft Edge]]、[[Safari]]<ref>{{cite web |first=Peter |last=Bright |url=http://arstechnica.com/information-technology/2015/06/the-web-is-getting-its-bytecode-webassembly/ |title=The Web is getting its bytecode: WebAssembly |work=[[Ars Technica]] |publisher=[[Condé Nast]] |date=2015-06-18 |accessdate=2015-06-20 |archive-date=2017-03-20 |archive-url=https://web.archive.org/web/20170320002809/https://arstechnica.com/information-technology/2015/06/the-web-is-getting-its-bytecode-webassembly/ |dead-url=no }}</ref>。2017年11月,以上四個瀏覽器都開始實驗性的支援WebAssembly<ref>{{Cite news|url=https://www.ithome.com.tw/news/120017|title=【2018關鍵趨勢1:WebAssembly】主流瀏覽器紛紛支援,網頁飆速成真|newspaper=iThome|accessdate=2018-01-06|language=zh-hant|archive-date=2020-05-30|archive-url=https://web.archive.org/web/20200530025822/https://www.ithome.com.tw/news/120017}}</ref><ref>{{Cite web|url=https://www.linuxpilot.com/webassembly-in-mainstream-browsers|title=主流瀏覽器都加入了 WebAssembly 支援 – Linuxpilot|accessdate=2018-01-06|work=www.linuxpilot.com|language=zh-TW|archive-date=2019-06-30|archive-url=https://web.archive.org/web/20190630040253/https://www.linuxpilot.com/webassembly-in-mainstream-browsers}}</ref>。 |
'''WebAssembly''',簡稱'''Wasm''',是一個[[低级编程语言|低階程式語言]]。WebAssembly是[[可移植性]]的[[抽象語法樹]]<ref>{{cite web|url = https://github.com/WebAssembly/design/blob/master/Rationale.md#why-ast|title = design/Rationale.md at master · WebAssembly/design|work = [[GitHub]]|access-date = 2016-03-20|archive-date = 2021-03-08|archive-url = https://web.archive.org/web/20210308184924/https://github.com/WebAssembly/design/blob/master/Rationale.md#why-ast}}</ref>,被設計來提供比[[JavaScript]]更快速的[[編譯]]及執行<ref name="github.com">{{cite web|url = https://github.com/WebAssembly/design/blob/master/HighLevelGoals.md|title = design/HighLevelGoals.md at master · WebAssembly/design|work = [[GitHub]]|access-date = 2016-03-20|archive-date = 2019-06-06|archive-url = https://web.archive.org/web/20190606023801/https://github.com/WebAssembly/design/blob/master/HighLevelGoals.md}}</ref>。WebAssembly將讓開發者能運用自己熟悉的程式語言(最初以[[C語言|C]]/[[C++]]作為實作目標)編譯,再藉虛擬機器引擎在瀏覽器內執行<ref>{{cite web |url=http://techcrunch.com/2015/06/17/google-microsoft-mozilla-and-others-team-up-to-launch-webassembly-a-new-binary-format-for-the-web/#.xresx6:b1PE |title=Google, Microsoft, Mozilla And Others Team Up To Launch WebAssembly, A New Binary Format For The Web |work=TechCrunch |date=2015-06-17 |access-date=2015-06-20 |archive-date=2022-04-05 |archive-url=https://web.archive.org/web/20220405170059/https://techcrunch.com/2015/06/17/google-microsoft-mozilla-and-others-team-up-to-launch-webassembly-a-new-binary-format-for-the-web/#.xresx6:b1PE }}</ref>。WebAssembly的開發團隊分別來自[[Mozilla基金會|Mozilla]]、[[Google]]、[[微軟|Microsoft]]、[[蘋果公司|Apple]],代表著四大網路瀏覽器[[Firefox]]、[[Google Chrome|Chrome]]、[[Microsoft Edge]]、[[Safari]]<ref>{{cite web |first=Peter |last=Bright |url=http://arstechnica.com/information-technology/2015/06/the-web-is-getting-its-bytecode-webassembly/ |title=The Web is getting its bytecode: WebAssembly |work=[[Ars Technica]] |publisher=[[Condé Nast]] |date=2015-06-18 |accessdate=2015-06-20 |archive-date=2017-03-20 |archive-url=https://web.archive.org/web/20170320002809/https://arstechnica.com/information-technology/2015/06/the-web-is-getting-its-bytecode-webassembly/ |dead-url=no }}</ref>。2017年11月,以上四個瀏覽器都開始實驗性的支援WebAssembly<ref>{{Cite news|url=https://www.ithome.com.tw/news/120017|title=【2018關鍵趨勢1:WebAssembly】主流瀏覽器紛紛支援,網頁飆速成真|newspaper=iThome|accessdate=2018-01-06|language=zh-hant|archive-date=2020-05-30|archive-url=https://web.archive.org/web/20200530025822/https://www.ithome.com.tw/news/120017}}</ref><ref>{{Cite web|url=https://www.linuxpilot.com/webassembly-in-mainstream-browsers|title=主流瀏覽器都加入了 WebAssembly 支援 – Linuxpilot|accessdate=2018-01-06|work=www.linuxpilot.com|language=zh-TW|archive-date=2019-06-30|archive-url=https://web.archive.org/web/20190630040253/https://www.linuxpilot.com/webassembly-in-mainstream-browsers}}</ref>。2019年12月5日,在W3C制定《WebAssembly核心規範<ref>[https://www.w3.org/TR/wasm-core-1/ WebAssembly核心規範] {{Wayback|url=https://www.w3.org/TR/wasm-core-1/ |date=20191206110848 }}</ref>》後,WebAssembly正式被認證為Web的標準之一。<ref>{{Cite web|url=https://www.w3.org/2019/12/pressrelease-wasm-rec.html.en|title=World Wide Web Consortium (W3C) brings a new language to the Web as WebAssembly becomes a W3C Recommendation|date=2019-12-05|access-date=2019-12-06|archive-date=2022-04-19|archive-url=https://web.archive.org/web/20220419042352/https://www.w3.org/2019/12/pressrelease-wasm-rec.html.en}}</ref>。 |
||
== 設計 == |
== 設計 == |
2024年4月5日 (五) 07:38的版本
![]() | |
编程范型 | 结构化堆栈机器 |
---|---|
设计者 | W3C |
实作者 | |
发行时间 | 2017年3月 |
当前版本 |
|
型态系统 | 静态 |
系统平台 | 跨平台 |
许可证 | Apache许可证2.0 |
文件扩展名 | .wat (纯文字格式,人类可读) .wasm(二进制档案) |
网站 | webassembly |
启发语言 | |
影响语言 | |
AssemblyScript |
WebAssembly,简称Wasm,是一个低阶程式语言。WebAssembly是可移植性的抽象语法树[2],被设计来提供比JavaScript更快速的编译及执行[3]。WebAssembly将让开发者能运用自己熟悉的程式语言(最初以C/C++作为实作目标)编译,再藉虚拟机器引擎在浏览器内执行[4]。WebAssembly的开发团队分别来自Mozilla、Google、Microsoft、Apple,代表著四大网路浏览器Firefox、Chrome、Microsoft Edge、Safari[5]。2017年11月,以上四个浏览器都开始实验性的支援WebAssembly[6][7]。2019年12月5日,在W3C制定《WebAssembly核心规范[8]》后,WebAssembly正式被认证为Web的标准之一。[9]。
设计
最高指导目标
在官方的一个github页面[10]与说明文件[11]中,阐述了WebAssembly的设计与实作原则,包含:
- 定义一个可移植,具有大小与载入高效率的二进位格式,作为编译标的。这个编译标的必须可以被编译至常见的平台,包含移动端与物联网,并且可以善用硬体资源、有原生执行码的执行速度。
- 规格与实作:
- 设计可以执行在现有的网路平台之内以及与之整合:
- 保持无版本问题、特色测试、向后相容的网路平台
- 在与Javascript相同的环境中执行
- 允许从Javascript中同步呼叫
- 强化同源(Same-origin)和安全性权限政策
- 允许浏览器存取相同功能的Javascript API
- 定义一个可人工读取,能和二进位格式互换的纯文字格式,以支援查看原始码
- 设计也可以用于非浏览器的嵌入式系统
- 制作大平台
下一阶段要实作的特色
在2017年推出第一个版本后,同时也列出了下一阶段将实作的特色[12][13]
- 制定规格
- 执行绪
- 固定长度的SIMD
- 例外处理
- 垃圾回收
- 记忆体区块操作
- 网页内容安全性政策
- ECMAScript 模组整合
- 尾端呼叫
- Non-trapping浮点数-整数转换
- 多值函数
- Host bindings
官方的宣传
Ending定律
Ending定律也称为终结者定律, 它是Ending在2016年Emscripten技术交流会上给出的断言[14]:
所有可以用WebAssembly实现的终将会用WebAssembly实现。
现在这个定律除了 WebAssembly 的支持者用做宣传之外看不到任何实现的迹象。
参见
- ActiveX
- VBScript
- Flash / ActionScript
- Microsoft Silverlight
- Java Applet / JavaFX
- asm.js
- Native Client
其他位元组码
参考资料
- ^ Release 2.0. 2022年6月1日 [2023年2月11日].
- ^ design/Rationale.md at master · WebAssembly/design. GitHub. [2016-03-20]. (原始内容存档于2021-03-08).
- ^ design/HighLevelGoals.md at master · WebAssembly/design. GitHub. [2016-03-20]. (原始内容存档于2019-06-06).
- ^ Google, Microsoft, Mozilla And Others Team Up To Launch WebAssembly, A New Binary Format For The Web. TechCrunch. 2015-06-17 [2015-06-20]. (原始内容存档于2022-04-05).
- ^ Bright, Peter. The Web is getting its bytecode: WebAssembly. Ars Technica. Condé Nast. 2015-06-18 [2015-06-20]. (原始内容存档于2017-03-20).
- ^ 【2018關鍵趨勢1:WebAssembly】主流瀏覽器紛紛支援,網頁飆速成真. iThome. [2018-01-06]. (原始内容存档于2020-05-30) (中文(繁体)).
- ^ 主流瀏覽器都加入了 WebAssembly 支援 – Linuxpilot. www.linuxpilot.com. [2018-01-06]. (原始内容存档于2019-06-30) (中文(台湾)).
- ^ WebAssembly核心规范 (页面存档备份,存于互联网档案馆)
- ^ World Wide Web Consortium (W3C) brings a new language to the Web as WebAssembly becomes a W3C Recommendation. 2019-12-05 [2019-12-06]. (原始内容存档于2022-04-19).
- ^ WebAssembly High-Level Goals. [2018-01-06]. (原始内容存档于2019-06-06).
- ^ WebAssembly High-Level Goals - WebAssembly. webassembly.org. [2018-01-13]. (原始内容存档于2022-04-22).
- ^ Features to add after the MVP. [2018-01-06]. (原始内容存档于2021-04-01).
- ^ Features to add after the MVP - WebAssembly. webassembly.org. [2018-01-13]. (原始内容存档于2019-05-15).
- ^ Ending定律即将生效!.
外部链接
- 官方网站
- WebAssembly Community Group(页面存档备份,存于互联网档案馆)
- WebAssembly Design (页面存档备份,存于互联网档案馆)
- WebAssembly资源精选 - 中文版 (页面存档备份,存于互联网档案馆)
- WebAssembly标准入门 - 人民邮电 (页面存档备份,存于互联网档案馆)
- C/C++面向WebAssembly编程 - 开源图书 (页面存档备份,存于互联网档案馆)
- MDN Web Docs WebAssembly文档(中文版 (页面存档备份,存于互联网档案馆)、英文版 (页面存档备份,存于互联网档案馆))
|
|
|