Don't codegen deform code for virtual tuples in expr eval for scan fetch

From: Soumyadeep Chakraborty <soumyadeep2007(at)gmail(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Don't codegen deform code for virtual tuples in expr eval for scan fetch
Date: 2019-09-18 06:54:51
Message-ID: CAE-ML+_66cVe1N_VBRXHwhqdPx+nJ2g=5fOpVZX_uO_M5Xb0GA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello Hackers,

This is to address a TODO I found in the JIT expression evaluation
code (opcode =
EEOP_INNER_FETCHSOME/EEOP_OUTER_FETCHSOME/EEOP_SCAN_FETCHSOME):

* TODO: skip nvalid check if slot is fixed and known to
* be a virtual slot.

Not only should we skip the nvalid check if the tuple is virtual, the
whole basic block should be a no-op. There is no deforming to be done,
JIT (slot_compile_deform) or otherwise (slot_getsomeattrs) for virtual
tuples.

Attached is a patch 0001 that achieves exactly that by:

1. Performing the check at the very beginning of the case.
2. Emitting an unconditional branch to the next opblock if we have a
virtual tuple. We end up with a block with just the single
unconditional branch instruction in this case. This block is optimized
away when we run llvm_optimize_module().

Also enclosed is another patch 0002 that adds on some minor
refactoring of conditionals around whether to JIT deform or not.

---
Soumyadeep Chakraborty

Attachment Content-Type Size
0001-Don-t-codegen-if-tuple-is-virtual-in-expr-eval-of-sc.patch application/octet-stream 1.7 KB
0002-Minor-refactor-JIT-deform-or-not.patch application/octet-stream 1.7 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro Horiguchi 2019-09-18 07:27:46 Re: Efficient output for integer types
Previous Message Amit Khandekar 2019-09-18 06:54:50 Re: logical decoding : exceeded maxAllocatedDescs for .spill files