xalan-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zong...@apache.org
Subject cvs commit: xml-xalan/java/src/org/apache/xalan/xsltc/compiler Variable.java
Date Fri, 24 Sep 2004 22:18:57 GMT
zongaro     2004/09/24 15:18:57

  Modified:    java/src/org/apache/xalan/xsltc/compiler Variable.java
  Log:
  Skip translation for any unreferenced variables.
  
  Patch reviewed by Christine Li (jycli@ca.ibm.com).
  
  Revision  Changes    Path
  1.28      +11 -17    xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Variable.java
  
  Index: Variable.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Variable.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- Variable.java	24 Feb 2004 02:58:42 -0000	1.27
  +++ Variable.java	24 Sep 2004 22:18:56 -0000	1.28
  @@ -36,13 +36,6 @@
   import org.apache.xalan.xsltc.compiler.util.Type;
   import org.apache.xalan.xsltc.compiler.util.TypeCheckError;
   
  -/**
  - * @author Jacek Ambroziak
  - * @author Santiago Pericas-Geertsen
  - * @author Morten Jorgensen
  - * @author Erwin Bolwidt <ejb@klomp.org>
  - * @author John Howard <JohnH@schemasoft.com>
  - */
   final class Variable extends VariableBase {
   
       public int getIndex() {
  @@ -148,25 +141,26 @@
   	final ConstantPoolGen cpg = classGen.getConstantPool();
   	final InstructionList il = methodGen.getInstructionList();
   
  -	final String name = getEscapedName();
  +        // Don't generate code for unreferenced variables
  +        if (_refs.isEmpty()) {
  +            _ignore = true;
  +        }
   
   	// Make sure that a variable instance is only compiled once
   	if (_ignore) return;
   	_ignore = true;
   
  +	final String name = getEscapedName();
  +
   	if (isLocal()) {
   	    // Compile variable value computation
   	    translateValue(classGen, methodGen);
   
   	    // Add a new local variable and store value
  -	    if (_refs.isEmpty()) { // Remove it if nobody uses the value
  -		il.append(_type.POP());
  -		_local = null;
  -	    }
  -	    else {		   // Store in local var slot if referenced
  -		if (_local == null) mapRegister(methodGen);
  -		il.append(_type.STORE(_local.getIndex()));
  -	    }
  +	    if (_local == null) {
  +                mapRegister(methodGen);
  +            }
  +	    il.append(_type.STORE(_local.getIndex()));
   	}
   	else {
   	    String signature = _type.toSignature();
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org


Mime
View raw message