Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit4c0000b

Browse files
committed
Handle EEOP_FUNCEXPR_[STRICT_]FUSAGE out of line.
This isn't a very common op, and it doesn't seem worth duplicating forJIT.Author: Andres Freund
1 parent5b2526c commit4c0000b

File tree

2 files changed

+63
-37
lines changed

2 files changed

+63
-37
lines changed

‎src/backend/executor/execExprInterp.c

Lines changed: 59 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -685,50 +685,17 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull)
685685

686686
EEO_CASE(EEOP_FUNCEXPR_FUSAGE)
687687
{
688-
FunctionCallInfofcinfo=op->d.func.fcinfo_data;
689-
PgStat_FunctionCallUsagefcusage;
690-
Datumd;
691-
692-
pgstat_init_function_usage(fcinfo,&fcusage);
693-
694-
fcinfo->isnull= false;
695-
d=op->d.func.fn_addr(fcinfo);
696-
*op->resvalue=d;
697-
*op->resnull=fcinfo->isnull;
698-
699-
pgstat_end_function_usage(&fcusage, true);
688+
/* not common enough to inline */
689+
ExecEvalFuncExprFusage(state,op,econtext);
700690

701691
EEO_NEXT();
702692
}
703693

704694
EEO_CASE(EEOP_FUNCEXPR_STRICT_FUSAGE)
705695
{
706-
FunctionCallInfofcinfo=op->d.func.fcinfo_data;
707-
PgStat_FunctionCallUsagefcusage;
708-
bool*argnull=fcinfo->argnull;
709-
intargno;
710-
Datumd;
696+
/* not common enough to inline */
697+
ExecEvalFuncExprStrictFusage(state,op,econtext);
711698

712-
/* strict function, so check for NULL args */
713-
for (argno=0;argno<op->d.func.nargs;argno++)
714-
{
715-
if (argnull[argno])
716-
{
717-
*op->resnull= true;
718-
gotostrictfail_fusage;
719-
}
720-
}
721-
722-
pgstat_init_function_usage(fcinfo,&fcusage);
723-
724-
fcinfo->isnull= false;
725-
d=op->d.func.fn_addr(fcinfo);
726-
*op->resvalue=d;
727-
*op->resnull=fcinfo->isnull;
728-
729-
pgstat_end_function_usage(&fcusage, true);
730-
731-
strictfail_fusage:
732699
EEO_NEXT();
733700
}
734701

@@ -2207,6 +2174,61 @@ ExecEvalStepOp(ExprState *state, ExprEvalStep *op)
22072174
* Out-of-line helper functions for complex instructions.
22082175
*/
22092176

2177+
/*
2178+
* Evaluate EEOP_FUNCEXPR_FUSAGE
2179+
*/
2180+
void
2181+
ExecEvalFuncExprFusage(ExprState*state,ExprEvalStep*op,
2182+
ExprContext*econtext)
2183+
{
2184+
FunctionCallInfofcinfo=op->d.func.fcinfo_data;
2185+
PgStat_FunctionCallUsagefcusage;
2186+
Datumd;
2187+
2188+
pgstat_init_function_usage(fcinfo,&fcusage);
2189+
2190+
fcinfo->isnull= false;
2191+
d=op->d.func.fn_addr(fcinfo);
2192+
*op->resvalue=d;
2193+
*op->resnull=fcinfo->isnull;
2194+
2195+
pgstat_end_function_usage(&fcusage, true);
2196+
}
2197+
2198+
/*
2199+
* Evaluate EEOP_FUNCEXPR_STRICT_FUSAGE
2200+
*/
2201+
void
2202+
ExecEvalFuncExprStrictFusage(ExprState*state,ExprEvalStep*op,
2203+
ExprContext*econtext)
2204+
{
2205+
2206+
FunctionCallInfofcinfo=op->d.func.fcinfo_data;
2207+
PgStat_FunctionCallUsagefcusage;
2208+
bool*argnull=fcinfo->argnull;
2209+
intargno;
2210+
Datumd;
2211+
2212+
/* strict function, so check for NULL args */
2213+
for (argno=0;argno<op->d.func.nargs;argno++)
2214+
{
2215+
if (argnull[argno])
2216+
{
2217+
*op->resnull= true;
2218+
return;
2219+
}
2220+
}
2221+
2222+
pgstat_init_function_usage(fcinfo,&fcusage);
2223+
2224+
fcinfo->isnull= false;
2225+
d=op->d.func.fn_addr(fcinfo);
2226+
*op->resvalue=d;
2227+
*op->resnull=fcinfo->isnull;
2228+
2229+
pgstat_end_function_usage(&fcusage, true);
2230+
}
2231+
22102232
/*
22112233
* Evaluate a PARAM_EXEC parameter.
22122234
*

‎src/include/executor/execExpr.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,10 @@ extern void CheckExprStillValid(ExprState *state, ExprContext *econtext);
690690
* execExprInterp.c, because that allows them to be used by other methods of
691691
* expression evaluation, reducing code duplication.
692692
*/
693+
externvoidExecEvalFuncExprFusage(ExprState*state,ExprEvalStep*op,
694+
ExprContext*econtext);
695+
externvoidExecEvalFuncExprStrictFusage(ExprState*state,ExprEvalStep*op,
696+
ExprContext*econtext);
693697
externvoidExecEvalParamExec(ExprState*state,ExprEvalStep*op,
694698
ExprContext*econtext);
695699
externvoidExecEvalParamExecParams(Bitmapset*params,EState*estate);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp