LCOV - code coverage report
Current view: top level - monetdb5/optimizer - opt_candidates.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 57 57 100.0 %
Date: 2024-11-13 19:37:10 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      451492 : OPTcandidatesImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
      23             : {
      24      451492 :         InstrPtr p;
      25      451492 :         str msg = MAL_SUCCEED;
      26             : 
      27      451492 :         if (!(ATOMIC_GET(&GDKdebug) & TESTINGMASK))
      28        2379 :                 goto wrapup;
      29             :         (void) cntxt;
      30             :         (void) stk;                                     /* to fool compilers */
      31    28381797 :         for (int i = 0; i < mb->stop; i++) {
      32    27932684 :                 p = getInstrPtr(mb, i);
      33    27932684 :                 if (p->token == ASSIGNsymbol) {
      34      132297 :                         for (int j = 0; j < p->retc && j + p->retc < p->argc; j++)
      35        9207 :                                 if (isVarCList(mb, getArg(p, p->retc + j)))
      36          52 :                                         setVarCList(mb, getArg(p, j));
      37             :                 }
      38    27932684 :                 if (getModuleId(p) == sqlRef) {
      39     3221549 :                         if (getFunctionId(p) == tidRef)
      40      303381 :                                 setVarCList(mb, getArg(p, 0));
      41     2918168 :                         else if (getFunctionId(p) == subdeltaRef)
      42       81727 :                                 setVarCList(mb, getArg(p, 0));
      43    24711135 :                 } else if (getModuleId(p) == algebraRef) {
      44     4137173 :                         if (getFunctionId(p) == selectRef
      45     3976871 :                                 || getFunctionId(p) == thetaselectRef)
      46      647840 :                                 setVarCList(mb, getArg(p, 0));
      47     3489333 :                         else if (getFunctionId(p) == likeselectRef)
      48        5945 :                                 setVarCList(mb, getArg(p, 0));
      49     3483388 :                         else if (getFunctionId(p) == intersectRef
      50     3474293 :                                          || getFunctionId(p) == differenceRef)
      51      167828 :                                 setVarCList(mb, getArg(p, 0));
      52     3315560 :                         else if (getFunctionId(p) == uniqueRef)
      53          65 :                                 setVarCList(mb, getArg(p, 0));
      54     3315495 :                         else if (getFunctionId(p) == firstnRef)
      55        1206 :                                 setVarCList(mb, getArg(p, 0));
      56     3314289 :                         else if (getFunctionId(p) == subsliceRef)
      57        1116 :                                 setVarCList(mb, getArg(p, 0));
      58     3313173 :                         else if (getFunctionId(p) == projectionRef
      59     1925727 :                                          && isVarCList(mb, getArg(p, p->retc + 0))
      60     1129631 :                                          && isVarCList(mb, getArg(p, p->retc + 1)))
      61      223063 :                                 setVarCList(mb, getArg(p, 0));
      62    20573962 :                 } else if (getModuleId(p) == generatorRef) {
      63         414 :                         if (getFunctionId(p) == selectRef
      64         414 :                                 || getFunctionId(p) == thetaselectRef)
      65          29 :                                 setVarCList(mb, getArg(p, 0));
      66    20573548 :                 } else if (getModuleId(p) == sampleRef) {
      67          21 :                         if (getFunctionId(p) == subuniformRef)
      68          21 :                                 setVarCList(mb, getArg(p, 0));
      69    20573527 :                 } else if (getModuleId(p) == groupRef && p->retc > 1) {
      70       86669 :                         if (getFunctionId(p) == subgroupRef
      71       82720 :                                 || getFunctionId(p) == subgroupdoneRef
      72       62292 :                                 || getFunctionId(p) == groupRef
      73       42023 :                                 || getFunctionId(p) == groupdoneRef)
      74       86669 :                                 setVarCList(mb, getArg(p, 1));
      75    20486858 :                 } else if (getModuleId(p) == batRef) {
      76      880705 :                         if (getFunctionId(p) == mergecandRef
      77      765245 :                                 || getFunctionId(p) == intersectcandRef
      78      765245 :                                 || getFunctionId(p) == diffcandRef
      79      765245 :                                 || getFunctionId(p) == mirrorRef)
      80      234073 :                                 setVarCList(mb, getArg(p, 0));
      81             :                 }
      82             :         }
      83             : 
      84             :         /* Defense line against incorrect plans */
      85             :         /* plan remains unaffected */
      86             :         // msg = chkTypes(cntxt->usermodule, mb, FALSE);
      87             :         // if( ms== MAL_SUCCEED)
      88             :         //      msg = chkFlow(mb);
      89             :         // if( ms== MAL_SUCCEED)
      90             :         //      msg = chkDeclarations(mb);
      91             :         /* keep actions taken as a fake argument */
      92      449113 : wrapup:
      93      451492 :         (void) pushInt(mb, pci, 1);
      94      451490 :         return msg;
      95             : }

Generated by: LCOV version 1.14