[Tarantool-patches] [PATCH v2 2/4] sql: drop unnecessary P2 register for OP_AggFinal

imeevma at tarantool.org imeevma at tarantool.org
Thu Feb 10 12:14:13 MSK 2022


---
 src/box/sql/select.c |  4 +---
 src/box/sql/vdbe.c   | 17 +++++------------
 2 files changed, 6 insertions(+), 15 deletions(-)

diff --git a/src/box/sql/select.c b/src/box/sql/select.c
index b532cac4e..6159a9670 100644
--- a/src/box/sql/select.c
+++ b/src/box/sql/select.c
@@ -5573,10 +5573,8 @@ finalizeAggFunctions(Parse * pParse, AggInfo * pAggInfo)
 	int i;
 	struct AggInfo_func *pF;
 	for (i = 0, pF = pAggInfo->aFunc; i < pAggInfo->nFunc; i++, pF++) {
-		ExprList *pList = pF->pExpr->x.pList;
 		assert(!ExprHasProperty(pF->pExpr, EP_xIsSelect));
-		sqlVdbeAddOp2(v, OP_AggFinal, pF->iMem,
-				  pList ? pList->nExpr : 0);
+		sqlVdbeAddOp1(v, OP_AggFinal, pF->iMem);
 		sqlVdbeAppendP4(v, pF->func, P4_FUNC);
 	}
 }
diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c
index 24cb28260..c095bb833 100644
--- a/src/box/sql/vdbe.c
+++ b/src/box/sql/vdbe.c
@@ -4190,18 +4190,11 @@ case OP_AggStep: {
 	break;
 }
 
-/* Opcode: AggFinal P1 P2 * P4 *
- * Synopsis: accum=r[P1] N=P2
- *
- * Execute the finalizer function for an aggregate.  P1 is
- * the memory location that is the accumulator for the aggregate.
- *
- * P2 is the number of arguments that the step function takes and
- * P4 is a pointer to the FuncDef for this function.  The P2
- * argument is not used by this opcode.  It is only there to disambiguate
- * functions that can take varying numbers of arguments.  The
- * P4 argument is only needed for the degenerate case where
- * the step function was not previously called.
+/* Opcode: AggFinal P1 * * P4 *
+ * Synopsis: accum=r[P1]
+ *
+ * Execute the finalizer function for an aggregate. P1 is the memory location
+ * that is the accumulator for the aggregate. P4 is a pointer to the function.
  */
 case OP_AggFinal: {
 	assert(pOp->p1>0 && pOp->p1<=(p->nMem+1 - p->nCursor));
-- 
2.25.1



More information about the Tarantool-patches mailing list