Andres Freund writes: > The problem is that the previous form has a lot of ad-hoc analysis > strewn in. The interesting part is getting rid of all that. That's what > the new ExecInitExpr2() does. The target form can be both evaluated more > efficiently in the dispatch manner in the patch, and quite simply > converted to a JIT - without duplicating the analysis code. I did write > a small ad-hoc x86 jit, and it was really quite straightforward this > way.
Ja, I see the advantage when doing ad-hoc-JIT compilation. > What did you do with JIT and expression evaluation? You basically just > replaced the toplevel ExprState note with a different evalfunc, pointing > into your code? That's the plan, yes. I'm sorry there's no publishable code yet on the the postgres side of things. Using libFirm, the plan is to. 1. Automatically generate Firm-IR for the static C code around expression evaluation as well operators in the system catalog. 2. Construct IR for expression trees (essentially all the function calls the executor would do). 3. Push libFirm's optimize button. At this stage, most of the dispatching goes away by inlining the calls including functions from the catalog implementing operators. 4. Generate code and replace the toplevel expression node with a funcall node. I did implement this recipe with a toy Forth interpreter to see whether libFirm was up to the job (Nobody's done JIT with libFirm before). The results were favorable. Currently, a student at credativ is working on applying these techniques to postgres. regards, Andreas Footnotes:  http://libfirm.org/  https://korte.credativ.com/~ase/firm-postgres-jit-forth.pdf -- Sent via pgsql-hackers mailing list (firstname.lastname@example.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers