forked from pool/postgresql12
OBS-URL: https://build.opensuse.org/package/show/server:database:postgresql/postgresql12?expand=0&rev=52
This commit is contained in:
parent
9728ec8991
commit
f596acf83c
@ -12,18 +12,23 @@ causes the JIT to fail at runtime.
|
|||||||
src/backend/jit/llvm/llvmjit.c | 46 ++++++++++++++++++++++++++++++++--
|
src/backend/jit/llvm/llvmjit.c | 46 ++++++++++++++++++++++++++++++++--
|
||||||
1 file changed, 44 insertions(+), 2 deletions(-)
|
1 file changed, 44 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
diff --git a/src/backend/jit/llvm/llvmjit.c b/src/backend/jit/llvm/llvmjit.c
|
--- src/backend/jit/llvm/llvmjit.c.orig
|
||||||
index 98a27f08bf..05b6438ba8 100644
|
+++ src/backend/jit/llvm/llvmjit.c
|
||||||
--- a/src/backend/jit/llvm/llvmjit.c
|
@@ -101,6 +101,7 @@ LLVMValueRef FuncExecEvalSysVar;
|
||||||
+++ b/src/backend/jit/llvm/llvmjit.c
|
LLVMValueRef FuncExecAggTransReparent;
|
||||||
@@ -776,6 +776,35 @@ llvm_compile_module(LLVMJitContext *context)
|
LLVMValueRef FuncExecAggInitGroup;
|
||||||
errhidecontext(true)));
|
|
||||||
|
+LLVMModuleRef mod = NULL;
|
||||||
|
|
||||||
|
static bool llvm_session_initialized = false;
|
||||||
|
static size_t llvm_generation = 0;
|
||||||
|
@@ -742,6 +743,35 @@ llvm_compile_module(LLVMJitContext *cont
|
||||||
}
|
}
|
||||||
|
|
||||||
+/*
|
/*
|
||||||
+ * For the systemz target, LLVM uses a different datalayout for z13 and newer
|
+ * For the systemz target, LLVM uses a different datalayout for z13 and newer
|
||||||
+ * CPUs than it does for older CPUs. This can cause a mismatch in datalayouts
|
+ * CPUs than it does for older CPUs. This can cause a mismatch in datalayouts
|
||||||
+ * in the case where the llvm_types_module is compiled with a pre-z13 CPU
|
+ * in the case where the llvm_types_module (mod) is compiled with a pre-z13 CPU
|
||||||
+ * and the JIT is running on z13 or newer.
|
+ * and the JIT is running on z13 or newer.
|
||||||
+ * See computeDataLayout() function in
|
+ * See computeDataLayout() function in
|
||||||
+ * llvm/lib/Target/SystemZ/SystemZTargetMachine.cpp for information on the
|
+ * llvm/lib/Target/SystemZ/SystemZTargetMachine.cpp for information on the
|
||||||
@ -41,7 +46,7 @@ index 98a27f08bf..05b6438ba8 100644
|
|||||||
+ return false;
|
+ return false;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ llvm_context = LLVMGetModuleContext(llvm_types_module);
|
+ llvm_context = LLVMGetModuleContext(mod);
|
||||||
+ vec_type = LLVMVectorType(LLVMIntTypeInContext(llvm_context, 32), 4);
|
+ vec_type = LLVMVectorType(LLVMIntTypeInContext(llvm_context, 32), 4);
|
||||||
+ llvm_layoutref = LLVMCreateTargetData(llvm_layout);
|
+ llvm_layoutref = LLVMCreateTargetData(llvm_layout);
|
||||||
+ ret = (LLVMABIAlignmentOfType(llvm_layoutref, vec_type) == 16);
|
+ ret = (LLVMABIAlignmentOfType(llvm_layoutref, vec_type) == 16);
|
||||||
@ -49,10 +54,11 @@ index 98a27f08bf..05b6438ba8 100644
|
|||||||
+ return ret;
|
+ return ret;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
/*
|
+/*
|
||||||
* Per session initialization.
|
* Per session initialization.
|
||||||
*/
|
*/
|
||||||
@@ -785,6 +814,7 @@ llvm_session_initialize(void)
|
static void
|
||||||
|
@@ -750,6 +780,7 @@ llvm_session_initialize(void)
|
||||||
MemoryContext oldcontext;
|
MemoryContext oldcontext;
|
||||||
char *error = NULL;
|
char *error = NULL;
|
||||||
char *cpu = NULL;
|
char *cpu = NULL;
|
||||||
@ -60,7 +66,7 @@ index 98a27f08bf..05b6438ba8 100644
|
|||||||
char *features = NULL;
|
char *features = NULL;
|
||||||
LLVMTargetMachineRef opt0_tm;
|
LLVMTargetMachineRef opt0_tm;
|
||||||
LLVMTargetMachineRef opt3_tm;
|
LLVMTargetMachineRef opt3_tm;
|
||||||
@@ -816,10 +846,17 @@ llvm_session_initialize(void)
|
@@ -781,10 +812,17 @@ llvm_session_initialize(void)
|
||||||
* features not all CPUs have (weird, huh).
|
* features not all CPUs have (weird, huh).
|
||||||
*/
|
*/
|
||||||
cpu = LLVMGetHostCPUName();
|
cpu = LLVMGetHostCPUName();
|
||||||
@ -79,7 +85,7 @@ index 98a27f08bf..05b6438ba8 100644
|
|||||||
opt0_tm =
|
opt0_tm =
|
||||||
LLVMCreateTargetMachine(llvm_targetref, llvm_triple, cpu, features,
|
LLVMCreateTargetMachine(llvm_targetref, llvm_triple, cpu, features,
|
||||||
LLVMCodeGenLevelNone,
|
LLVMCodeGenLevelNone,
|
||||||
@@ -833,8 +870,13 @@ llvm_session_initialize(void)
|
@@ -798,8 +836,13 @@ llvm_session_initialize(void)
|
||||||
|
|
||||||
LLVMDisposeMessage(cpu);
|
LLVMDisposeMessage(cpu);
|
||||||
cpu = NULL;
|
cpu = NULL;
|
||||||
@ -94,6 +100,11 @@ index 98a27f08bf..05b6438ba8 100644
|
|||||||
|
|
||||||
/* force symbols in main binary to be loaded */
|
/* force symbols in main binary to be loaded */
|
||||||
LLVMLoadLibraryPermanently(NULL);
|
LLVMLoadLibraryPermanently(NULL);
|
||||||
--
|
@@ -952,7 +995,6 @@ llvm_create_types(void)
|
||||||
2.27.0
|
char path[MAXPGPATH];
|
||||||
|
LLVMMemoryBufferRef buf;
|
||||||
|
char *msg;
|
||||||
|
- LLVMModuleRef mod = NULL;
|
||||||
|
|
||||||
|
snprintf(path, MAXPGPATH, "%s/%s", pkglib_path, "llvmjit_types.bc");
|
||||||
|
|
||||||
|
@ -457,7 +457,7 @@ touch -r configure tmp
|
|||||||
%patch9
|
%patch9
|
||||||
%if %{with llvm}
|
%if %{with llvm}
|
||||||
%patch10
|
%patch10
|
||||||
%patch11 -p1
|
%patch11
|
||||||
%endif
|
%endif
|
||||||
touch -r tmp configure
|
touch -r tmp configure
|
||||||
rm tmp
|
rm tmp
|
||||||
|
Loading…
x
Reference in New Issue
Block a user