Skip to content

Commit fb46ac2

Browse files
committed
Expand list of synchronized types and functions in LLVM JIT provider.
Author: Andres Freund Discussion: https://postgr.es/m/20170901064131.tazjxwus3k2w3ybh@alap3.anarazel.de
1 parent feb8254 commit fb46ac2

File tree

3 files changed

+97
-1
lines changed

3 files changed

+97
-1
lines changed

src/backend/jit/llvm/llvmjit.c

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,38 @@ typedef struct LLVMJitHandle
4545

4646
/* types & functions commonly needed for JITing */
4747
LLVMTypeRef TypeSizeT;
48+
LLVMTypeRef TypePGFunction;
49+
LLVMTypeRef StructHeapTupleFieldsField3;
50+
LLVMTypeRef StructHeapTupleFields;
51+
LLVMTypeRef StructHeapTupleHeaderData;
52+
LLVMTypeRef StructHeapTupleDataChoice;
53+
LLVMTypeRef StructHeapTupleData;
54+
LLVMTypeRef StructMinimalTupleData;
55+
LLVMTypeRef StructItemPointerData;
56+
LLVMTypeRef StructBlockId;
57+
LLVMTypeRef StructFormPgAttribute;
58+
LLVMTypeRef StructTupleConstr;
59+
LLVMTypeRef StructtupleDesc;
60+
LLVMTypeRef StructTupleTableSlot;
61+
LLVMTypeRef StructMemoryContextData;
62+
LLVMTypeRef StructPGFinfoRecord;
63+
LLVMTypeRef StructFmgrInfo;
64+
LLVMTypeRef StructFunctionCallInfoData;
65+
LLVMTypeRef StructExprContext;
66+
LLVMTypeRef StructExprEvalStep;
67+
LLVMTypeRef StructExprState;
68+
LLVMTypeRef StructAggState;
69+
LLVMTypeRef StructAggStatePerGroupData;
70+
LLVMTypeRef StructAggStatePerTransData;
4871

4972
LLVMValueRef AttributeTemplate;
5073
LLVMValueRef FuncStrlen;
74+
LLVMValueRef FuncSlotGetsomeattrs;
75+
LLVMValueRef FuncHeapGetsysattr;
76+
LLVMValueRef FuncMakeExpandedObjectReadOnlyInternal;
77+
LLVMValueRef FuncExecEvalArrayRefSubscript;
78+
LLVMValueRef FuncExecAggTransReparent;
79+
LLVMValueRef FuncExecAggInitGroup;
5180

5281

5382
static bool llvm_session_initialized = false;
@@ -647,9 +676,27 @@ llvm_create_types(void)
647676
llvm_layout = pstrdup(LLVMGetDataLayoutStr(mod));
648677

649678
TypeSizeT = load_type(mod, "TypeSizeT");
679+
TypePGFunction = load_type(mod, "TypePGFunction");
680+
StructExprContext = load_type(mod, "StructExprContext");
681+
StructExprEvalStep = load_type(mod, "StructExprEvalStep");
682+
StructExprState = load_type(mod, "StructExprState");
683+
StructFunctionCallInfoData = load_type(mod, "StructFunctionCallInfoData");
684+
StructMemoryContextData = load_type(mod, "StructMemoryContextData");
685+
StructTupleTableSlot = load_type(mod, "StructTupleTableSlot");
686+
StructHeapTupleData = load_type(mod, "StructHeapTupleData");
687+
StructtupleDesc = load_type(mod, "StructtupleDesc");
688+
StructAggState = load_type(mod, "StructAggState");
689+
StructAggStatePerGroupData = load_type(mod, "StructAggStatePerGroupData");
690+
StructAggStatePerTransData = load_type(mod, "StructAggStatePerTransData");
650691

