pure-lang icon indicating copy to clipboard operation
pure-lang copied to clipboard

Port Pure to the MCJIT in order to support LLVM 3.6+

Open agraef opened this issue 8 years ago • 5 comments

We have to do this some time real soon now, as Linux distributions are beginning to phase out LLVM 3.5. Also, clang 3.5 isn't supported by MacPorts on current macOS systems any more, while LLVM 3.5 still is.

The main problem here are the dynamic features of the Pure language, which allow a global function definition to be refined at any time. Last time I looked, MCJIT didn't allow to recompile individual functions on the fly, only modules. If it is still that way, it will require a substantial rewrite of the compiler backend (basically, every global Pure function will have to go into its own module and these will then have to be linked together; right now the entire Pure program is just a single LLVM module).

(Originally submitted 2015-02-28 by David Slate as BB #36.)

agraef avatar Mar 27 '17 03:03 agraef

It looks like with the ORC API it is possible to compile each function. It would be great if Pure did not depend on an obsolete LLVM. The easier it is to install it, the more people will use it :)

mardukbp avatar Jul 23 '18 09:07 mardukbp

Pulling the rug out from under people is what I predicted would happen with LLVM, simply because of where it comes from -- that it, for whose main benefit it exists. I hope this all gets sorted out, but maybe it would be better to have a different back end?

chemoelectric avatar Oct 04 '18 22:10 chemoelectric

@mardukbp, compiling functions on demand isn't enough, the Pure interpreter needs to recompile functions every time you add a collection of equations to an existing function. So I'm not sure whether the code from the latest version of the Kaleidoscope example will help, but I'll look into it some time.

@chemoelectric I've gone through many LLVM versions, and they kept breaking the C++ API with almost every release, so that's nothing new. It's just that I've been procrastinating on this issue forever, because the scope of the changes to move away from the old JIT is quite substantial. Also, I've been busy with other projects. But I'll get to it eventually. ;-)

agraef avatar Oct 05 '18 11:10 agraef

FWIW, we plan to remove LLVM 3.5 from FreeBSD in about six months time. The oldest version available that that point will likely be 6.0 or 7.0.

brooksdavis avatar Mar 20 '19 23:03 brooksdavis

Maybe the title should be changed to "Port Pure to the ORCv2 JIT in order to support LLVM 3.7+"

rurban avatar Sep 20 '22 06:09 rurban