Hi hackers, While exploring the JIT support for tuple deforming process, I noticed that one check for TTSOpsVirtual in slot_compile_deform is obsolete. Since virtual tuples never need deforming and there's an assertion in llvm_compile_expr[1]. I simply replace it with an assertion in slot_compile_deform. Patch is attached.
[1] https://github.com/postgres/postgres/blob/0c60e8ba80e03491b028204a19a9dca6d216df91/src/backend/jit/llvm/llvmjit_expr.c#L322 Best Regards, Xing
From 6db602bd7d0964b60134c4b20b4107a1e8717b78 Mon Sep 17 00:00:00 2001 From: Xing Guo <higuox...@gmail.com> Date: Mon, 30 Oct 2023 22:34:10 +0800 Subject: [PATCH v1] Remove obsolete check for TTSOpsVirtual from slot_compile_deform. Since virtual tuples never need deforming and there's no EEOP_*_FETCHSOME step generated for it. We don't need to check it in slot_compile_deform. Probably we should replace it with an assertion. --- src/backend/jit/llvm/llvmjit_deform.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/backend/jit/llvm/llvmjit_deform.c b/src/backend/jit/llvm/llvmjit_deform.c index b7e88e7ca9..e652cda77f 100644 --- a/src/backend/jit/llvm/llvmjit_deform.c +++ b/src/backend/jit/llvm/llvmjit_deform.c @@ -90,9 +90,8 @@ slot_compile_deform(LLVMJitContext *context, TupleDesc desc, int attnum; - /* virtual tuples never need deforming, so don't generate code */ - if (ops == &TTSOpsVirtual) - return NULL; + /* virtual tuples never need deforming */ + Assert(ops != &TTSOpsVirtual); /* decline to JIT for slot types we don't know to handle */ if (ops != &TTSOpsHeapTuple && ops != &TTSOpsBufferHeapTuple && -- 2.42.0