跳转到内容

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定律即将生效!. 

外部連結