View Single Post
Capt'n Corrupt's Avatar
Posts: 3,524 | Thanked: 2,958 times | Joined on Oct 2007 @ Delta Quadrant
#480
Originally Posted by wmarone View Post
Well a VM really is the only way to do it without cross compiling. So your choices are pretty much every scripting language, Java, and Microsoft's CLR. But then you toss in the mess of platform non-specific toolkits, so you might as well just use something like Qt and a good set of cross compilation tools.
That will soon change with PNaCl! This is why the project is so wonderful. It compiles code to ISA agnostic 'bit code' (using LLVM no doubt :P) to allow for native translation on the host. It targets the most popular implementations IA-32, ARM, and x86-64. In short, this allows for compile once to an intermediate 'bit code,' translate into native code, and run on the host at native speed! It also does this in a highly secure way for its intended web use.

This is very similar to a VM with a JIT (arguably the same), the difference being that the chosen language is not fixed (likely reason for the 'bit code' moniker).

Here's a link to a document that describes it well:
http://nativeclient.googlecode.com/s...site/pnacl.pdf

From the article:
PNaCl: Portable Native Client Executables

Google's Native Client technology uses software fault isolation (SFI) to enable the execution of untrusted native code inside a web browser, giving web applications greater access to the
performance of the client machine while avoiding the security problems with current infrastructure for plugins.

While the operating-system neutrality of Native Client tends to encourage good practices with respect to ISA portability, the burden of building, testing and deploying a program on all supported hardware platforms---currently IA-32, ARM and x86-64---lies with the developer. This arrangement makes it too easy for the developer to fail to support one or more ISAs, and tends to create a barrier for future new ISAs, threatening the portability
promise of the Web.

This document describes the design of PNaCl (pronounced "pinnacle"), a suite of tools for building, testing, and distributing Native Client programs in an instruction-set neutral format. PNaCl uses the Low-Level Virtual Machine (LLVM) bitcode format to represent ISA neutral portable executables compiled from code written in a variety of languages including C and C++.

The PNaCl design allows some flexibility in deciding where translation to native machine code occurs. By supporting client-side translation to the client's native instruction set, PNaCl reduces the burden on the developer, enabling support of new instruction sets without recompilation from the source. As PNaCl is layered cleanly on top of current ISA-specific NaCl implementations, the small trusted code base, source language neutrality, and safety properties of the system are preserved.

PNaCl, which will be open-sourced, is still at an early stage of development; we welcome feedback and suggestions on how its design might be improved.