PNaCl:Google通过LLVM增强对Chrome中原生应用的支持
作者?Abel Avram?,譯者?臧秀濤?發(fā)布于 五月 20, 2013
通過(guò)支持運(yùn)行LLVM位碼(bitcode),Google增強(qiáng)了對(duì)Chrome中原生應(yīng)用的支持。
在Google I/O 2013大會(huì)上,Google宣布了預(yù)期加入的PNaCl(Portable NaCl,讀作“pinnacle”),繼續(xù)推進(jìn)對(duì)Chrome中原生應(yīng)用的支持。PNaCl修改了原來(lái)的工具鏈,與之前為每種目標(biāo)平臺(tái)編譯C/C++應(yīng)用不同,現(xiàn)在開發(fā)者只需生成一份LLVM位碼,之后位碼可以由任一Chrome客戶端加載,在本地轉(zhuǎn)換為原生代碼、驗(yàn)證和執(zhí)行。
目前,x86-32、x86-64和ARM架構(gòu)上的Chrome 29已支持PNaCl。在PNaCl完整發(fā)布之后,Chrome客戶端能夠在任意頁(yè)面上運(yùn)行原生模塊,而無(wú)需將其打包為面向Chrome Web Store的應(yīng)用。此外,PNaCl模塊無(wú)需重新編譯即可在未來(lái)的架構(gòu)上運(yùn)行。更為有趣的是,盡管目前只支持C/C++,理論上PNaCl模塊可以以任何能夠編譯為L(zhǎng)LVM位碼的語(yǔ)言編寫,包括ActionScript、Ada、D、Fortran、Haskell、Java字節(jié)碼、Objective-C、Python、Ruby、Rust、Scala和C#等,拓寬了可以在Chrome中運(yùn)行的遺留的和較新的原生應(yīng)用的使用范圍,這些應(yīng)用只需要很小的調(diào)整,甚至無(wú)需調(diào)整。
2010年,4位Google工程師組成的一個(gè)團(tuán)隊(duì)在內(nèi)部提出了PnaCl(PDF),幾位作者想象的是這樣一種解決方案:
- 為編譯的NaCl模塊提供一種獨(dú)立于指令集體系結(jié)構(gòu)(ISA)的格式,無(wú)需重新編譯即可支持多種目標(biāo)平臺(tái)。
- 便于NaCl開發(fā)者構(gòu)建、測(cè)試和部署可移植的執(zhí)行模塊。
- 首先要支持x86-32、x86-64和ARM指令集,但要很容易支持未來(lái)其他流行的通用處理器。
- 能夠保持原生客戶端所擁有的安全和性能屬性。
PNaCl仍然使用原來(lái)的NaCl沙盒機(jī)制,以保證運(yùn)行翻譯位碼時(shí)的安全性。具體邏輯如下圖所示,客戶端從服務(wù)器請(qǐng)求位碼,然后針對(duì)自己的架構(gòu)將其轉(zhuǎn)換為原生的可執(zhí)行代碼。翻譯可能在本地進(jìn)行(在另一個(gè)NaCI沙盒內(nèi)),也可能通過(guò)另一個(gè)實(shí)體遠(yuǎn)程執(zhí)行。
PnaCl開發(fā)工具鏈支持Windows、Mac和Linux,SDK可以從項(xiàng)目網(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中原生应用的支持的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: MySql 几个命令
- 下一篇: 你应该了解的CSS语义化命名方式及常用命