Пример #1
0
  /* visit a filter */
  public void visitFilter(SIRFilter self, SIRFilterIter iter) {
    JMethodDeclaration work = self.getWork();
    // cannot look for push operators as
    // they could be any where of the code
    work.addStatementFirst(makeInitCounter(self));
    work.addStatement(makeEndCounter(self));

    // FIXME: need to check for duplication?
    counterSet.add(makePerfCounterName(self));
  }
Пример #2
0
  /**
   * generate the code for the steady state loop. Inline the work function inside of an infinite
   * while loop.
   *
   * @param filter The single fused filter of the application.
   * @return A JStatement that is a while loop with the work function inlined.
   */
  JStatement generateSteadyStateLoop(SIRFilter filter) {

    JBlock block = new JBlock(null, new JStatement[0], null);

    JBlock workBlock = (JBlock) ObjectDeepCloner.deepCopy(filter.getWork().getBody());

    // add the cloned work function to the block
    block.addStatement(workBlock);

    // return the infinite loop
    return new JWhileStatement(null, new JBooleanLiteral(null, true), block, null);
  }