diff options
author | Thomas Munro <tmunro@postgresql.org> | 2025-09-17 12:00:16 +1200 |
---|---|---|
committer | Thomas Munro <tmunro@postgresql.org> | 2025-09-17 13:38:35 +1200 |
commit | 0951942bba25f85ad29a4f096ed51a356652b5a2 (patch) | |
tree | b8a5c6c88fdfcdbf4ab19ede16518c0b9a4413c3 /src/backend/jit/llvm/llvmjit_deform.c | |
parent | 39f67d9b554fcd6dfb6c4f02a4af757eecd1fecf (diff) |
jit: Fix type used for Datum values in LLVM IR.
Commit 2a600a93 made Datum 8 bytes wide everywhere. It was no longer
appropriate to use TypeSizeT on 32 bit systems, and JIT compilation
would fail with various type check errors. Introduce a separate
LLVMTypeRef with the name TypeDatum. TypeSizeT is still used in some
places for actual size_t values.
Reported-by: Dmitry Mityugov <d.mityugov@postgrespro.ru>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Tested-by: Dmitry Mityugov <d.mityugov@postgrespro.ru>
Discussion: https://postgr.es/m/0a9f0be59171c2e8f1b3bc10f4fcf267%40postgrespro.ru
Diffstat (limited to 'src/backend/jit/llvm/llvmjit_deform.c')
-rw-r--r-- | src/backend/jit/llvm/llvmjit_deform.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/backend/jit/llvm/llvmjit_deform.c b/src/backend/jit/llvm/llvmjit_deform.c index c562edd094b..9791073faf9 100644 --- a/src/backend/jit/llvm/llvmjit_deform.c +++ b/src/backend/jit/llvm/llvmjit_deform.c @@ -479,8 +479,8 @@ slot_compile_deform(LLVMJitContext *context, TupleDesc desc, l_gep(b, LLVMInt8TypeInContext(lc), v_tts_nulls, &l_attno, 1, "")); /* store zero datum */ LLVMBuildStore(b, - l_sizet_const(0), - l_gep(b, TypeSizeT, v_tts_values, &l_attno, 1, "")); + l_datum_const(0), + l_gep(b, TypeDatum, v_tts_values, &l_attno, 1, "")); LLVMBuildBr(b, b_next); attguaranteedalign = false; @@ -644,7 +644,7 @@ slot_compile_deform(LLVMJitContext *context, TupleDesc desc, } /* compute address to store value at */ - v_resultp = l_gep(b, TypeSizeT, v_tts_values, &l_attno, 1, ""); + v_resultp = l_gep(b, TypeDatum, v_tts_values, &l_attno, 1, ""); /* store null-byte (false) */ LLVMBuildStore(b, l_int8_const(lc, 0), @@ -663,7 +663,7 @@ slot_compile_deform(LLVMJitContext *context, TupleDesc desc, v_tmp_loaddata = LLVMBuildPointerCast(b, v_attdatap, vartypep, ""); v_tmp_loaddata = l_load(b, vartype, v_tmp_loaddata, "attr_byval"); - v_tmp_loaddata = LLVMBuildZExt(b, v_tmp_loaddata, TypeSizeT, ""); + v_tmp_loaddata = LLVMBuildZExt(b, v_tmp_loaddata, TypeDatum, ""); LLVMBuildStore(b, v_tmp_loaddata, v_resultp); } @@ -675,7 +675,7 @@ slot_compile_deform(LLVMJitContext *context, TupleDesc desc, v_tmp_loaddata = LLVMBuildPtrToInt(b, v_attdatap, - TypeSizeT, + TypeDatum, "attr_ptr"); LLVMBuildStore(b, v_tmp_loaddata, v_resultp); } |