Return-Path: Delivered-To: apmail-xml-xalan-cvs-archive@www.apache.org Received: (qmail 1422 invoked from network); 24 Sep 2004 22:19:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 24 Sep 2004 22:19:05 -0000 Received: (qmail 70540 invoked by uid 500); 24 Sep 2004 22:21:14 -0000 Delivered-To: apmail-xml-xalan-cvs-archive@xml.apache.org Received: (qmail 70349 invoked by uid 500); 24 Sep 2004 22:21:13 -0000 Mailing-List: contact xalan-cvs-help@xml.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: Delivered-To: mailing list xalan-cvs@xml.apache.org Received: (qmail 70059 invoked by uid 99); 24 Sep 2004 22:21:11 -0000 X-ASF-Spam-Status: No, hits=-10.0 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Fri, 24 Sep 2004 15:21:09 -0700 Received: (qmail 1350 invoked by uid 1538); 24 Sep 2004 22:18:57 -0000 Date: 24 Sep 2004 22:18:57 -0000 Message-ID: <20040924221857.1349.qmail@minotaur.apache.org> From: zongaro@apache.org To: xml-xalan-cvs@apache.org Subject: cvs commit: xml-xalan/java/src/org/apache/xalan/xsltc/compiler Variable.java X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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 - * @author John Howard - */ 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