1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-19 15:49:24 +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:
Andres Freund
2018-03-21 19:28:28 -07:00
parent 4317cc68a2
commit 432bb9e04d
18 changed files with 679 additions and 2 deletions

46
src/include/jit/jit.h Normal file
View File

@@ -0,0 +1,46 @@
/*-------------------------------------------------------------------------
* jit.h
* Provider independent JIT infrastructure.
*
* Copyright (c) 2016-2018, PostgreSQL Global Development Group
*
* src/include/jit/jit.h
*
*-------------------------------------------------------------------------
*/
#ifndef JIT_H
#define JIT_H
#include "utils/resowner.h"
typedef struct JitContext
{
int flags;
ResourceOwner resowner;
} JitContext;
typedef struct JitProviderCallbacks JitProviderCallbacks;
extern void _PG_jit_provider_init(JitProviderCallbacks *cb);
typedef void (*JitProviderInit) (JitProviderCallbacks *cb);
typedef void (*JitProviderResetAfterErrorCB) (void);
typedef void (*JitProviderReleaseContextCB) (JitContext *context);
struct JitProviderCallbacks
{
JitProviderResetAfterErrorCB reset_after_error;
JitProviderReleaseContextCB release_context;
};
/* GUCs */
extern bool jit_enabled;
extern char *jit_provider;
extern void jit_reset_after_error(void);
extern void jit_release_context(JitContext *context);
#endif /* JIT_H */