Fork me on GitHub

Mono的Google Native Client(NaCl)技术支持

Native Client是Google在浏览器领域推出的一个开源技术,它允许在浏览器内编译Web应用程序,并执行原生的编译好的代码。Native Client有以下几个优势(参考Google官方英文介绍):

  • 为Web提供更多的图形,音频以及其他功能:可以直接在web上执行了原生的2D,3D图形渲染程序(对Web游戏很有用),播放音视频,响应鼠标键盘事件,多线程执行代码等等,而这一切,不需要浏览器安装任何插件。
  • 良好的可移植性:一个Web程序,只需要开发一份代码,即可以在所有平台(包括Windows,linux,Mac等)运行。
  • 高安全性:安装不被信任的桌面程序一级浏览器插件,可能带来很高的安全风险(如程序携带木马,病毒)。而Native client使用了双层沙盒(sandbox)设计来保护用户的本地资源。Native Client的架构可以保证web要应用的安全性,并且取得和原声代码相同或相近的性能。
  • 方便从桌面迁移:很多开发厂商之前花了大力气开发桌面程序,随着云计算的到来,越来越多的程序会被移植到互联网上,由于NaCl支持直接执行C/C++/Java等代码,Native Client技术可以简化移植过程,减少移植成本。
  • 高性能:Native Client可以让web应用已接近桌面程序的性能运行,这就为在浏览器内运行性能苛刻的程序提供了基础,如大型3D游戏。

参照这两篇文章:

漫谈Google的Native Client技术(一)–历史动力篇(Web本地计算发展史)

漫谈Google的Native Client(NaCl)技术(二)–技术篇(兼谈LLVM)

Mono从2.10开始支持NaCI技术(开源Mono框架将C#编程带到iPhone、Android和Wii),Unity 3.5也通过Mono支持NaCI ,Getting Started with Native Client Development。经过近2年的开发,昨天的Mono版本代码中签入了一个重要的NaCI更新,https://github.com/mono/mono/pull/538

  • Restore nacl directory for this fork
  • Add back temporary __nacl_suspend_thread_if_needed to this fork
  • Set up for building on TeamCity.
  • Zip up build results for TeamCity
  • Remove dependency to gettext
  • Simple random implementation for NaCl, so we don't get exceptions.
  • Add x86_64 build.
  • cleanup.
  • Updated README instructions
  • Don't use sgen for non-nacl mono build for parity
  • brushing off some nacl dust
  • Remove hardcoded path
  • NaCl working again post M14
  • Fixes for nacl
  • Updated README
  • Merge remote branch 'upstream/master' into merge_head
  • Fixups for nacl at head revision
  • New master script to build all for NaCl
  • Add nacl cross-compile target
  • Fix up bugs in x86-codegen for NaCl, use 4.0 for regression tests
  • Merge branch 'merge_head'
  • Wrap pthread_exit () with mono_gc_pthread_exit () since NACL requires it.
  • No longer need BOEHM_DEFINES in io-layer, pthread_exit is wrapped
  • Fix NaCl GC deadlock
  • - Fix nacl aborting on windows because of failed write calls
  • Update for new nacl tool names, also preliminary glibc support.
  • First pass nacl glibc work
  • More glibc nacl work, builds shared library.
  • Fix amd64_alu_reg_imm for NaCl (previous fix was over ambitious)
  • Faster GC instrumentation for managed nacl code.
  • Compare pointers against 4 byte immediates
  • Build with -O2 in Native Client x86-64.
  • Merge pull request #1 from pasko/master
  • Fix compile and validation errors in optimized build
  • Fix conv.ovf.i.un test for 64 bit nacl
  • Also fix convert i->i and i->u with no ovf
  • enable gc instrumentation with inlined if
  • Add volatile qualifier to libgc stop the world.
  • Brad's patch to bootstrap NaCl glibc
  • Merge pull request #2 from zheka/master
  • Added __nacl_thread_suspension_needed to dynamic exports.
  • Force memory allocation to use mmap
  • Merge pull request #3 from zheka/master
  • get rid of the alias to __nacl_thread_suspension_needed
  • Always use near_call == TRUE in emit_call_body().
  • Merge pull request #4 from bradchen/master
  • Make size of immediate explicit in generating CMP instruction.
  • Run fsacheck tests with data from high-memory to
  • Add 'laddcc'/'lsubcc' IR opcode to deal explicitly with long arguments
  • Pass return valuetypes of non power of two size to their nearest power of two, previously defaulted to sizeof(gpointer) which is too small for 5, 6, and 7 byte types on ILP32 machines.
  • Fix patch targets to newly installed methods for NaCl
  • Make divide by zero checks explicit for Native Client
  • Pass TYPEDBYREF types the same as VALUETYPE for amd64 NaCl because that's more appropriate for the ABI
  • Fix BB max_offset for x86 NaCl
  • Fix spaces/tabs from last commit
  • Make explicit-null-checks default for mono in NaCl (not embedded case), option to disable since the environment is mostly unusable
  • Add nacl-specific regression tests
  • Support 'make check' for self-hosted NaCl Mono in mono/mini
  • Self-host NaCl Mono build
  • Re-enable dlopen support in NaCl Mono
  • Enable 'make check' for NaCl on root build directory:
  • Add stderr output on nacl_dyncode_create failure, makes it easier to debug bad code
  • Change README contents since those instructions don't work anymore
  • Add custom nacl_interp script for building/testing NaCl Mono
  • Make scripts work with slightly different paths from pepper_18.
  • Use /bin/bash explicitly so the script runs properly
  • Change install directory so it doesn't modify the toolchain dir
  • Disable AOT loadhook for native client
  • Initial NaCl/ARM work.
  • Fix gmodule-unix.c (needed config.h for HAVE_DLFCN_H)
  • Merge upstream mono
  • Fix NaCl build post-merge with upstream master
posted @ 2013-01-26 09:08  张善友  阅读(2572)  评论(1编辑  收藏  举报