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

Sean Silva silvas at purdue.edu
Sat Aug 18 19:56:04 PDT 2012


Most of the performance wins for dynamic languages are not from the
kinds of optimizations that LLVM does; you basically gain performance
by doing run-time specialization of dynamic language constructs to
become static, which is something that LLVM really won't help you do,
and which practically speaking is extremely language-specific.

For example, in JavaScript, all numbers are officially doubles, but in
many cases it is profitable to runtime-specialize them to be integers,
on the other hand, Python distinguishes between floats and integers,
but Python integers overflow into arbitrary-precision integers
on-demand.

For another example, in Python, dictionaries can have any hashable
type as their key, but in JavaScript, "objects" (which double as
hashtables) can only have strings as their keys (although numbers get
implicitly converted to strings which is another big language-specific
optimization opportunity). Oh, and in JavaScript "objects" have a
number of additional semantics which prevent them from being actually
used as pure hashtables!

--Sean Silva

On Sat, Aug 18, 2012 at 4:39 PM, Julian Klappenbach
<jklappenbach at gmail.com> wrote:
> I have a concept for which I'm conducting an initial analysis.  The broader
> idea is to create an LLVM, JIT based runtime that would create a platform
> amenable to scripting languages, but do so while enforcing an optional
> sandbox environment when dictated by security concerns (browsers, user
> preferences).  With this approach, the community would gain language
> independence for browsers, as well as enabling much needed standardization
> over tooling support for debugging, refactoring, and even general editing
> concerns.
>
> The first language I'd like to tackle is ECMAScript / Javascript.
>
> So, aside from all the issues with the strategy (getting buy-in from browser
> / tooling teams, development community), my first concern is that it is even
> possible.  Theoretically, it should be possible to express Javascript in
> LLVM.  But a quick review of existing projects indicates that, while LLVM ->
> Javascript has been taken on, what I'm seeking has not been done to date.
>
> Have I missed anything, or is there any reason not to attempt a project like
> this?
>
> Regards,
>
> Julian Klappenbach
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>



More information about the llvm-dev mailing list