mirror of
https://github.com/postgres/postgres.git
synced 2025-05-03 22:24:49 +03:00
Expand list of synchronized types and functions in LLVM JIT provider.
Author: Andres Freund Discussion: https://postgr.es/m/20170901064131.tazjxwus3k2w3ybh@alap3.anarazel.de
This commit is contained in:
parent
feb8254518
commit
fb46ac26fe
@ -45,9 +45,38 @@ typedef struct LLVMJitHandle
|
||||
|
||||
/* types & functions commonly needed for JITing */
|
||||
LLVMTypeRef TypeSizeT;
|
||||
LLVMTypeRef TypePGFunction;
|
||||
LLVMTypeRef StructHeapTupleFieldsField3;
|
||||
LLVMTypeRef StructHeapTupleFields;
|
||||
LLVMTypeRef StructHeapTupleHeaderData;
|
||||
LLVMTypeRef StructHeapTupleDataChoice;
|
||||
LLVMTypeRef StructHeapTupleData;
|
||||
LLVMTypeRef StructMinimalTupleData;
|
||||
LLVMTypeRef StructItemPointerData;
|
||||
LLVMTypeRef StructBlockId;
|
||||
LLVMTypeRef StructFormPgAttribute;
|
||||
LLVMTypeRef StructTupleConstr;
|
||||
LLVMTypeRef StructtupleDesc;
|
||||
LLVMTypeRef StructTupleTableSlot;
|
||||
LLVMTypeRef StructMemoryContextData;
|
||||
LLVMTypeRef StructPGFinfoRecord;
|
||||
LLVMTypeRef StructFmgrInfo;
|
||||
LLVMTypeRef StructFunctionCallInfoData;
|
||||
LLVMTypeRef StructExprContext;
|
||||
LLVMTypeRef StructExprEvalStep;
|
||||
LLVMTypeRef StructExprState;
|
||||
LLVMTypeRef StructAggState;
|
||||
LLVMTypeRef StructAggStatePerGroupData;
|
||||
LLVMTypeRef StructAggStatePerTransData;
|
||||
|
||||
LLVMValueRef AttributeTemplate;
|
||||
LLVMValueRef FuncStrlen;
|
||||
LLVMValueRef FuncSlotGetsomeattrs;
|
||||
LLVMValueRef FuncHeapGetsysattr;
|
||||
LLVMValueRef FuncMakeExpandedObjectReadOnlyInternal;
|
||||
LLVMValueRef FuncExecEvalArrayRefSubscript;
|
||||
LLVMValueRef FuncExecAggTransReparent;
|
||||
LLVMValueRef FuncExecAggInitGroup;
|
||||
|
||||
|
||||
static bool llvm_session_initialized = false;
|
||||
@ -647,9 +676,27 @@ llvm_create_types(void)
|
||||
llvm_layout = pstrdup(LLVMGetDataLayoutStr(mod));
|
||||
|
||||
TypeSizeT = load_type(mod, "TypeSizeT");
|
||||
TypePGFunction = load_type(mod, "TypePGFunction");
|
||||
StructExprContext = load_type(mod, "StructExprContext");
|
||||
StructExprEvalStep = load_type(mod, "StructExprEvalStep");
|
||||
StructExprState = load_type(mod, "StructExprState");
|
||||
StructFunctionCallInfoData = load_type(mod, "StructFunctionCallInfoData");
|
||||
StructMemoryContextData = load_type(mod, "StructMemoryContextData");
|
||||
StructTupleTableSlot = load_type(mod, "StructTupleTableSlot");
|
||||
StructHeapTupleData = load_type(mod, "StructHeapTupleData");
|
||||
StructtupleDesc = load_type(mod, "StructtupleDesc");
|
||||
StructAggState = load_type(mod, "StructAggState");
|
||||
StructAggStatePerGroupData = load_type(mod, "StructAggStatePerGroupData");
|
||||
StructAggStatePerTransData = load_type(mod, "StructAggStatePerTransData");
|
||||
|
||||
AttributeTemplate = LLVMGetNamedFunction(mod, "AttributeTemplate");
|
||||
FuncStrlen = LLVMGetNamedFunction(mod, "strlen");
|
||||
FuncSlotGetsomeattrs = LLVMGetNamedFunction(mod, "slot_getsomeattrs");
|
||||
FuncHeapGetsysattr = LLVMGetNamedFunction(mod, "heap_getsysattr");
|
||||
FuncMakeExpandedObjectReadOnlyInternal = LLVMGetNamedFunction(mod, "MakeExpandedObjectReadOnlyInternal");
|
||||
FuncExecEvalArrayRefSubscript = LLVMGetNamedFunction(mod, "ExecEvalArrayRefSubscript");
|
||||
FuncExecAggTransReparent = LLVMGetNamedFunction(mod, "ExecAggTransReparent");
|
||||
FuncExecAggInitGroup = LLVMGetNamedFunction(mod, "ExecAggInitGroup");
|
||||
|
||||
/*
|
||||
* Leave the module alive, otherwise references to function would be
|
||||
|
@ -26,7 +26,19 @@
|
||||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "access/htup.h"
|
||||
#include "access/htup_details.h"
|
||||
#include "access/tupdesc.h"
|
||||
#include "catalog/pg_attribute.h"
|
||||
#include "executor/execExpr.h"
|
||||
#include "executor/nodeAgg.h"
|
||||
#include "executor/tuptable.h"
|
||||
#include "fmgr.h"
|
||||
#include "nodes/execnodes.h"
|
||||
#include "nodes/memnodes.h"
|
||||
#include "utils/expandeddatum.h"
|
||||
#include "utils/palloc.h"
|
||||
|
||||
|
||||
/*
|
||||
* List of types needed for JITing. These have to be non-static, otherwise
|
||||
@ -34,6 +46,19 @@
|
||||
* anything, that's harmless.
|
||||
*/
|
||||
size_t TypeSizeT;
|
||||
PGFunction TypePGFunction;
|
||||
|
||||
AggState StructAggState;
|
||||
AggStatePerGroupData StructAggStatePerGroupData;
|
||||
AggStatePerTransData StructAggStatePerTransData;
|
||||
ExprContext StructExprContext;
|
||||
ExprEvalStep StructExprEvalStep;
|
||||
ExprState StructExprState;
|
||||
FunctionCallInfoData StructFunctionCallInfoData;
|
||||
HeapTupleData StructHeapTupleData;
|
||||
MemoryContextData StructMemoryContextData;
|
||||
TupleTableSlot StructTupleTableSlot;
|
||||
struct tupleDesc StructtupleDesc;
|
||||
|
||||
|
||||
/*
|
||||
@ -56,5 +81,11 @@ AttributeTemplate(PG_FUNCTION_ARGS)
|
||||
*/
|
||||
void *referenced_functions[] =
|
||||
{
|
||||
strlen
|
||||
strlen,
|
||||
slot_getsomeattrs,
|
||||
heap_getsysattr,
|
||||
MakeExpandedObjectReadOnlyInternal,
|
||||
ExecEvalArrayRefSubscript,
|
||||
ExecAggTransReparent,
|
||||
ExecAggInitGroup
|
||||
};
|
||||
|
@ -56,9 +56,27 @@ typedef struct LLVMJitContext
|
||||
|
||||
/* type and struct definitions */
|
||||
extern LLVMTypeRef TypeSizeT;
|
||||
extern LLVMTypeRef TypePGFunction;
|
||||
extern LLVMTypeRef StructtupleDesc;
|
||||
extern LLVMTypeRef StructHeapTupleData;
|
||||
extern LLVMTypeRef StructTupleTableSlot;
|
||||
extern LLVMTypeRef StructMemoryContextData;
|
||||
extern LLVMTypeRef StructFunctionCallInfoData;
|
||||
extern LLVMTypeRef StructExprContext;
|
||||
extern LLVMTypeRef StructExprEvalStep;
|
||||
extern LLVMTypeRef StructExprState;
|
||||
extern LLVMTypeRef StructAggState;
|
||||
extern LLVMTypeRef StructAggStatePerTransData;
|
||||
extern LLVMTypeRef StructAggStatePerGroupData;
|
||||
|
||||
extern LLVMValueRef AttributeTemplate;
|
||||
extern LLVMValueRef FuncStrlen;
|
||||
extern LLVMValueRef FuncSlotGetsomeattrs;
|
||||
extern LLVMValueRef FuncHeapGetsysattr;
|
||||
extern LLVMValueRef FuncMakeExpandedObjectReadOnlyInternal;
|
||||
extern LLVMValueRef FuncExecEvalArrayRefSubscript;
|
||||
extern LLVMValueRef FuncExecAggTransReparent;
|
||||
extern LLVMValueRef FuncExecAggInitGroup;
|
||||
|
||||
|
||||
extern void llvm_enter_fatal_on_oom(void);
|
||||
|
Loading…
x
Reference in New Issue
Block a user