[LLVMdev] Greetings & Javascript -> LLVM...

Dan Gohman gohman at apple.com
Mon Aug 20 12:10:41 PDT 2012


On Aug 18, 2012, at 8:22 PM, Julian Klappenbach <jklappenbach at gmail.com> wrote:
> 
> I'm envisioning a use case where browsers would utilize this runtime to execute not only javascript, but also python, ruby, etc.  Language specific interpreters could be downloaded on the fly to support scripts, and security would be ensured due to the fact that it would be based within the LLVM layer.

It's possible you didn't mean it this way, but it's important to avoid a
common confusion. LLVM IR provides no security. None whatsoever. Code in
LLVM IR has the same level of arbitrary memory access and access to the
enclosing system as C code does. In fact, if anything, LLVM probably
makes the security story worse.

It is possible to use LLVM within an independent sandbox, and various people
are doing that, but that's not a unique property of LLVM.

>  The LLVM layer would also provide the access point for common browser APIs like access to the DOM and HTML nodes, XSLT, and XHR invocations.  This would open up both the browser and current HTML5 application platforms to a wide variety of languages.   Some may be quite happy with Javascript, but I'm sure others would be excited to see that stranglehold broken.

I think there's no question that a lot of people want something like this.
However, there are a bunch of challenges. Some of the big ones include:

How are objects (as in object-oriented programming) going to work? Do you
envision the platform providing a generic object model that all high-level
languages will share, or do you envision every language framework building
its own object model on top of a set of primitive operations? This question,
and questions which follow it, will determine what kinds of languages can
be ported to the platform, as well as play a large role in determining how
hard it'll be to make them run efficiently, and how much cross-language
interoperability you can have.

Also, how is GC going to work? How is concurrency going to work? How is
security going to work? How are third-party libraries going to work?

These are some of the big important questions which will form the overall
shape of your design. And it turns out that LLVM itself doesn't provide
any significant help on any of them. So while LLVM may be a useful tool
in the implementation stage, it's probably not where you want to start
in the design stage for your project.

Dan




More information about the llvm-dev mailing list