Skip to content

Commit 6b4d860

Browse files
committed
Fix JITed EEOP_AGG_INIT_TRANS, which missed some state.
The JIT compiled implementation missed maintaining AggState->{current_set,curaggcontext}. That could lead to trouble because the transition value could be allocated in the wrong context. Reported-By: Rushabh Lathia Diagnosed-By: Dmitry Dolgov Author: Dmitry Dolgov, with minor changes by me Discussion: https://postgr.es/m/CAGPqQf165-=+Drw3Voim7M5EjHT1zwPF9BQRjLFQzCzYnNZEiQ@mail.gmail.com Backpatch: 11-, where JIT compilation support was added
1 parent 86eaf20 commit 6b4d860

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/backend/jit/llvm/llvmjit_expr.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2228,6 +2228,28 @@ llvm_compile_expr(ExprState *state)
22282228

22292229
{
22302230
LLVMValueRef params[3];
2231+
LLVMValueRef v_curaggcontext;
2232+
LLVMValueRef v_current_set;
2233+
LLVMValueRef v_aggcontext;
2234+
2235+
v_aggcontext = l_ptr_const(op->d.agg_init_trans.aggcontext,
2236+
l_ptr(StructExprContext));
2237+
2238+
v_current_set =
2239+
LLVMBuildStructGEP(b,
2240+
v_aggstatep,
2241+
FIELDNO_AGGSTATE_CURRENT_SET,
2242+
"aggstate.current_set");
2243+
v_curaggcontext =
2244+
LLVMBuildStructGEP(b,
2245+
v_aggstatep,
2246+
FIELDNO_AGGSTATE_CURAGGCONTEXT,
2247+
"aggstate.curaggcontext");
2248+
2249+
LLVMBuildStore(b, l_int32_const(op->d.agg_init_trans.setno),
2250+
v_current_set);
2251+
LLVMBuildStore(b, v_aggcontext,
2252+
v_curaggcontext);
22312253

22322254
params[0] = v_aggstatep;
22332255
params[1] = v_pertransp;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy