diff options
author | Andres Freund <andres@anarazel.de> | 2017-12-29 12:38:15 -0800 |
---|---|---|
committer | Andres Freund <andres@anarazel.de> | 2017-12-29 12:45:25 -0800 |
commit | b40933101ca622aa8a35b6fe07ace36effadf1c7 (patch) | |
tree | 386c6c5114eacc544ad6b96e6f860c92272d1740 /src/include/executor/execExpr.h | |
parent | 4717fdb14cf0a62ffe1b1023e1c5ea8866e34fa0 (diff) | |
download | postgresql-b40933101ca622aa8a35b6fe07ace36effadf1c7.tar.gz postgresql-b40933101ca622aa8a35b6fe07ace36effadf1c7.zip |
Perform slot validity checks in a separate pass over expression.
This reduces code duplication a bit, but the primary benefit that it
makes JITing expression evaluation easier. When doing so we can't, as
previously done in the interpreted case, really change opcode without
recompiling. Nor dow we just carry around unnecessary branches to
avoid re-checking over and over.
As a minor side-effect this makes ExecEvalStepOp() O(log(N)) rather
than O(N).
Author: Andres Freund
Discussion: https://postgr.es/m/20170901064131.tazjxwus3k2w3ybh@alap3.anarazel.de
Diffstat (limited to 'src/include/executor/execExpr.h')
-rw-r--r-- | src/include/executor/execExpr.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/include/executor/execExpr.h b/src/include/executor/execExpr.h index 080252fad60..511205b5acc 100644 --- a/src/include/executor/execExpr.h +++ b/src/include/executor/execExpr.h @@ -51,12 +51,8 @@ typedef enum ExprEvalOp EEOP_SCAN_FETCHSOME, /* compute non-system Var value */ - /* "FIRST" variants are used only the first time through */ - EEOP_INNER_VAR_FIRST, EEOP_INNER_VAR, - EEOP_OUTER_VAR_FIRST, EEOP_OUTER_VAR, - EEOP_SCAN_VAR_FIRST, EEOP_SCAN_VAR, /* compute system Var value */ @@ -67,8 +63,11 @@ typedef enum ExprEvalOp /* compute wholerow Var */ EEOP_WHOLEROW, - /* compute non-system Var value, assign it into ExprState's resultslot */ - /* (these are not used if _FIRST checks would be needed) */ + /* + * Compute non-system Var value, assign it into ExprState's + * resultslot. These are not used if a CheckVarSlotCompatibility() check + * would be needed. + */ EEOP_ASSIGN_INNER_VAR, EEOP_ASSIGN_OUTER_VAR, EEOP_ASSIGN_SCAN_VAR, @@ -621,6 +620,9 @@ extern void ExprEvalPushStep(ExprState *es, const ExprEvalStep *s); extern void ExecReadyInterpretedExpr(ExprState *state); extern ExprEvalOp ExecEvalStepOp(ExprState *state, ExprEvalStep *op); +extern Datum ExecInterpExprStillValid(ExprState *state, ExprContext *econtext, bool *isNull); +extern void CheckExprStillValid(ExprState *state, ExprContext *econtext); + /* * Non fast-path execution functions. These are externs instead of statics in * execExprInterp.c, because that allows them to be used by other methods of |