@@ -155,11 +155,11 @@ static void ExecEvalRowNullInt(ExprState *state, ExprEvalStep *op,
155
155
static Datum ExecJustInnerVar (ExprState * state , ExprContext * econtext , bool * isnull );
156
156
static Datum ExecJustOuterVar (ExprState * state , ExprContext * econtext , bool * isnull );
157
157
static Datum ExecJustScanVar (ExprState * state , ExprContext * econtext , bool * isnull );
158
- static Datum ExecJustConst (ExprState * state , ExprContext * econtext , bool * isnull );
159
158
static Datum ExecJustAssignInnerVar (ExprState * state , ExprContext * econtext , bool * isnull );
160
159
static Datum ExecJustAssignOuterVar (ExprState * state , ExprContext * econtext , bool * isnull );
161
160
static Datum ExecJustAssignScanVar (ExprState * state , ExprContext * econtext , bool * isnull );
162
161
static Datum ExecJustApplyFuncToCase (ExprState * state , ExprContext * econtext , bool * isnull );
162
+ static Datum ExecJustConst (ExprState * state , ExprContext * econtext , bool * isnull );
163
163
164
164
165
165
/*
@@ -1966,13 +1966,12 @@ ShutdownTupleDescRef(Datum arg)
1966
1966
* Fast-path functions, for very simple expressions
1967
1967
*/
1968
1968
1969
- /* Simple reference to inner Var */
1970
- static Datum
1971
- ExecJustInnerVar (ExprState * state , ExprContext * econtext , bool * isnull )
1969
+ /* implementation of ExecJust(Inner|Outer|Scan) Var */
1970
+ static pg_attribute_always_inline Datum
1971
+ ExecJustVarImpl (ExprState * state , TupleTableSlot * slot , bool * isnull )
1972
1972
{
1973
1973
ExprEvalStep * op = & state -> steps [1 ];
1974
1974
int attnum = op -> d .var .attnum + 1 ;
1975
- TupleTableSlot * slot = econtext -> ecxt_innertuple ;
1976
1975
1977
1976
CheckOpSlotCompatibility (& state -> steps [0 ], slot );
1978
1977
@@ -1984,52 +1983,34 @@ ExecJustInnerVar(ExprState *state, ExprContext *econtext, bool *isnull)
1984
1983
return slot_getattr (slot , attnum , isnull );
1985
1984
}
1986
1985
1987
- /* Simple reference to outer Var */
1986
+ /* Simple reference to inner Var */
1988
1987
static Datum
1989
- ExecJustOuterVar (ExprState * state , ExprContext * econtext , bool * isnull )
1988
+ ExecJustInnerVar (ExprState * state , ExprContext * econtext , bool * isnull )
1990
1989
{
1991
- ExprEvalStep * op = & state -> steps [1 ];
1992
- int attnum = op -> d .var .attnum + 1 ;
1993
- TupleTableSlot * slot = econtext -> ecxt_outertuple ;
1994
-
1995
- CheckOpSlotCompatibility (& state -> steps [0 ], slot );
1996
-
1997
- /* See comments in ExecJustInnerVar */
1998
- return slot_getattr (slot , attnum , isnull );
1990
+ return ExecJustVarImpl (state , econtext -> ecxt_innertuple , isnull );
1999
1991
}
2000
1992
2001
- /* Simple reference to scan Var */
1993
+ /* Simple reference to outer Var */
2002
1994
static Datum
2003
- ExecJustScanVar (ExprState * state , ExprContext * econtext , bool * isnull )
1995
+ ExecJustOuterVar (ExprState * state , ExprContext * econtext , bool * isnull )
2004
1996
{
2005
- ExprEvalStep * op = & state -> steps [1 ];
2006
- int attnum = op -> d .var .attnum + 1 ;
2007
- TupleTableSlot * slot = econtext -> ecxt_scantuple ;
2008
-
2009
- CheckOpSlotCompatibility (& state -> steps [0 ], slot );
2010
-
2011
- /* See comments in ExecJustInnerVar */
2012
- return slot_getattr (slot , attnum , isnull );
1997
+ return ExecJustVarImpl (state , econtext -> ecxt_outertuple , isnull );
2013
1998
}
2014
1999
2015
- /* Simple Const expression */
2000
+ /* Simple reference to scan Var */
2016
2001
static Datum
2017
- ExecJustConst (ExprState * state , ExprContext * econtext , bool * isnull )
2002
+ ExecJustScanVar (ExprState * state , ExprContext * econtext , bool * isnull )
2018
2003
{
2019
- ExprEvalStep * op = & state -> steps [0 ];
2020
-
2021
- * isnull = op -> d .constval .isnull ;
2022
- return op -> d .constval .value ;
2004
+ return ExecJustVarImpl (state , econtext -> ecxt_scantuple , isnull );
2023
2005
}
2024
2006
2025
- /* Evaluate inner Var and assign to appropriate column of result tuple */
2026
- static Datum
2027
- ExecJustAssignInnerVar (ExprState * state , ExprContext * econtext , bool * isnull )
2007
+ /* implementation of ExecJustAssign(Inner|Outer|Scan)Var */
2008
+ static pg_attribute_always_inline Datum
2009
+ ExecJustAssignVarImpl (ExprState * state , TupleTableSlot * inslot , bool * isnull )
2028
2010
{
2029
2011
ExprEvalStep * op = & state -> steps [1 ];
2030
2012
int attnum = op -> d .assign_var .attnum + 1 ;
2031
2013
int resultnum = op -> d .assign_var .resultnum ;
2032
- TupleTableSlot * inslot = econtext -> ecxt_innertuple ;
2033
2014
TupleTableSlot * outslot = state -> resultslot ;
2034
2015
2035
2016
CheckOpSlotCompatibility (& state -> steps [0 ], inslot );
@@ -2047,40 +2028,25 @@ ExecJustAssignInnerVar(ExprState *state, ExprContext *econtext, bool *isnull)
2047
2028
return 0 ;
2048
2029
}
2049
2030
2031
+ /* Evaluate inner Var and assign to appropriate column of result tuple */
2032
+ static Datum
2033
+ ExecJustAssignInnerVar (ExprState * state , ExprContext * econtext , bool * isnull )
2034
+ {
2035
+ return ExecJustAssignVarImpl (state , econtext -> ecxt_innertuple , isnull );
2036
+ }
2037
+
2050
2038
/* Evaluate outer Var and assign to appropriate column of result tuple */
2051
2039
static Datum
2052
2040
ExecJustAssignOuterVar (ExprState * state , ExprContext * econtext , bool * isnull )
2053
2041
{
2054
- ExprEvalStep * op = & state -> steps [1 ];
2055
- int attnum = op -> d .assign_var .attnum + 1 ;
2056
- int resultnum = op -> d .assign_var .resultnum ;
2057
- TupleTableSlot * inslot = econtext -> ecxt_outertuple ;
2058
- TupleTableSlot * outslot = state -> resultslot ;
2059
-
2060
- CheckOpSlotCompatibility (& state -> steps [0 ], inslot );
2061
-
2062
- /* See comments in ExecJustAssignInnerVar */
2063
- outslot -> tts_values [resultnum ] =
2064
- slot_getattr (inslot , attnum , & outslot -> tts_isnull [resultnum ]);
2065
- return 0 ;
2042
+ return ExecJustAssignVarImpl (state , econtext -> ecxt_outertuple , isnull );
2066
2043
}
2067
2044
2068
2045
/* Evaluate scan Var and assign to appropriate column of result tuple */
2069
2046
static Datum
2070
2047
ExecJustAssignScanVar (ExprState * state , ExprContext * econtext , bool * isnull )
2071
2048
{
2072
- ExprEvalStep * op = & state -> steps [1 ];
2073
- int attnum = op -> d .assign_var .attnum + 1 ;
2074
- int resultnum = op -> d .assign_var .resultnum ;
2075
- TupleTableSlot * inslot = econtext -> ecxt_scantuple ;
2076
- TupleTableSlot * outslot = state -> resultslot ;
2077
-
2078
- CheckOpSlotCompatibility (& state -> steps [0 ], inslot );
2079
-
2080
- /* See comments in ExecJustAssignInnerVar */
2081
- outslot -> tts_values [resultnum ] =
2082
- slot_getattr (inslot , attnum , & outslot -> tts_isnull [resultnum ]);
2083
- return 0 ;
2049
+ return ExecJustAssignVarImpl (state , econtext -> ecxt_scantuple , isnull );
2084
2050
}
2085
2051
2086
2052
/* Evaluate CASE_TESTVAL and apply a strict function to it */
@@ -2120,6 +2086,16 @@ ExecJustApplyFuncToCase(ExprState *state, ExprContext *econtext, bool *isnull)
2120
2086
return d ;
2121
2087
}
2122
2088
2089
+ /* Simple Const expression */
2090
+ static Datum
2091
+ ExecJustConst (ExprState * state , ExprContext * econtext , bool * isnull )
2092
+ {
2093
+ ExprEvalStep * op = & state -> steps [0 ];
2094
+
2095
+ * isnull = op -> d .constval .isnull ;
2096
+ return op -> d .constval .value ;
2097
+ }
2098
+
2123
2099
#if defined(EEO_USE_COMPUTED_GOTO )
2124
2100
/*
2125
2101
* Comparator used when building address->opcode lookup table for
0 commit comments