Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit b409331

Browse files
committed
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
1 parent 4717fdb commit b409331

File tree

4 files changed

+165
-136
lines changed

4 files changed

+165
-136
lines changed

src/backend/executor/execExpr.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -680,20 +680,19 @@ ExecInitExprRec(Expr *node, ExprState *state,
680680
/* regular user column */
681681
scratch.d.var.attnum = variable->varattno - 1;
682682
scratch.d.var.vartype = variable->vartype;
683-
/* select EEOP_*_FIRST opcode to force one-time checks */
684683
switch (variable->varno)
685684
{
686685
case INNER_VAR:
687-
scratch.opcode = EEOP_INNER_VAR_FIRST;
686+
scratch.opcode = EEOP_INNER_VAR;
688687
break;
689688
case OUTER_VAR:
690-
scratch.opcode = EEOP_OUTER_VAR_FIRST;
689+
scratch.opcode = EEOP_OUTER_VAR;
691690
break;
692691

693692
/* INDEX_VAR is handled by default case */
694693

695694
default:
696-
scratch.opcode = EEOP_SCAN_VAR_FIRST;
695+
scratch.opcode = EEOP_SCAN_VAR;
697696
break;
698697
}
699698
}

0 commit comments

Comments
 (0)