651692
AttributeTemplate = LLVMGetNamedFunction(mod, "AttributeTemplate");
652693
FuncStrlen = LLVMGetNamedFunction(mod, "strlen");
694+
FuncSlotGetsomeattrs = LLVMGetNamedFunction(mod, "slot_getsomeattrs");
695+
FuncHeapGetsysattr = LLVMGetNamedFunction(mod, "heap_getsysattr");
696+
FuncMakeExpandedObjectReadOnlyInternal = LLVMGetNamedFunction(mod, "MakeExpandedObjectReadOnlyInternal");
697+
FuncExecEvalArrayRefSubscript = LLVMGetNamedFunction(mod, "ExecEvalArrayRefSubscript");
698+
FuncExecAggTransReparent = LLVMGetNamedFunction(mod, "ExecAggTransReparent");
699+
FuncExecAggInitGroup = LLVMGetNamedFunction(mod, "ExecAggInitGroup");
653700

654701
/*
655702
* Leave the module alive, otherwise references to function would be

src/backend/jit/llvm/llvmjit_types.c

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,39 @@
2626

2727
#include "postgres.h"
2828

29+
#include "access/htup.h"
30+
#include "access/htup_details.h"
31+
#include "access/tupdesc.h"
32+
#include "catalog/pg_attribute.h"
33+
#include "executor/execExpr.h"
34+
#include "executor/nodeAgg.h"
35+
#include "executor/tuptable.h"
2936
#include "fmgr.h"
37+
#include "nodes/execnodes.h"
38+
#include "nodes/memnodes.h"
39+
#include "utils/expandeddatum.h"
40+
#include "utils/palloc.h"
41+
3042

3143
/*
3244
* List of types needed for JITing. These have to be non-static, otherwise
3345
* clang/LLVM will omit them. As this file will never be linked into
3446
* anything, that's harmless.
3547
*/
3648
size_t TypeSizeT;
49+
PGFunction TypePGFunction;
50+
51+
AggState StructAggState;
52+
AggStatePerGroupData StructAggStatePerGroupData;
53+
AggStatePerTransData StructAggStatePerTransData;
54+
ExprContext StructExprContext;
55+
ExprEvalStep StructExprEvalStep;
56+
ExprState StructExprState;
57+
FunctionCallInfoData StructFunctionCallInfoData;
58+
HeapTupleData StructHeapTupleData;
59+
MemoryContextData StructMemoryContextData;
60+
TupleTableSlot StructTupleTableSlot;
61+
struct tupleDesc StructtupleDesc;
3762

3863

3964
/*
@@ -56,5 +81,11 @@ AttributeTemplate(PG_FUNCTION_ARGS)
5681
*/
5782
void *referenced_functions[] =
5883
{
59-
strlen
84+
strlen,
85+
slot_getsomeattrs,
86+
heap_getsysattr,
87+
MakeExpandedObjectReadOnlyInternal,
88+
ExecEvalArrayRefSubscript,
89+
ExecAggTransReparent,
90+
ExecAggInitGroup
6091
};

src/include/jit/llvmjit.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,27 @@ typedef struct LLVMJitContext
5656

5757
/* type and struct definitions */
5858
extern LLVMTypeRef TypeSizeT;
59+
extern LLVMTypeRef TypePGFunction;
60+
extern LLVMTypeRef StructtupleDesc;
61+
extern LLVMTypeRef StructHeapTupleData;
62+
extern LLVMTypeRef StructTupleTableSlot;
63+
extern LLVMTypeRef StructMemoryContextData;
64+
extern LLVMTypeRef StructFunctionCallInfoData;
65+
extern LLVMTypeRef StructExprContext;
66+
extern LLVMTypeRef StructExprEvalStep;
67+
extern LLVMTypeRef StructExprState;
68+
extern LLVMTypeRef StructAggState;
69+
extern LLVMTypeRef StructAggStatePerTransData;
70+
extern LLVMTypeRef StructAggStatePerGroupData;
5971

6072
extern LLVMValueRef AttributeTemplate;
6173
extern LLVMValueRef FuncStrlen;
74+
extern LLVMValueRef FuncSlotGetsomeattrs;
75+
extern LLVMValueRef FuncHeapGetsysattr;
76+
extern LLVMValueRef FuncMakeExpandedObjectReadOnlyInternal;
77+
extern LLVMValueRef FuncExecEvalArrayRefSubscript;
78+
extern LLVMValueRef FuncExecAggTransReparent;
79+
extern LLVMValueRef FuncExecAggInitGroup;
6280

6381

6482
extern void llvm_enter_fatal_on_oom(void);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy