Example #1
0
static Code
listSupervisor(Definition def)
{ if ( def->impl.clauses.number_of_clauses == 2 )
  { ClauseRef cref[2];
    word c[2];
    int found = getClauses(def, cref, 2);

    if ( found == 2 &&
	 arg1Key(cref[0]->value.clause->codes, &c[0]) &&
	 arg1Key(cref[1]->value.clause->codes, &c[1]) &&
	 ( (c[0] == ATOM_nil && c[1] == FUNCTOR_dot2) ||
	   (c[1] == ATOM_nil && c[0] == FUNCTOR_dot2) ) )
    { Code codes = allocCodes(3);

      DEBUG(1, Sdprintf("List supervisor for %s\n", predicateName(def)));

      codes[0] = encode(S_LIST);
      if ( c[0] == ATOM_nil )
      { codes[1] = (code)cref[0];
	codes[2] = (code)cref[1];
      } else
      { codes[1] = (code)cref[1];
	codes[2] = (code)cref[0];
      }

      return codes;
    }
  }

  return NULL;
}
Example #2
0
static Code
singleClauseSupervisor(Definition def)
{ if ( def->number_of_clauses == 1 )
  { ClauseRef cref;
    Code codes = allocCodes(2);

    getClauses(def, &cref);
    DEBUG(1, Sdprintf("Single clause supervisor for %s\n",
		      predicateName(def)));

    codes[0] = encode(S_TRUSTME);
    codes[1] = (code)cref;

    return codes;
  }

  return NULL;
}
Example #3
0
// get clauses from CNF statement
int
Semantic::getClauses(List<Semantic *> &clist)
{
	return(getClauses(clist, prep->conclusion, 
			prep->setofsupport, prep->query));
}
Example #4
0
int
Semantic::getClauses(ombt::Set_List<Clause> &clist, Clause &c) const
{
	return(getClauses(clist, c, 1, 0, prep->conclusion));
}
Example #5
0
// get clauses from CNF statement
int
Semantic::getClauses(List<Semantic *> &clist)
{
	return(getClauses(clist, prep->conclusion));
}
// LCOV_EXCL_STOP
void ex_expr::displayContents(Space * space, short mode, const char * displayStr,ULng32 flag)
{
  char buf[100] = {0};	// Soln 10-041117-1848

  ULng32 exprLen = getLength();

#ifndef __EID
  str_sprintf(buf, "Expression: %s", displayStr);
#endif
  space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
#ifndef __EID
  str_sprintf(buf, "Expr Len: %d, Consts Len: %d", exprLen, getConstsLength());
  space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
  str_sprintf(buf, "flags_ = %b ",flags_ );
#endif
  space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

  if (flag & 0x00000004)
    {
      Int32 i = 1;
      ex_clause * clause = getClauses();
      while (clause)
	{
	  clause->displayContents(space, 0, i, constantsArea_);
	  
	  clause = clause->getNextClause();
	  i++;
	}
    }
  
  if (flag & 0x00000002)
    {
#ifndef __EID
      
      if (getPCodeBinary())
        {
          str_sprintf(buf, "  PCode:\n");
          space->allocateAndCopyToAlignedSpace(buf, str_len(buf),sizeof(short));
          str_sprintf(buf, "PCode Expr Length: %d", getPCodeSize());
          space->allocateAndCopyToAlignedSpace(buf, str_len(buf),sizeof(short));

          PCodeCfg* cfg = new(heap_) PCodeCfg(this, heap_);
          cfg->generateShowPlan(getPCodeBinary(), space);
          NADELETE(cfg, PCodeCfg, heap_);
        }
      else if ((flag & 0x00000010) &&
	       (getPCodeBinary()))
	{
// LCOV_EXCL_START
	  str_sprintf(buf, "  PCode:\n");
	  space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
	  str_sprintf(buf, "PCode Expr Length: %d", getPCodeSize());
	  space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
	  
	  PCode::displayContents(getPCodeBinary(), space);
// LCOV_EXCL_STOP
	}
      else
	{
	  // Clear the fixup flag, since the expression has not been fixed up
	  // (pCodeGenerate undoes, the fixup of Const and Temp offsets.)
	  //
	  setFixupConstsAndTemps(0);
	  
	  // re-generate pcode for showplan
	  setPCodeGenCompile(0);
	  setPCodeObject(0);
	  pCode_ = 0;
	  Space tempSpace;  //create pcode stuff in a different space
	  //the space in PCode::displayContents is used for
	  //creating text for the showplan
	  UInt32 f = 0;
	  ex_expr_base::setForShowplan(f, TRUE);
          ex_expr_base::setDownrevCompileR2FCS(f, ((flag & 0x00000010) != 0));
          ex_expr_base::setDownrevCompileRR(f, ((flag & 0x00000020) != 0));
	  pCodeGenerate(&tempSpace, &tempSpace, f);
	  
	  if(getPCodeObject())
	    {
		  // LCOV_EXCL_START
	      str_sprintf(buf, "  PCode:\n");
	      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
	      str_sprintf(buf, "PCode Expr Length: %d", getPCodeSize());
	      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
	      
	      PCode::displayContents(getPCodeObject()->getPCIList(), space);
	      // LCOV_EXCL_STOP
	    }
	}
#endif   //__EID
    }
}