How to replace browser javascript engine with LLVM?
Asked Answered
C

1

23

As a proof of concept, I would like to get a browser to be able to run LLVM IR. The basic idea would be that any language with an LLVM compiler, would be able to work as a first class citizen on the net. (Which is why I don't want to go the LLVM IR -> JS route for anything other than a "fallback")

The LLVM code should be able to all the same functions (e.g. DOM) with the same restrictions. I'm looking for pointers on getting started, where the best place to dive in is (I have C/C++ experience) and what the easiest browser is going to be to extend.

Ideally I'm looking for something very modular, so this is just another "scripting engine" as is the javascript one, as is any other future ones (e.g. direct python one)

Thanks very much

Chancy answered 12/6, 2011 at 7:35 Comment(6)
Take a look at Portable Native Client project (PNaCl).Eaves
Mind that LLVM IR is not platform-independent at all.Whiney
Any advance on this? it seems interesting, for the PoC emscripten seems to be a good option.Ingoing
I indeed like the idea of yours, but I believe asking "how" is a wrong way. If someone knew how to do it, they would have done it, or published their designs. If you want to do this, you need to do some research, and when you come up with a technical problem that you don't know how to solve, then come and ask.Arjan
@Arjan I think the asker just wants a starting point. It seems to me that the way to get started is by writing a plugin; MDN has a decent writeup of the cross-browser NPAPI here: developer.mozilla.org/En/Plugins (I would be very interested in such a project!)Decay
You can compare differences between Dartium and Chromium. dartlang.org/tools/dartiumCharade
A
3

Emscripten is an LLVM backend targeting asm.js, which may be executed on all major browsers. The project dates back to 2010. This translates the IR into asm.js for you. Ideally you should be able to expand the project to support additional languages as opposed to just C/C++; either that or as a launching pad to put the other components in place prior to writing your bindings for the execution environment against the browser interfaces you desire.

asm.js has been used to run the Unreal engine, along with porting DosBox for Archive.org's game archives.

Algology answered 9/2, 2015 at 1:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.