跳转到内容

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>。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>。
'''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的版本

WebAssembly
编程范型结构化堆栈机器
设计者W3C
实作者
发行时间2017年3月,​7年前​(2017-03
当前版本
  • 2.0 (2022年6月1日)[1]
编辑维基数据链接
型态系统静态
系统平台跨平台
许可证Apache许可证2.0
文件扩展名.wat (纯文字格式,人类可读)
.wasm(二进制档案)
网站webassembly.org 编辑维基数据链接
启发语言
影响语言
AssemblyScript英语AssemblyScript

WebAssembly,简称Wasm,是一个低阶程式语言。WebAssembly是可移植性抽象语法树[2],被设计来提供比JavaScript更快速的编译及执行[3]。WebAssembly将让开发者能运用自己熟悉的程式语言(最初以C/C++作为实作目标)编译,再藉虚拟机器引擎在浏览器内执行[4]。WebAssembly的开发团队分别来自MozillaGoogleMicrosoftApple,代表著四大网路浏览器FirefoxChromeMicrosoft EdgeSafari[5]。2017年11月,以上四个浏览器都开始实验性的支援WebAssembly[6][7]。2019年12月5日,在W3C制定《WebAssembly核心规范[8]》后,WebAssembly正式被认证为Web的标准之一。[9]

设计

最高指导目标

在官方的一个github页面[10]与说明文件[11]中,阐述了WebAssembly的设计与实作原则,包含:

  1. 定义一个可移植,具有大小与载入高效率的二进位格式,作为编译标的。这个编译标的必须可以被编译至常见的平台,包含移动端物联网,并且可以善用硬体资源、有原生执行码的执行速度。
  2. 规格与实作:
    • 最初的MVP(Minimum Viable Product)与Asm.js有大略相等的功能,并以C/C++语言为优先;
    • 其他额外的特性最初集中在执行绪,零消耗的异常,和SIMD。这些额外的特性先以回馈和实验为主,包含C/C++以外其他语言的支持。
  3. 设计可以执行在现有的网路平台之内以及与之整合:
    • 保持无版本问题、特色测试、向后相容的网路平台
    • 在与Javascript相同的环境中执行
    • 允许从Javascript中同步呼叫
    • 强化同源(Same-origin)和安全性权限政策
    • 允许浏览器存取相同功能的Javascript API
    • 定义一个可人工读取,能和二进位格式互换的纯文字格式,以支援查看原始码
  4. 设计也可以用于非浏览器的嵌入式系统
  5. 制作大平台
    • 为WebAssembly建置新的LLVM后端与伴随的Clang接口
    • 推动其他WebAssembly的编译器与工具
    • 启用更多有用的工具

下一阶段要实作的特色

在2017年推出第一个版本后,同时也列出了下一阶段将实作的特色[12][13]

官方的宣传

Ending定律

Ending定律也称为终结者定律, 它是Ending在2016年Emscripten技术交流会上给出的断言[14]

所有可以用WebAssembly实现的终将会用WebAssembly实现。

现在这个定律除了 WebAssembly 的支持者用做宣传之外看不到任何实现的迹象。

参见

其他逐渐被舍弃的网页用户端技术与RIA

其他位元组码

参考资料

  1. ^ Release 2.0. 2022年6月1日 [2023年2月11日]. 
  2. ^ design/Rationale.md at master · WebAssembly/design. GitHub. [2016-03-20]. (原始内容存档于2021-03-08). 
  3. ^ design/HighLevelGoals.md at master · WebAssembly/design. GitHub. [2016-03-20]. (原始内容存档于2019-06-06). 
  4. ^ 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). 
  5. ^ Bright, Peter. The Web is getting its bytecode: WebAssembly. Ars Technica. Condé Nast. 2015-06-18 [2015-06-20]. (原始内容存档于2017-03-20). 
  6. ^ 【2018關鍵趨勢1:WebAssembly】主流瀏覽器紛紛支援,網頁飆速成真. iThome. [2018-01-06]. (原始内容存档于2020-05-30) (中文(繁体)). 
  7. ^ 主流瀏覽器都加入了 WebAssembly 支援 – Linuxpilot. www.linuxpilot.com. [2018-01-06]. (原始内容存档于2019-06-30) (中文(台湾)). 
  8. ^ WebAssembly核心规范页面存档备份,存于互联网档案馆
  9. ^ 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). 
  10. ^ WebAssembly High-Level Goals. [2018-01-06]. (原始内容存档于2019-06-06). 
  11. ^ WebAssembly High-Level Goals - WebAssembly. webassembly.org. [2018-01-13]. (原始内容存档于2022-04-22). 
  12. ^ Features to add after the MVP. [2018-01-06]. (原始内容存档于2021-04-01). 
  13. ^ Features to add after the MVP - WebAssembly. webassembly.org. [2018-01-13]. (原始内容存档于2019-05-15). 
  14. ^ Ending定律即将生效!. 

外部链接