PNaCl:Google通过LLVM增强对Chrome中原生应用的支持
作者?Abel Avram?,譯者?臧秀濤?發(fā)布于 五月 20, 2013
通過支持運行LLVM位碼(bitcode),Google增強了對Chrome中原生應(yīng)用的支持。
在Google I/O 2013大會上,Google宣布了預(yù)期加入的PNaCl(Portable NaCl,讀作“pinnacle”),繼續(xù)推進對Chrome中原生應(yīng)用的支持。PNaCl修改了原來的工具鏈,與之前為每種目標平臺編譯C/C++應(yīng)用不同,現(xiàn)在開發(fā)者只需生成一份LLVM位碼,之后位碼可以由任一Chrome客戶端加載,在本地轉(zhuǎn)換為原生代碼、驗證和執(zhí)行。
目前,x86-32、x86-64和ARM架構(gòu)上的Chrome 29已支持PNaCl。在PNaCl完整發(fā)布之后,Chrome客戶端能夠在任意頁面上運行原生模塊,而無需將其打包為面向Chrome Web Store的應(yīng)用。此外,PNaCl模塊無需重新編譯即可在未來的架構(gòu)上運行。更為有趣的是,盡管目前只支持C/C++,理論上PNaCl模塊可以以任何能夠編譯為LLVM位碼的語言編寫,包括ActionScript、Ada、D、Fortran、Haskell、Java字節(jié)碼、Objective-C、Python、Ruby、Rust、Scala和C#等,拓寬了可以在Chrome中運行的遺留的和較新的原生應(yīng)用的使用范圍,這些應(yīng)用只需要很小的調(diào)整,甚至無需調(diào)整。
2010年,4位Google工程師組成的一個團隊在內(nèi)部提出了PnaCl(PDF),幾位作者想象的是這樣一種解決方案:
- 為編譯的NaCl模塊提供一種獨立于指令集體系結(jié)構(gòu)(ISA)的格式,無需重新編譯即可支持多種目標平臺。
- 便于NaCl開發(fā)者構(gòu)建、測試和部署可移植的執(zhí)行模塊。
- 首先要支持x86-32、x86-64和ARM指令集,但要很容易支持未來其他流行的通用處理器。
- 能夠保持原生客戶端所擁有的安全和性能屬性。
PNaCl仍然使用原來的NaCl沙盒機制,以保證運行翻譯位碼時的安全性。具體邏輯如下圖所示,客戶端從服務(wù)器請求位碼,然后針對自己的架構(gòu)將其轉(zhuǎn)換為原生的可執(zhí)行代碼。翻譯可能在本地進行(在另一個NaCI沙盒內(nèi)),也可能通過另一個實體遠程執(zhí)行。
PnaCl開發(fā)工具鏈支持Windows、Mac和Linux,SDK可以從項目網(wǎng)站下載。
查看英文原文:PNaCl: Google Adds More Native Support to Chrome via LLVM
Portable Native Client (PNaCl)
May 15, 2013
Portable Native Client (PNaCl, pronounced "pinnacle"), is an architecture-independent version of Native Client. Traditional C and C++ development uses a "compile?→?link" workflow that produces a platform- and architecture-dependent executable. In contrast, PNaCl development uses an?LLVM?compiler infrastructure with a "compile?→?link?→?translate" workflow. This workflow produces a "linked" binary that is provided as intermediate representation (IR) bitcode; the bitcode is then translated locally for a specific end-user system architecture. In conjunction with Native Client's?POSIX-like environment and the?Pepper API?for media interfaces, PNaCl provides complete platform independence. With PNaCl, developers can create a single executable for all users. Because translation happens at the client, developers get the benefit of translations for new architectures, as well as new translation optimizations, for free, as such features become available and without the need to rebuild their applications. Once PNaCl is fully released, users will be able to run PNaCl modules on any web page – applications will not need to be deployed through the Chrome Web Store in order to run PNaCl modules.
For background information about PNacl, see?PNaCl: Portable Native Client Executables?(PDF). For current release information, see the?release notes.
轉(zhuǎn)載于:https://www.cnblogs.com/ainima/p/6331959.html
總結(jié)
以上是生活随笔為你收集整理的PNaCl:Google通过LLVM增强对Chrome中原生应用的支持的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: MySql 几个命令
- 下一篇: 基于visual Studio2013解