aboutsummaryrefslogtreecommitdiff
path: root/src/backend/jit/llvm
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2018-10-15 15:24:33 -0700
committerAndres Freund <andres@anarazel.de>2018-10-15 18:23:25 -0700
commitc5257345ef61922468cd9abd887c3cb6c38792cb (patch)
treec510b809c925fba6eb0b778b53b2345ea9168e50 /src/backend/jit/llvm
parent9d906f1119de893a4ca533c5e7b97207a3aa963b (diff)
downloadpostgresql-c5257345ef61922468cd9abd887c3cb6c38792cb.tar.gz
postgresql-c5257345ef61922468cd9abd887c3cb6c38792cb.zip
Move TupleTableSlots boolean member into one flag variable.
There's several reasons for this change: 1) It reduces the total size of TupleTableSlot / reduces alignment padding, making the commonly accessed members fit into a single cacheline (but we currently do not force proper alignment, so that's not yet guaranteed to be helpful) 2) Combining the booleans into a flag allows to combine read/writes from memory. 3) With the upcoming slot abstraction changes, it allows to have core and extended flags, in a memory efficient way. Author: Ashutosh Bapat and Andres Freund Discussion: https://postgr.es/m/20180220224318.gw4oe5jadhpmcdnm@alap3.anarazel.de
Diffstat (limited to 'src/backend/jit/llvm')
-rw-r--r--src/backend/jit/llvm/llvmjit_deform.c9
-rw-r--r--src/backend/jit/llvm/llvmjit_expr.c4
2 files changed, 8 insertions, 5 deletions
diff --git a/src/backend/jit/llvm/llvmjit_deform.c b/src/backend/jit/llvm/llvmjit_deform.c
index 6d7ce21865c..59e38d2d955 100644
--- a/src/backend/jit/llvm/llvmjit_deform.c
+++ b/src/backend/jit/llvm/llvmjit_deform.c
@@ -60,7 +60,7 @@ slot_compile_deform(LLVMJitContext *context, TupleDesc desc, int natts)
LLVMValueRef v_tts_values;
LLVMValueRef v_tts_nulls;
LLVMValueRef v_slotoffp;
- LLVMValueRef v_slowp;
+ LLVMValueRef v_flagsp;
LLVMValueRef v_nvalidp;
LLVMValueRef v_nvalid;
LLVMValueRef v_maxatt;
@@ -168,7 +168,7 @@ slot_compile_deform(LLVMJitContext *context, TupleDesc desc, int natts)
"tts_ISNULL");
v_slotoffp = LLVMBuildStructGEP(b, v_slot, FIELDNO_TUPLETABLESLOT_OFF, "");
- v_slowp = LLVMBuildStructGEP(b, v_slot, FIELDNO_TUPLETABLESLOT_SLOW, "");
+ v_flagsp = LLVMBuildStructGEP(b, v_slot, FIELDNO_TUPLETABLESLOT_FLAGS, "");
v_nvalidp = LLVMBuildStructGEP(b, v_slot, FIELDNO_TUPLETABLESLOT_NVALID, "");
v_tupleheaderp =
@@ -690,11 +690,14 @@ slot_compile_deform(LLVMJitContext *context, TupleDesc desc, int natts)
{
LLVMValueRef v_off = LLVMBuildLoad(b, v_offp, "");
+ LLVMValueRef v_flags;
LLVMBuildStore(b, l_int16_const(natts), v_nvalidp);
v_off = LLVMBuildTrunc(b, v_off, LLVMInt32Type(), "");
LLVMBuildStore(b, v_off, v_slotoffp);
- LLVMBuildStore(b, l_int8_const(1), v_slowp);
+ v_flags = LLVMBuildLoad(b, v_flagsp, "tts_flags");
+ v_flags = LLVMBuildOr(b, v_flags, l_int16_const(TTS_FLAG_SLOW), "");
+ LLVMBuildStore(b, v_flags, v_flagsp);
LLVMBuildRetVoid(b);
}
diff --git a/src/backend/jit/llvm/llvmjit_expr.c b/src/backend/jit/llvm/llvmjit_expr.c
index 99e0cee157f..e5fe116acbc 100644
--- a/src/backend/jit/llvm/llvmjit_expr.c
+++ b/src/backend/jit/llvm/llvmjit_expr.c
@@ -292,7 +292,7 @@ llvm_compile_expr(ExprState *state)
if (!desc &&
is &&
is->ps_ResultTupleSlot &&
- is->ps_ResultTupleSlot->tts_fixedTupleDescriptor)
+ TTS_FIXED(is->ps_ResultTupleSlot))
desc = is->ps_ResultTupleSlot->tts_tupleDescriptor;
}
else if (opcode == EEOP_OUTER_FETCHSOME)
@@ -304,7 +304,7 @@ llvm_compile_expr(ExprState *state)
if (!desc &&
os &&
os->ps_ResultTupleSlot &&
- os->ps_ResultTupleSlot->tts_fixedTupleDescriptor)
+ TTS_FIXED(os->ps_ResultTupleSlot))
desc = os->ps_ResultTupleSlot->tts_tupleDescriptor;
}
else