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

Mr.T.K
  • 2,188
  • 5
  • 23
  • 39
Heptic
  • 2,806
  • 4
  • 26
  • 48
  • 3
    Mind that LLVM IR is not platform-independent at all. – SK-logic Jun 12 '11 at 11:27
  • Any advance on this? it seems interesting, for the PoC emscripten seems to be a good option. – Jorge E. Cardona Nov 28 '11 at 05:15
  • 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. – Kos Feb 09 '12 at 14:27
  • @Kos 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: https://developer.mozilla.org/En/Plugins (I would be very interested in such a project!) – Calvin Jul 25 '12 at 21:43
  • 4
    Take a look at [Portable Native Client project](http://www.chromium.org/nativeclient/pnacl) (PNaCl). – arrowd Jun 12 '11 at 09:11
  • 1
    You can compare differences between Dartium and Chromium. https://www.dartlang.org/tools/dartium/ – Ginden Jan 29 '15 at 14:04

1 Answers1

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.

Mark
  • 968
  • 10
  • 20