Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8c27694

Browse filesBrowse files
committed
jit: Reference functions by name in IOCOERCE steps.
Previously we used constant function pointer addresses, which prevents inlining and other related optimizations. Author: Andres Freund Discussion: https://postgr.es/m/20191023163849.sosqbfs5yenocez3@alap3.anarazel.de
1 parent 1fdb7f9 commit 8c27694
Copy full SHA for 8c27694

File tree

Expand file treeCollapse file tree

1 file changed

+6
-6
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-6
lines changed

‎src/backend/jit/llvm/llvmjit_expr.c

Copy file name to clipboardExpand all lines: src/backend/jit/llvm/llvmjit_expr.c
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,10 +1261,10 @@ llvm_compile_expr(ExprState *state)
12611261
{
12621262
FunctionCallInfo fcinfo_out,
12631263
fcinfo_in;
1264+
LLVMValueRef v_fn_out,
1265+
v_fn_in;
12641266
LLVMValueRef v_fcinfo_out,
12651267
v_fcinfo_in;
1266-
LLVMValueRef v_fn_addr_out,
1267-
v_fn_addr_in;
12681268
LLVMValueRef v_fcinfo_in_isnullp;
12691269
LLVMValueRef v_retval;
12701270
LLVMValueRef v_resvalue;
@@ -1290,10 +1290,10 @@ llvm_compile_expr(ExprState *state)
12901290
b_inputcall = l_bb_before_v(opblocks[opno + 1],
12911291
"op.%d.inputcall", opno);
12921292

1293+
v_fn_out = llvm_function_reference(context, b, mod, fcinfo_out);
1294+
v_fn_in = llvm_function_reference(context, b, mod, fcinfo_in);
12931295
v_fcinfo_out = l_ptr_const(fcinfo_out, l_ptr(StructFunctionCallInfoData));
12941296
v_fcinfo_in = l_ptr_const(fcinfo_in, l_ptr(StructFunctionCallInfoData));
1295-
v_fn_addr_out = l_ptr_const(fcinfo_out->flinfo->fn_addr, TypePGFunction);
1296-
v_fn_addr_in = l_ptr_const(fcinfo_in->flinfo->fn_addr, TypePGFunction);
12971297

12981298
v_fcinfo_in_isnullp =
12991299
LLVMBuildStructGEP(b, v_fcinfo_in,
@@ -1323,7 +1323,7 @@ llvm_compile_expr(ExprState *state)
13231323
l_sbool_const(0),
13241324
l_funcnullp(b, v_fcinfo_out, 0));
13251325
/* and call output function (can never return NULL) */
1326-
v_output = LLVMBuildCall(b, v_fn_addr_out, &v_fcinfo_out,
1326+
v_output = LLVMBuildCall(b, v_fn_out, &v_fcinfo_out,
13271327
1, "funccall_coerce_out");
13281328
LLVMBuildBr(b, b_input);
13291329

@@ -1378,7 +1378,7 @@ llvm_compile_expr(ExprState *state)
13781378
/* reset fcinfo_in->isnull */
13791379
LLVMBuildStore(b, l_sbool_const(0), v_fcinfo_in_isnullp);
13801380
/* and call function */
1381-
v_retval = LLVMBuildCall(b, v_fn_addr_in, &v_fcinfo_in, 1,
1381+
v_retval = LLVMBuildCall(b, v_fn_in, &v_fcinfo_in, 1,
13821382
"funccall_iocoerce_in");
13831383

13841384
LLVMBuildStore(b, v_retval, v_resvaluep);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.