]> granicus.if.org Git - postgresql/commitdiff
Reset context at the tail end of JITed EEOP_AGG_PLAIN_TRANS.
authorAndres Freund <andres@anarazel.de>
Mon, 23 Jul 2018 03:31:22 +0000 (20:31 -0700)
committerAndres Freund <andres@anarazel.de>
Mon, 23 Jul 2018 03:31:22 +0000 (20:31 -0700)
While no negative consequences are currently known, it's clearly wrong
to not reset the context in one of the branches.

Reported-By: Dmitry Dolgov
Author: Dmitry Dolgov
Discussion: https://postgr.es/m/CAGPqQf165-=+Drw3Voim7M5EjHT1zwPF9BQRjLFQzCzYnNZEiQ@mail.gmail.com
Backpatch: 11-, where JIT compilation support was added

src/backend/jit/llvm/llvmjit_expr.c

index 31b03212751b3f0ec30a2d3b41049e5c9ce5f8f9..0f3109334e8e7e8b8a7dac8b34c7969a032ea131 100644 (file)
@@ -2499,6 +2499,8 @@ llvm_compile_expr(ExprState *state)
                                                /* store trans value */
                                                LLVMBuildStore(b, v_newval, v_transvaluep);
                                                LLVMBuildStore(b, v_fcinfo_isnull, v_transnullp);
+
+                                               l_mcxt_switch(mod, b, v_oldcontext);
                                                LLVMBuildBr(b, opblocks[i + 1]);
 
                                                /* returned datum passed datum, no need to reparent */