Hi Jon, On Thu, 17 Feb 2005 13:43:07 -0600 (CST) Jonathan David Riehl wrote: > Previous attempts to generate C code simply have inlined the calls the > Python VM would have made. I wonder if you aren't making things too > difficult by chosing not to leverage more of the Python C API. In > PyFront, I wanted to use type inference to move more of the data flow > into native C types.
I think that's basically what genc (the C code generator) does: It replaces the RPython code by equivalent calls to the Python C API (to the best of my knowledge: I don't really know genc very well). With genllvm I explicitely try not to use the Python C API. I don't think that that's making things too dificult: RPython is designed to make translation to a low level language easy. > This model of just generating C code that does what the Python VM would > have done has other benefits. Namely, the exception handling was simple, > even if it was done in a brute force fashion. Each Python C API call was > checked for an exception and goto's were used to goto exception handling > code when NULL was returned. Oh, I think Exception handling should be relatively easy in LLVM too since it has excellent exception support. There is an 'unwind' instruction that unwinds the stack and and 'invoke' instruction: invoke calls a function and specifies two basic blocks. If the called function returns normally, execution is continued in the first basic block. If callee (or some subsequent function) calls unwind, execution is continued in the second basic block. > Anyway, I look forward to looking at what's new here, and hopefully have > another RPython straw man (and implementation) to pitch at the PyCon > sprint. I won't come to PyCon (but maybe I can hang around on IRC, if someone wants to take a look a genllvm and has questions). Regards, Carl Friedrich _______________________________________________ pypy-dev@codespeak.net http://codespeak.net/mailman/listinfo/pypy-dev