Skip to content

Commit a598708

Browse files
committed
Change TupleTableSlot->tts_nvalid to type AttrNumber.
Previously it was an int / 4 bytes. The maximum number of attributes in a tuple is restricted by the maximum value Var->varattno, which is an AttrNumber/int16. Hence use the same data type for TupleTableSlot->tts_nvalid. Author: Ashutosh Bapat Discussion: https://postgr.es/m/20180220224318.gw4oe5jadhpmcdnm@alap3.anarazel.de
1 parent 5913b9b commit a598708

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/backend/jit/llvm/llvmjit_deform.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ slot_compile_deform(LLVMJitContext *context, TupleDesc desc, int natts)
304304

305305
for (attnum = 0; attnum < natts; attnum++)
306306
{
307-
LLVMValueRef v_attno = l_int32_const(attnum);
307+
LLVMValueRef v_attno = l_int16_const(attnum);
308308

309309
LLVMAddCase(v_switch, v_attno, attcheckattnoblocks[attnum]);
310310
}
@@ -691,7 +691,7 @@ slot_compile_deform(LLVMJitContext *context, TupleDesc desc, int natts)
691691
{
692692
LLVMValueRef v_off = LLVMBuildLoad(b, v_offp, "");
693693

694-
LLVMBuildStore(b, l_int32_const(natts), v_nvalidp);
694+
LLVMBuildStore(b, l_int16_const(natts), v_nvalidp);
695695
v_off = LLVMBuildTrunc(b, v_off, LLVMInt32Type(), "");
696696
LLVMBuildStore(b, v_off, v_slotoffp);
697697
LLVMBuildStore(b, l_int8_const(1), v_slowp);

src/backend/jit/llvm/llvmjit_expr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ llvm_compile_expr(ExprState *state)
324324
"");
325325
LLVMBuildCondBr(b,
326326
LLVMBuildICmp(b, LLVMIntUGE, v_nvalid,
327-
l_int32_const(op->d.fetch.last_var),
327+
l_int16_const(op->d.fetch.last_var),
328328
""),
329329
opblocks[i + 1], b_fetch);
330330

src/include/executor/tuptable.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ typedef struct TupleTableSlot
125125
MemoryContext tts_mcxt; /* slot itself is in this context */
126126
Buffer tts_buffer; /* tuple's buffer, or InvalidBuffer */
127127
#define FIELDNO_TUPLETABLESLOT_NVALID 9
128-
int tts_nvalid; /* # of valid values in tts_values */
128+
AttrNumber tts_nvalid; /* # of valid values in tts_values */
129129
#define FIELDNO_TUPLETABLESLOT_VALUES 10
130130
Datum *tts_values; /* current per-attribute values */
131131
#define FIELDNO_TUPLETABLESLOT_ISNULL 11

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