diff options
author | Andres Freund | 2018-11-16 06:00:30 +0000 |
---|---|---|
committer | Andres Freund | 2018-11-16 06:00:30 +0000 |
commit | 7ef04e4d2cb287e4e28b87f24b4b36ef4e07530b (patch) | |
tree | e878bcae3a3007b491525796a45f26b9b6655938 /src | |
parent | 15d8f83128e15de97de61430d0b9569f5ebecc26 (diff) |
Don't generate tuple deforming functions for virtual slots.
Virtual tuple table slots never need tuple deforming. Therefore, if we
know at expression compilation time, that a certain slot will always
be virtual, there's no need to create a tuple deforming routine for
it.
Author: Andres Freund
Discussion: https://postgr.es/m/[email protected]
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/jit/llvm/llvmjit_deform.c | 7 | ||||
-rw-r--r-- | src/backend/jit/llvm/llvmjit_expr.c | 1 | ||||
-rw-r--r-- | src/include/jit/llvmjit.h | 4 |
3 files changed, 10 insertions, 2 deletions
diff --git a/src/backend/jit/llvm/llvmjit_deform.c b/src/backend/jit/llvm/llvmjit_deform.c index 59e38d2d955..938dfc73361 100644 --- a/src/backend/jit/llvm/llvmjit_deform.c +++ b/src/backend/jit/llvm/llvmjit_deform.c @@ -31,7 +31,8 @@ * Create a function that deforms a tuple of type desc up to natts columns. */ LLVMValueRef -slot_compile_deform(LLVMJitContext *context, TupleDesc desc, int natts) +slot_compile_deform(LLVMJitContext *context, TupleDesc desc, + const TupleTableSlotOps *ops, int natts) { char *funcname; @@ -88,6 +89,10 @@ slot_compile_deform(LLVMJitContext *context, TupleDesc desc, int natts) int attnum; + /* virtual tuples never need deforming, so don't generate code */ + if (ops == &TTSOpsVirtual) + return NULL; + mod = llvm_mutable_module(context); funcname = llvm_expand_funcname(context, "deform"); diff --git a/src/backend/jit/llvm/llvmjit_expr.c b/src/backend/jit/llvm/llvmjit_expr.c index be9b2aecffe..4cee35f582c 100644 --- a/src/backend/jit/llvm/llvmjit_expr.c +++ b/src/backend/jit/llvm/llvmjit_expr.c @@ -324,6 +324,7 @@ llvm_compile_expr(ExprState *state) { l_jit_deform = slot_compile_deform(context, desc, + tts_ops, op->d.fetch.last_var); } diff --git a/src/include/jit/llvmjit.h b/src/include/jit/llvmjit.h index f3ea2492835..3eae5e68319 100644 --- a/src/include/jit/llvmjit.h +++ b/src/include/jit/llvmjit.h @@ -111,7 +111,9 @@ extern void llvm_inline(LLVMModuleRef mod); **************************************************************************** */ extern bool llvm_compile_expr(struct ExprState *state); -extern LLVMValueRef slot_compile_deform(struct LLVMJitContext *context, TupleDesc desc, int natts); +struct TupleTableSlotOps; +extern LLVMValueRef slot_compile_deform(struct LLVMJitContext *context, TupleDesc desc, + const struct TupleTableSlotOps *ops, int natts); /* **************************************************************************** |