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-04-26 00:35:57 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      445454 : OPTcandidatesImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
      23             : {
      24      445454 :         InstrPtr p;
      25      445454 :         str msg = MAL_SUCCEED;
      26             : 
      27      445454 :         if (!(ATOMIC_GET(&GDKdebug) & FORCEMITOMASK))
      28        2180 :                 goto wrapup;
      29             :         (void) cntxt;
      30             :         (void) stk;                                     /* to fool compilers */
      31    26212812 :         for (int i = 0; i < mb->stop; i++) {
      32    25769538 :                 p = getInstrPtr(mb, i);
      33    25769538 :                 if (p->token == ASSIGNsymbol) {
      34      125408 :                         for (int j = 0; j < p->retc && j + p->retc < p->argc; j++)
      35        5495 :                                 if (isVarCList(mb, getArg(p, p->retc + j)))
      36          50 :                                         setVarCList(mb, getArg(p, j));
      37             :                 }
      38    25769538 :                 if (getModuleId(p) == sqlRef) {
      39     3061906 :                         if (getFunctionId(p) == tidRef)
      40      248629 :                                 setVarCList(mb, getArg(p, 0));
      41     2813277 :                         else if (getFunctionId(p) == subdeltaRef)
      42       69746 :                                 setVarCList(mb, getArg(p, 0));
      43    22707632 :                 } else if (getModuleId(p) == algebraRef) {
      44     3188207 :                         if (getFunctionId(p) == selectRef
      45     3045364 :                                 || getFunctionId(p) == thetaselectRef)
      46      521674 :                                 setVarCList(mb, getArg(p, 0));
      47     2666533 :                         else if (getFunctionId(p) == likeselectRef)
      48        7673 :                                 setVarCList(mb, getArg(p, 0));
      49     2658860 :                         else if (getFunctionId(p) == intersectRef
      50     2651674 :                                          || getFunctionId(p) == differenceRef)
      51       93006 :                                 setVarCList(mb, getArg(p, 0));
      52     2565854 :                         else if (getFunctionId(p) == uniqueRef)
      53          56 :                                 setVarCList(mb, getArg(p, 0));
      54     2565798 :                         else if (getFunctionId(p) == firstnRef)
      55        1202 :                                 setVarCList(mb, getArg(p, 0));
      56     2564596 :                         else if (getFunctionId(p) == subsliceRef)
      57        1009 :                                 setVarCList(mb, getArg(p, 0));
      58     2563587 :                         else if (getFunctionId(p) == projectionRef
      59     1532156 :                                          && isVarCList(mb, getArg(p, p->retc + 0))
      60      855973 :                                          && isVarCList(mb, getArg(p, p->retc + 1)))
      61      112092 :                                 setVarCList(mb, getArg(p, 0));
      62    19519425 :                 } else if (getModuleId(p) == generatorRef) {
      63         363 :                         if (getFunctionId(p) == selectRef
      64         363 :                                 || getFunctionId(p) == thetaselectRef)
      65          27 :                                 setVarCList(mb, getArg(p, 0));
      66    19519062 :                 } else if (getModuleId(p) == sampleRef) {
      67          21 :                         if (getFunctionId(p) == subuniformRef)
      68          21 :                                 setVarCList(mb, getArg(p, 0));
      69    19519041 :                 } else if (getModuleId(p) == groupRef && p->retc > 1) {
      70       82263 :                         if (getFunctionId(p) == subgroupRef
      71       79033 :                                 || getFunctionId(p) == subgroupdoneRef
      72       59601 :                                 || getFunctionId(p) == groupRef
      73       40303 :                                 || getFunctionId(p) == groupdoneRef)
      74       82263 :                                 setVarCList(mb, getArg(p, 1));
      75    19436778 :                 } else if (getModuleId(p) == batRef) {
      76      679117 :                         if (getFunctionId(p) == mergecandRef
      77      566937 :                                 || getFunctionId(p) == intersectcandRef
      78      566937 :                                 || getFunctionId(p) == diffcandRef
      79      566937 :                                 || getFunctionId(p) == mirrorRef)
      80      174444 :                                 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      443274 : wrapup:
      93      445454 :         (void) pushInt(mb, pci, 1);
      94      445458 :         return msg;
      95             : }

Generated by: LCOV version 1.14