LCOV - code coverage report
Current view: top level - monetdb5/optimizer - opt_candidates.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 56 56 100.0 %
Date: 2024-04-25 20:03:45 Functions: 1 1 100.0 %

          Line data    Source code
       1             : /*
       2             :  * SPDX-License-Identifier: MPL-2.0
       3             :  *
       4             :  * This Source Code Form is subject to the terms of the Mozilla Public
       5             :  * License, v. 2.0.  If a copy of the MPL was not distributed with this
       6             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       7             :  *
       8             :  * Copyright 2024 MonetDB Foundation;
       9             :  * Copyright August 2008 - 2023 MonetDB B.V.;
      10             :  * Copyright 1997 - July 2008 CWI.
      11             :  */
      12             : 
      13             : /*
      14             :  * Mark the production and use of candidate lists.
      15             :  */
      16             : 
      17             : #include "monetdb_config.h"
      18             : #include "mal_instruction.h"
      19             : #include "opt_candidates.h"
      20             : 
      21             : str
      22      435666 : OPTcandidatesImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
      23             :                                                         InstrPtr pci)
      24             : {
      25      435666 :         InstrPtr p;
      26      435666 :         str msg = MAL_SUCCEED;
      27             : 
      28      435666 :         (void) cntxt;
      29      435666 :         (void) stk;                                     /* to fool compilers */
      30    22494975 :         for (int i = 0; i < mb->stop; i++) {
      31    22059309 :                 p = getInstrPtr(mb, i);
      32    22059309 :                 if (p->token == ASSIGNsymbol) {
      33      121278 :                         for (int j = 0; j < p->retc && j + p->retc < p->argc; j++)
      34        5547 :                                 if (isVarCList(mb, getArg(p, p->retc + j)))
      35          53 :                                         setVarCList(mb, getArg(p, j));
      36             :                 }
      37    22059309 :                 if (getModuleId(p) == sqlRef) {
      38     2240339 :                         if (getFunctionId(p) == tidRef)
      39      181675 :                                 setVarCList(mb, getArg(p, 0));
      40     2058664 :                         else if (getFunctionId(p) == subdeltaRef)
      41       50186 :                                 setVarCList(mb, getArg(p, 0));
      42    19818970 :                 } else if (getModuleId(p) == algebraRef) {
      43     2034892 :                         if (getFunctionId(p) == selectRef
      44     1949490 :                                 || getFunctionId(p) == thetaselectRef)
      45      374914 :                                 setVarCList(mb, getArg(p, 0));
      46     1659978 :                         else if (getFunctionId(p) == likeselectRef)
      47        5547 :                                 setVarCList(mb, getArg(p, 0));
      48     1654431 :                         else if (getFunctionId(p) == intersectRef
      49     1650195 :                                          || getFunctionId(p) == differenceRef)
      50       70181 :                                 setVarCList(mb, getArg(p, 0));
      51     1584250 :                         else if (getFunctionId(p) == uniqueRef)
      52          78 :                                 setVarCList(mb, getArg(p, 0));
      53     1584172 :                         else if (getFunctionId(p) == firstnRef)
      54        1451 :                                 setVarCList(mb, getArg(p, 0));
      55     1582721 :                         else if (getFunctionId(p) == subsliceRef)
      56        1217 :                                 setVarCList(mb, getArg(p, 0));
      57     1581504 :                         else if (getFunctionId(p) == projectionRef
      58      964970 :                                          && isVarCList(mb, getArg(p, p->retc + 0))
      59      592996 :                                          && isVarCList(mb, getArg(p, p->retc + 1)))
      60       96814 :                                 setVarCList(mb, getArg(p, 0));
      61    17784078 :                 } else if (getModuleId(p) == generatorRef) {
      62         367 :                         if (getFunctionId(p) == selectRef
      63         367 :                                 || getFunctionId(p) == thetaselectRef)
      64          27 :                                 setVarCList(mb, getArg(p, 0));
      65    17783711 :                 } else if (getModuleId(p) == sampleRef) {
      66          21 :                         if (getFunctionId(p) == subuniformRef)
      67          21 :                                 setVarCList(mb, getArg(p, 0));
      68    17783690 :                 } else if (getModuleId(p) == groupRef && p->retc > 1) {
      69       55845 :                         if (getFunctionId(p) == subgroupRef
      70       52718 :                                 || getFunctionId(p) == subgroupdoneRef
      71       40046 :                                 || getFunctionId(p) == groupRef
      72       27571 :                                 || getFunctionId(p) == groupdoneRef)
      73       55845 :                                 setVarCList(mb, getArg(p, 1));
      74    17727845 :                 } else if (getModuleId(p) == batRef) {
      75      625298 :                         if (getFunctionId(p) == mergecandRef
      76      547046 :                                 || getFunctionId(p) == intersectcandRef
      77      547046 :                                 || getFunctionId(p) == diffcandRef
      78      547046 :                                 || getFunctionId(p) == mirrorRef)
      79      119903 :                                 setVarCList(mb, getArg(p, 0));
      80             :                 }
      81             :         }
      82             : 
      83             :         /* Defense line against incorrect plans */
      84             :         /* plan remains unaffected */
      85             :         // msg = chkTypes(cntxt->usermodule, mb, FALSE);
      86             :         // if( ms== MAL_SUCCEED)
      87             :         //      msg = chkFlow(mb);
      88             :         // if( ms== MAL_SUCCEED)
      89             :         //      msg = chkDeclarations(mb);
      90             :         /* keep actions taken as a fake argument */
      91      435666 :         (void) pushInt(mb, pci, 1);
      92      435666 :         return msg;
      93             : }

Generated by: LCOV version 1.14