mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +03:00
Basic JIT provider and error handling infrastructure.
This commit introduces: 1) JIT provider abstraction, which allows JIT functionality to be implemented in separate shared libraries. That's desirable because it allows to install JIT support as a separate package, and because it allows experimentation with different forms of JITing. 2) JITContexts which can be, using functions introduced in follow up commits, used to emit JITed functions, and have them be cleaned up on error. 3) The outline of a LLVM JIT provider, which will be fleshed out in subsequent commits. Documentation for GUCs added, and for JIT in general, will be added in later commits. Author: Andres Freund, with architectural input from Jeff Davis Discussion: https://postgr.es/m/20170901064131.tazjxwus3k2w3ybh@alap3.anarazel.de
This commit is contained in:
51
src/include/jit/llvmjit.h
Normal file
51
src/include/jit/llvmjit.h
Normal file
@ -0,0 +1,51 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
* llvmjit.h
|
||||
* LLVM JIT provider.
|
||||
*
|
||||
* Copyright (c) 2016-2018, PostgreSQL Global Development Group
|
||||
*
|
||||
* src/include/jit/llvmjit.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef LLVMJIT_H
|
||||
#define LLVMJIT_H
|
||||
|
||||
#ifndef USE_LLVM
|
||||
#error "llvmjit.h should only be included by code dealing with llvm"
|
||||
#endif
|
||||
|
||||
#include <llvm-c/Types.h>
|
||||
|
||||
|
||||
/*
|
||||
* File needs to be includable by both C and C++ code, and include other
|
||||
* headers doing the same. Therefore wrap C portion in our own extern "C" if
|
||||
* in C++ mode.
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
|
||||
#include "jit/jit.h"
|
||||
|
||||
|
||||
typedef struct LLVMJitContext
|
||||
{
|
||||
JitContext base;
|
||||
} LLVMJitContext;
|
||||
|
||||
extern void llvm_enter_fatal_on_oom(void);
|
||||
extern void llvm_leave_fatal_on_oom(void);
|
||||
extern void llvm_reset_after_error(void);
|
||||
extern void llvm_assert_in_fatal_section(void);
|
||||
|
||||
extern LLVMJitContext *llvm_create_context(int jitFlags);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* LLVMJIT_H */
|
Reference in New Issue
Block a user