LLVM ==== First discussion about using LLVM as a target language. LLVM (Low Level Virtual Machine) is a Compiler Infrastructure; see http://llvm.cs.uiuc.edu/. Irc log from October, the 28th:: So I smell something growing here... arigo: thanks. I lost some of up-logs... so I asked. stackless: nice on that assembly target: How is their source code? Had no time to look. I hope they don't use huge ugly other languages like ML? stackless: good for you! I thank Richard Emslie, I thank Richard Emslie (he repeats) arigo: uh, bob ippolito just wrote that LLVM is all C++ stackless: i doubt it Yep. LLVM is in C++. arigo: so logging & summary is for you (evil grin) sanxiyn: yes stackless: i think they are using fast custom back-ends for runtime code generation arigo: that sounds like what I like. stackless: they also mentioned grabbing parts of GCC who bothers - we have to have some binding with C++ then :-) stackless: or ideas and AST structures at least but they seemed to like to move away from it (because of licensing issues) well, they might like PyPy and decide to become part of the project, supporting us. * sanxiyn baffles, "ML is neither huge nor ugly!" stackless: yes ! in all cases i think that a genllvm.py should be easy to write right and if their compilers are good it could be faster than C * stackless apologises, didn't mean ML, probably. But last time he looked into C--, he was unhappy to pull so much tings in... because it has a lot of meta-information not only types, but single-step-assignment guarantees no aliasing, whereas GCC tries hard to find out what could alias what single-step-assignment is one thing I remember from C-- yes it's a good idea really good. They never have expressions in function calls. and it's natural for intermediate languages like our flow graphs Instead, order of evaluation is crystal clear. I think FlowModel has that property too... yes since it's derived from Python bytecode... etc. interesting stuff from the e-mail at http://mail.cs.uiuc.edu/pipermail/llvmdev/2003-October/000501.html "programs which have high-degree basic blocks" high-degree mean (unless i'm mistaken) a lot of inputargs we have a lot of them indeed yes! that's what' that's a problem when using languages like ML as intermediate languages you can write functions with 23 arguments but the compiler isn't optimized for that i tried, it produces bad code :-) Ah, I heard it from Lisp gotchas, i.e. it's easier to write slow code in Lisp. (it specifically mentioned problem with multiple value return optimization. sounds similar.) btw, what is SSA... single-step assignment (never write to a variable more than once) I'm not sure how does it help, but I don't know much about this area. i a m just skimming the source code looks nice and readable and good inline documentation it seems it is c++ though :-) arigo: Was thinking more about SpaceOp/Annset. It's a constraint-based programming. yes, constrain propagation... That's what Screamer (sorry, don't know about others. this one is Lisp) do very well... Integer range analysis and all goodies. * hpk has not often seen such nice c++ code ... So it's not really a new idea. But that means we have lots of expereince to learn from. sanxiyn: yes * sanxiyn loads screamer intro he downloaded but have never read. hmmm, it's really a high level c++ code, probably pretty easy to convert to python (the parts i have seen) How much code is LLVM? i have no idea i just read the commit mails ls PyPy is currently 39844 lines of code. (22000 of them is PyPy, 16000 Pyrex.) what? 16000 pyrex? what do you mean? Plex + Pyrex is 16000 lines. Oct 28 16:10:18 --> pedronis (~sp@91.51.202.62.dial.bluewin.ch) has joined #pypy Hello. hi pedronis: hi samuele hi samuele * sanxiyn downloads LLVM 1.0 hpk: what do you think about line count? :) * arigo downloads LLVM 1.0 too why do we need to be so fast with LLVM, is why they want to setup a public repo and we want to offer hosting it? we don't need to be hasty, right. hpk: eh. should I register to download? i just did :-) so did i :-) with real name and all :-) me too. pedronis: it cant hurt to contact them informally and see/talk about ideas i think well. it's *huge*; pedronis: if we find out that we were over-enthusiatic we have not lost much, i think pedronis: i think their project is interesting, for PyPy or not, and holger talked about offering hosting pedronis: but mostly i'm sure if llvm is well written it is excellent for PyPy pedronis: this needs to be checked and discussed of course arigo: what I'm not sure, and we should ask is how much they are interested in optimization for VHLL as opposed to C-like languages ? arigo: yup, it seems that LLVM need to extended for thing like exact GC, or some possible lookup opts for VHLL yes, i think the VHLL is supposed to do language-specific optimizations itself * sanxiyn metions Parrot... not. and only emit a low-level code that contains enough information for good low-level optimization Parrot is the only explicitly VHLL VM I know of. arigo: it seems they are interested in things like region-based memory allocation etc yes, which is fine i think arigo: which goes more in the device driver, OS kernel direction quote: The Python test classes are more UNIX-centric than they should be, so porting to non-UNIX like platforms we can have refcounted regions and garbage-collected ones (i thought it's interesting that they are using python for something :-) hpk: Many projects use Python for unittesting, but usually they have not much to do with Python. For example, svn uses Python for unittesting. sanxiyn: sure, but it's still significant information pedronis: llvm is definitely a low-level tool and BIND and whatnot Yes. It tells us they know about Python. :) arigo: yes, the point is whether they are happy extending it to support non-low-level stuff pedronis: i'm thinking about it at least as a very good alternative to C for the translator pedronis: but i think they would be happy to design some "hooks" needed for high-level languages pedronis: they don't have Java yet for example but mention wanting to look in that direction arigo: OK, so using the their static compiler? pedronis: at least pedronis: we should try to write "genllvm.py" If RPython can be translated to C, it surely can be translated to LLVM. And moreover, as Psyco do (perhaps I'm wrong here), some Applevel Python function may be able to be JITted by (LLVM or whatever). pedronis: i think the experiment is worth being made sanxiyn: yes, that's what is beyond my "at least" :-) arigo: well the experiment is cheap arigo: Will you post log and summary for binding concept and forward-dependency, constraint-based programming? sanxiyn: yes pedronis: yes topic is moving farther and farther from that. sanxiyn: i've saved the relevant parts, will edit them when i've a minute ah, ok. arigo: my issue is how much their JIT is usable and drivable at runtime, and intergation with things like GC etc arigo: OTOH yes as target of the translator, that another situation pedronis: yes for the JIT it needs more investigation pedronis: for full Psyco i'd need compilation of basic-blocks-at-a-time (not whole functions at a time) arigo: yes, I know that, is one of the thing I was wondering about I remeber Psyco does very complex things to accomplish that. pedronis: right now i'm pretty enthusiastic because the LLVM language is just the same as our flowgraphs, so we could probably at least have a JIT for RPython Oct 28 16:31:22 --> faassen (~faassen@a213-84-57-72.adsl.xs4all.nl) has joined #pypy hi martijn arigo: yes or just static compilation arigo: it seems they are investigating trace-based techniques like Dynamo pedronis: actually, i don't know many projects with a good runtime compiler that accepts an in-memory SSA representation of code hey. pedronis: this alone makes llvm interesting, for many projects that I can think about besides or on top of PyPy So LLVM is already a rare case? what really impresses me is how their website and the source code is done faassen: hi martijn hpk: hey! :) pedronis: trace techniques are nice, Psyco's profiler is a bit primitive website is impressive. I don't know C++ very well to judge the code. :( sanxiyn: trust me it's better than average :-) what website is that? :) pedronis: at this point i think we should at least consider using llvm even if we have to change a bit the C++ code to add a couple of instructions. http://llvm.cs.uiuc.edu/#subprojects ... cut at Martijn's arrival :-)