1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-27 23:21:58 +03:00
Files
postgres/src/include/jit/jit.h
Andres Freund 250bca7fc1 Debugging and profiling support for LLVM JIT provider.
This currently requires patches to the LLVM codebase to be
effective (submitted upstream), the GUCs are available without those
patches however.

Author: Andres Freund
Discussion: https://postgr.es/m/20170901064131.tazjxwus3k2w3ybh@alap3.anarazel.de
2018-03-22 11:07:55 -07:00

70 lines
1.6 KiB
C

/*-------------------------------------------------------------------------
* 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 "executor/instrument.h"
#include "utils/resowner.h"
/* Flags deterimining what kind of JIT operations to perform */
#define PGJIT_NONE 0
#define PGJIT_PERFORM 1 << 0
#define PGJIT_OPT3 1 << 1
typedef struct JitContext
{
/* see PGJIT_* above */
int flags;
ResourceOwner resowner;
/* number of emitted functions */
size_t created_functions;
/* accumulated time to generate code */
instr_time generation_counter;
/* accumulated time for optimization */
instr_time optimization_counter;
/* accumulated time for code emission */
instr_time emission_counter;
} 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 bool jit_debugging_support;
extern bool jit_dump_bitcode;
extern bool jit_profiling_support;
extern void jit_reset_after_error(void);
extern void jit_release_context(JitContext *context);
#endif /* JIT_H */