decls.add(new JFieldDeclaration(null, simpleIndexVar, null, null));
    public JFieldDeclaration[] getVarDecls()     {        Vector decls = new Vector();        FilterContent filter = filterInfo.filter;        JFieldDeclaration[] fields=filter.getFields();            if(fields!=null)            for (int i = 0; i < fields.length; i++)                 decls.add(fields[i]);            //index variable for certain for loops        JVariableDefinition exeIndexVar =             new JVariableDefinition(null,                                     0,                                     CStdType.Integer,                                    exeIndex + uniqueID,                                    null);        //remember the JVarDef for latter (in the raw main function)        generatedVariables.exeIndex = exeIndexVar;        decls.add(new JFieldDeclaration(null, exeIndexVar, null, null));            //index variable for certain for loops        JVariableDefinition exeIndex1Var =             new JVariableDefinition(null,                                     0,                                     CStdType.Integer,                                    exeIndex1 + uniqueID,                                    null);        generatedVariables.exeIndex1 = exeIndex1Var;        decls.add(new JFieldDeclaration(null, exeIndex1Var, null, null));            //only add the receive buffer and its vars if the         //filter receives data        if (!filterInfo.noBuffer()) {            //initialize the buffersize to be the size of the             //struct being passed over it            int buffersize;                    int maxpeek = filterInfo.peek;            //set up the maxpeek            maxpeek = (filterInfo.prePeek > maxpeek) ? filterInfo.prePeek : maxpeek;                            SpaceTimeBackend.println(filterInfo.filter.getName() + " remaining: " + filterInfo.remaining);            if (filterInfo.isSimple()) {                //simple filter (no remaining items)                if (KjcOptions.ratematch) {                    //i don't know, the prepeek could be really large, so just in case                    //include it.  Make the buffer big enough to hold                     buffersize =                         Math.max                        ((filterInfo.steadyMult - 1) *                          filterInfo.pop + filterInfo.peek, filterInfo.prePeek);                }                else //not ratematching and we do not have a circular buffer                    buffersize = maxpeek;  //this really should be max pop, but peek  == pop                //in this case                 //define the simple index variable                JVariableDefinition simpleIndexVar =                     new JVariableDefinition(null,                                             0,                                             CStdType.Integer,                                            simpleIndex + filterInfo.filter.getName(),                                            new JIntLiteral(-1));                        //remember the JVarDef for latter (in the raw main function)                generatedVariables.simpleIndex = simpleIndexVar;                decls.add(new JFieldDeclaration(null, simpleIndexVar, null, null));            }            else { //filter with remaing items on the buffer after initialization                 buffersize = Util.nextPow2(maxpeek + filterInfo.remaining);            }                    //compute how many times this filter fires            //find the stage with the max number of executions and add the primepump            //int maxExe = Math.max(filterInfo.initMult, filterInfo.steadyMult) +                   //  filterInfo.primePump;                    //buffersize *= maxExe;            /*                    FilterTraceNode[] previousFilters = filterInfo.getPreviousFilters();            if (previousFilters.length == 1) {            FilterInfo prevInfo = FilterInfo.getFilterInfo(previousFilters[0]);                    //find the stage with the max number of executions            int maxExe = Math.max(Math.max(prevInfo.initMult, prevInfo.steadyMult),            prevInfo.primePump);            //now mult the previous buffersize calc by the stage with the             //greatest number of executions...            buffersize *= maxExe;            }            else {            //splitjoin            Utils.fail("Split/joins not supported");            }            */            JVariableDefinition recvBufVar =                 new JVariableDefinition(null,                                         at.dms.kjc.Constants.ACC_FINAL, //?????????                                        new CArrayType(filter.getInputType(),                                                        1 /* dimension */ ,                                                       bufferDims(filter, filter.getInputType(), buffersize)),                                        recvBuffer + filterInfo.filter.getName(),                                        null);                            //the size of the buffer             JVariableDefinition recvBufferSizeVar =                 new JVariableDefinition(null,                                         at.dms.kjc.Constants.ACC_FINAL, //?????????                                        CStdType.Integer,                                        recvBufferSize + filterInfo.filter.getName(),                                        new JIntLiteral(buffersize));                    //the size of the buffer             JVariableDefinition recvBufferBitsVar =                 new JVariableDefinition(null,                                         at.dms.kjc.Constants.ACC_FINAL, //?????????                                        CStdType.Integer,                                        recvBufferBits + filterInfo.filter.getName(),                                        new JIntLiteral(buffersize - 1));                    //the receive buffer index (start of the buffer)            JVariableDefinition recvBufferIndexVar =                 new JVariableDefinition(null,                                         0,                                         CStdType.Integer,                                        recvBufferIndex + filterInfo.filter.getName(),                                        new JIntLiteral(-1));                    //the index to the end of the receive buffer)            JVariableDefinition recvIndexVar =                 new JVariableDefinition(null,                                         0,                                         CStdType.Integer,                                        recvIndex + filterInfo.filter.getName(),                                        new JIntLiteral(-1));            generatedVariables.recvBuffer = recvBufVar;            decls.add(new JFieldDeclaration(null, recvBufVar, null, null));            generatedVariables.recvBufferSize = recvBufferSizeVar;            decls.add(new JFieldDeclaration(null, recvBufferSizeVar, null, null));            generatedVariables.recvBufferBits = recvBufferBitsVar;            decls.add(new JFieldDeclaration(null, recvBufferBitsVar, null, null));            generatedVariables.recvBufferIndex = recvBufferIndexVar;            decls.add(new JFieldDeclaration(null, recvBufferIndexVar, null, null));            generatedVariables.recvIndex = recvIndexVar;            decls.add(new JFieldDeclaration(null, recvIndexVar, null, null));        }            //if we are rate matching, create the output buffer with its         //index        if (KjcOptions.ratematch && filter.getPushInt() > 0) {            //define the send buffer index variable            JVariableDefinition sendBufferIndexVar =                 new JVariableDefinition(null,                                         0,                                         CStdType.Integer,                                        sendBufferIndex + uniqueID,                                        new JIntLiteral(-1));                    generatedVariables.sendBufferIndex = sendBufferIndexVar;            decls.add(new JFieldDeclaration(null, sendBufferIndexVar, null, null));                     //define the send buffer                    JExpression[] dims = new JExpression[1];            //the size of the output array is number of executions in steady *            // number of items pushed * size of item            dims[0] = new JIntLiteral(filterInfo.steadyMult * filterInfo.push *                                       Util.getTypeSize(filter.getOutputType()));            JVariableDefinition sendBufVar =                 new JVariableDefinition(null,                                         at.dms.kjc.Constants.ACC_FINAL, //?????????                                        new CArrayType(filter.getOutputType(),                                                        1 /* dimension */ ,                                                       dims),                                        sendBuffer + uniqueID,                                         null);            generatedVariables.sendBuffer = sendBufVar;            decls.add(new JFieldDeclaration(null, sendBufVar, null, null));        }                //print the declarations for the array indices for pushing and popping        //if this filter deals with arrays        if (filter.getInputType().isArrayType() ||             filter.getOutputType().isArrayType()) {            int inputDim = 0, outputDim = 0, maxDim;            //find which array has the greatest dimensionality                 if (filter.getInputType().isArrayType())                inputDim =                     ((CArrayType)filter.getInputType()).getArrayBound();            if (filter.getOutputType().isArrayType())                 outputDim =                     ((CArrayType)filter.getOutputType()).getArrayBound();            maxDim = (inputDim > outputDim) ? inputDim : outputDim;                    generatedVariables.ARRAY_INDEX = new JVariableDefinition[maxDim];                    //create enough index vars as max dim            for (int i = 0; i < maxDim; i++) {                JVariableDefinition arrayIndexVar =                     new JVariableDefinition(null,                                             0,                                             CStdType.Integer,                                            ARRAY_INDEX + i + uniqueID,                                            null);                //remember the array index vars                generatedVariables.ARRAY_INDEX[i] = arrayIndexVar;                decls.add(new JFieldDeclaration(null, arrayIndexVar, null, null));            }        }            //convert the pops/peeks into buffer access         convertCommExprs();        return (JFieldDeclaration[])decls.toArray(new JFieldDeclaration[0]);    }