mirror of
https://github.com/postgres/postgres.git
synced 2025-06-25 01:02:05 +03:00
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
This commit is contained in:
@ -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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user