Re: Pengine - the Prolog engine running SWISH

Jan Wielemaker <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <[email protected]>
On 08/19/2013 01:03 AM, Richard A. O'Keefe wrote:
> Step 1.  Compile the C code to LLVM bitcode using clang.
> Step 2.  Compile the LLVM bitcode to JavaScript using emscripten
>           (http://en.wikipedia.org/wiki/Emscripten).
> Step 3.  Asm.js (asmjs.org) is a sublanguage of JavaScript.  An
>           Asm.js-aware JavaScript implementation (such as a recent
>           versions of FireFox) can compile it to native code that's
>           within hailing distance of C->native direct compilation.
>
> Of course, with JavaScript having no threads, some things wouldn't
> port.  I've never used emscripten or asm.js myself, but I'm led to
> believe that it would be more like a port to a new (and crippled)
> operating system than anything else.
>
> Some of the libraries wouldn't port, and the top level driver might
> be different, but I would expect that the compiler and the emulator
> would be OK.

Cool. I wonder how that would work security-wise though. After all,
things on the stack are intptr_t objects that go through some math
before it is used as a pointer. Nobody can prove that this is a pointer
into an allocated stack. Either you need expensive checks or you need a
separate process and use the VM manager to make sure nothing outside
allocated memory is touched.

... and the single-threaded version no longer compiles :-(  Shouldn't
be too hard to fix that.

	Cheers --- Jan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.