santiagopg    2004/01/14 12:20:04

  Modified:    java/src/org/apache/xalan/xsltc/compiler ApplyTemplates.java
                        ForEach.java PositionCall.java
               java/src/org/apache/xalan/xsltc/runtime BasisLibrary.java
  Removed:     java/src/org/apache/xalan/xsltc/compiler
                        ForwardPositionExpr.java
               java/src/org/apache/xalan/xsltc/dom
                        ForwardPositionIterator.java
  Log:
  Committing a patch from Bhakti Mehta ([EMAIL PROTECTED]). 
ForwardPositionIterators and ForwardPositionExprs are not needed anymore after 
the intergration with DTM. Despite that, ForwardPositionIterators were still 
being used even though they did not provide any additional functionally (they 
were basically identity iterators). This patch eliminates the need for these 
iterators (and the corresponding compile-time expressions) and also replaces 
calls to BasisLibrary.positionF() with calls to currentIterator.getPosition(). 
The resulting code should be smaller and faster.
  
  Revision  Changes    Path
  1.19      +1 -6      
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/ApplyTemplates.java
  
  Index: ApplyTemplates.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/ApplyTemplates.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- ApplyTemplates.java       19 Dec 2003 15:26:48 -0000      1.18
  +++ ApplyTemplates.java       14 Jan 2004 20:20:03 -0000      1.19
  @@ -109,11 +109,6 @@
        if (select.length() > 0) {
            _select = parser.parseExpression(this, "select", null);
   
  -         // Wrap _select in a ForwardPositionExpr
  -         final Expression fpe = new ForwardPositionExpr(_select);
  -         _select.setParent(fpe);
  -         fpe.setParser(_select.getParser());
  -         _select = fpe;
        }
        
        if (mode.length() > 0) {
  
  
  
  1.18      +3 -9      
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/ForEach.java
  
  Index: ForEach.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/ForEach.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- ForEach.java      19 Dec 2003 15:26:48 -0000      1.17
  +++ ForEach.java      14 Jan 2004 20:20:03 -0000      1.18
  @@ -106,13 +106,6 @@
           if (_select.isDummy()) {
            reportError(this, parser, ErrorMsg.REQUIRED_ATTR_ERR, "select");
           }
  -     else {
  -         // Wrap _select in a ForwardPositionExpr
  -         final Expression fpe = new ForwardPositionExpr(_select);
  -         _select.setParent(fpe);
  -         fpe.setParser(_select.getParser());
  -         _select = fpe;
  -     }
       }
        
       public Type typeCheck(SymbolTable stable) throws TypeCheckError {
  @@ -177,7 +170,8 @@
            }
   
            if (_type instanceof ReferenceType == false) {
  -             _select.startIterator(classGen, methodGen);
  +                il.append(methodGen.loadContextNode());
  +                il.append(methodGen.setStartNode());
            }
        }
   
  
  
  
  1.13      +6 -6      
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/PositionCall.java
  
  Index: PositionCall.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/PositionCall.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- PositionCall.java 30 Jan 2003 18:46:01 -0000      1.12
  +++ PositionCall.java 14 Jan 2004 20:20:03 -0000      1.13
  @@ -66,7 +66,7 @@
   
   import org.apache.bcel.generic.ConstantPoolGen;
   import org.apache.bcel.generic.ILOAD;
  -import org.apache.bcel.generic.INVOKESTATIC;
  +import org.apache.bcel.generic.INVOKEINTERFACE;
   import org.apache.bcel.generic.InstructionList;
   import org.apache.xalan.xsltc.compiler.util.ClassGenerator;
   import org.apache.xalan.xsltc.compiler.util.CompareGenerator;
  @@ -94,12 +94,12 @@
        }
        else {
            final ConstantPoolGen cpg = classGen.getConstantPool();
  -            final int index =
  -                    cpg.addMethodref(BASIS_LIBRARY_CLASS, "positionF",
  -                                     "("+NODE_ITERATOR_SIG+")I");
  +            final int index = cpg.addInterfaceMethodref(NODE_ITERATOR,
  +                                                       "getPosition",
  +                                                       "()I");
   
            il.append(methodGen.loadIterator());
  -            il.append(new INVOKESTATIC(index));
  +            il.append(new INVOKEINTERFACE(index,1));
        }
       }
   }
  
  
  
  1.68      +1 -10     
xml-xalan/java/src/org/apache/xalan/xsltc/runtime/BasisLibrary.java
  
  Index: BasisLibrary.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/runtime/BasisLibrary.java,v
  retrieving revision 1.67
  retrieving revision 1.68
  diff -u -r1.67 -r1.68
  --- BasisLibrary.java 23 Dec 2003 15:34:51 -0000      1.67
  +++ BasisLibrary.java 14 Jan 2004 20:20:04 -0000      1.68
  @@ -111,15 +111,6 @@
       }
   
       /**
  -     * Standard function position()
  -     */
  -    public static int positionF(DTMAxisIterator iterator) {
  -     return iterator.isReverse()
  -                     ? iterator.getLast() - iterator.getPosition() + 1
  -                     : iterator.getPosition();
  -    }
  -
  -    /**
        * XSLT Standard function sum(node-set). 
        * stringToDouble is inlined
        */
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to