aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/execExprInterp.c
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2018-03-20 17:32:21 -0700
committerAndres Freund <andres@anarazel.de>2018-03-20 17:32:21 -0700
commit4c0000b839e6d4593e63439879b0c2abea14f426 (patch)
tree3d897cdc08dc6991bea17b4a8ea9830fde806d71 /src/backend/executor/execExprInterp.c
parent5b2526c83832e4e8a9f8db0389904ed2fb50ed37 (diff)
downloadpostgresql-4c0000b839e6d4593e63439879b0c2abea14f426.tar.gz
postgresql-4c0000b839e6d4593e63439879b0c2abea14f426.zip
Handle EEOP_FUNCEXPR_[STRICT_]FUSAGE out of line.
This isn't a very common op, and it doesn't seem worth duplicating for JIT. Author: Andres Freund
Diffstat (limited to 'src/backend/executor/execExprInterp.c')
-rw-r--r--src/backend/executor/execExprInterp.c96
1 files changed, 59 insertions, 37 deletions
diff --git a/src/backend/executor/execExprInterp.c b/src/backend/executor/execExprInterp.c
index 771b7e3945c..f7bcf6370b5 100644
--- a/src/backend/executor/execExprInterp.c
+++ b/src/backend/executor/execExprInterp.c
@@ -685,50 +685,17 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull)
EEO_CASE(EEOP_FUNCEXPR_FUSAGE)
{
- FunctionCallInfo fcinfo = op->d.func.fcinfo_data;
- PgStat_FunctionCallUsage fcusage;
- Datum d;
-
- pgstat_init_function_usage(fcinfo, &fcusage);
-
- fcinfo->isnull = false;
- d = op->d.func.fn_addr(fcinfo);
- *op->resvalue = d;
- *op->resnull = fcinfo->isnull;
-
- pgstat_end_function_usage(&fcusage, true);
+ /* not common enough to inline */
+ ExecEvalFuncExprFusage(state, op, econtext);
EEO_NEXT();
}
EEO_CASE(EEOP_FUNCEXPR_STRICT_FUSAGE)
{
- FunctionCallInfo fcinfo = op->d.func.fcinfo_data;
- PgStat_FunctionCallUsage fcusage;
- bool *argnull = fcinfo->argnull;
- int argno;
- Datum d;
+ /* not common enough to inline */
+ ExecEvalFuncExprStrictFusage(state, op, econtext);
- /* strict function, so check for NULL args */
- for (argno = 0; argno < op->d.func.nargs; argno++)
- {
- if (argnull[argno])
- {
- *op->resnull = true;
- goto strictfail_fusage;
- }
- }
-
- pgstat_init_function_usage(fcinfo, &fcusage);
-
- fcinfo->isnull = false;
- d = op->d.func.fn_addr(fcinfo);
- *op->resvalue = d;
- *op->resnull = fcinfo->isnull;
-
- pgstat_end_function_usage(&fcusage, true);
-
- strictfail_fusage:
EEO_NEXT();
}
@@ -2208,6 +2175,61 @@ ExecEvalStepOp(ExprState *state, ExprEvalStep *op)
*/
/*
+ * Evaluate EEOP_FUNCEXPR_FUSAGE
+ */
+void
+ExecEvalFuncExprFusage(ExprState *state, ExprEvalStep *op,
+ ExprContext *econtext)
+{
+ FunctionCallInfo fcinfo = op->d.func.fcinfo_data;
+ PgStat_FunctionCallUsage fcusage;
+ Datum d;
+
+ pgstat_init_function_usage(fcinfo, &fcusage);
+
+ fcinfo->isnull = false;
+ d = op->d.func.fn_addr(fcinfo);
+ *op->resvalue = d;
+ *op->resnull = fcinfo->isnull;
+
+ pgstat_end_function_usage(&fcusage, true);
+}
+
+/*
+ * Evaluate EEOP_FUNCEXPR_STRICT_FUSAGE
+ */
+void
+ExecEvalFuncExprStrictFusage(ExprState *state, ExprEvalStep *op,
+ ExprContext *econtext)
+{
+
+ FunctionCallInfo fcinfo = op->d.func.fcinfo_data;
+ PgStat_FunctionCallUsage fcusage;
+ bool *argnull = fcinfo->argnull;
+ int argno;
+ Datum d;
+
+ /* strict function, so check for NULL args */
+ for (argno = 0; argno < op->d.func.nargs; argno++)
+ {
+ if (argnull[argno])
+ {
+ *op->resnull = true;
+ return;
+ }
+ }
+
+ pgstat_init_function_usage(fcinfo, &fcusage);
+
+ fcinfo->isnull = false;
+ d = op->d.func.fn_addr(fcinfo);
+ *op->resvalue = d;
+ *op->resnull = fcinfo->isnull;
+
+ pgstat_end_function_usage(&fcusage, true);
+}
+
+/*
* Evaluate a PARAM_EXEC parameter.
*
* PARAM_EXEC params (internal executor parameters) are stored in the