You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by zo...@apache.org on 2006/04/19 17:37:11 UTC

svn commit: r395277 - in /xalan/java/trunk/src/org/apache/xalan/xsltc/compiler: AttributeSet.java Mode.java Number.java Predicate.java Sort.java Stylesheet.java Whitespace.java util/ClassGenerator.java

Author: zongaro
Date: Wed Apr 19 08:37:09 2006
New Revision: 395277

URL: http://svn.apache.org/viewcvs?rev=395277&view=rev
Log:
Part of patch for XALANJ-1324 and others.

Created a new method on ClassGenerator.addMethod(MethodGenerator), which
deals with the fact that method splitting and outlining could create more than
one method from a single MethodGenerator object.  References to
ClassGenerator.addMethod(Method) are generally replaced with references to the
method with the new signature.

Also, in the cases of some classes, applied changes to accurately annotate
LocalVariableGen objects with the range of instructions over which the
variable is actually alive in support of method splitting and outlining.

See org.apache.xalan.xsltc.compiler.ClassGenerator and
org.apache.xalan.xsltc.compiler.MethodGenerator for more information. 

Patch reviewed by Christine Li and Erin Harris.

Modified:
    xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/AttributeSet.java
    xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/Mode.java
    xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/Number.java
    xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/Predicate.java
    xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/Sort.java
    xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/Stylesheet.java
    xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/Whitespace.java
    xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/util/ClassGenerator.java

Modified: xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/AttributeSet.java
URL: http://svn.apache.org/viewcvs/xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/AttributeSet.java?rev=395277&r1=395276&r2=395277&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/AttributeSet.java (original)
+++ xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/AttributeSet.java Wed Apr 19 08:37:09 2006
@@ -187,11 +187,7 @@
 	final InstructionList il = methodGen.getInstructionList();
 	il.append(RETURN);
 	
-	methodGen.stripAttributes(true);
-	methodGen.setMaxLocals();
-	methodGen.setMaxStack();
-	methodGen.removeNOPs();
-	classGen.addMethod(methodGen.getMethod());
+	classGen.addMethod(methodGen);
     }
 
     public String toString() {

Modified: xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/Mode.java
URL: http://svn.apache.org/viewcvs/xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/Mode.java?rev=395277&r1=395276&r2=395277&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/Mode.java (original)
+++ xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/Mode.java Wed Apr 19 08:37:09 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2004 The Apache Software Foundation.
+ * Copyright 2001-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -549,11 +549,7 @@
 	il.append(template.compile(classGen, methodGen));
 	il.append(RETURN);
 	
-	methodGen.stripAttributes(true);
-	methodGen.setMaxLocals();
-	methodGen.setMaxStack();
-	methodGen.removeNOPs();
-	classGen.addMethod(methodGen.getMethod());
+	classGen.addMethod(methodGen);
     }
 
     private void compileTemplates(ClassGenerator classGen,
@@ -754,6 +750,7 @@
 	argNames[2] = TRANSLET_OUTPUT_PNAME;
 
 	final InstructionList mainIL = new InstructionList();
+
 	final MethodGenerator methodGen =
 	    new MethodGenerator(ACC_PUBLIC | ACC_FINAL, 
 				org.apache.bcel.generic.Type.VOID,
@@ -762,17 +759,21 @@
 				classGen.getConstantPool());
 	methodGen.addException("org.apache.xalan.xsltc.TransletException");
 
-	// Create a local variable to hold the current node
+        // Insert an extra NOP just to keep "current" from appearing as if it
+        // has a value before the start of the loop.
+        mainIL.append(NOP);
+
+        // Create a local variable to hold the current node
 	final LocalVariableGen current;
 	current = methodGen.addLocalVariable2("current",
 					      org.apache.bcel.generic.Type.INT,
-					      mainIL.getEnd());
+					      null);
 	_currentIndex = current.getIndex();
 
 	// Create the "body" instruction list that will eventually hold the
 	// code for the entire method (other ILs will be appended).
 	final InstructionList body = new InstructionList();
-	body.append(NOP);
+        body.append(NOP);
 
 	// Create an instruction list that contains the default next-node
 	// iteration
@@ -789,6 +790,11 @@
 	ifeq.setTarget(ilLoop.append(RETURN)); 	// applyTemplates() ends here!
 	final InstructionHandle ihLoop = ilLoop.getStart();
 
+        current.setStart(mainIL.append(new GOTO_W(ihLoop)));
+
+        // Live range of "current" ends at end of loop
+        current.setEnd(loop);
+
 	// Compile default handling of elements (traverse children)
 	InstructionList ilRecurse =
 	    compileDefaultRecursion(classGen, methodGen, ihLoop);
@@ -1025,18 +1031,13 @@
 	body.append(ilText);
 
 	// putting together constituent instruction lists
-	mainIL.append(new GOTO_W(ihLoop));
 	mainIL.append(body);
 	// fall through to ilLoop
 	mainIL.append(ilLoop);
 
 	peepHoleOptimization(methodGen);
-	methodGen.stripAttributes(true);
-	
-	methodGen.setMaxLocals();
-	methodGen.setMaxStack();
-	methodGen.removeNOPs();
-	classGen.addMethod(methodGen.getMethod());
+
+        classGen.addMethod(methodGen);
 
 	// Compile method(s) for <xsl:apply-imports/> for this mode
 	if (_importLevels != null) {
@@ -1127,11 +1128,11 @@
 	final LocalVariableGen current;
 	current = methodGen.addLocalVariable2("current",
 					      org.apache.bcel.generic.Type.INT,
-					      mainIL.getEnd());
+					      null);
 	_currentIndex = current.getIndex();
 
     mainIL.append(new ILOAD(methodGen.getLocalIndex(NODE_PNAME)));
-    mainIL.append(new ISTORE(_currentIndex));
+    current.setStart(mainIL.append(new ISTORE(_currentIndex)));
     
 	// Create the "body" instruction list that will eventually hold the
 	// code for the entire method (other ILs will be appended).
@@ -1381,18 +1382,18 @@
 
 	// putting together constituent instruction lists
 	mainIL.append(body);
-	// fall through to ilLoop
+
+        // Mark the end of the live range for the "current" variable 
+        current.setEnd(body.getEnd());
+
+        // fall through to ilLoop
 	mainIL.append(ilLoop);
 
 	peepHoleOptimization(methodGen);
-	methodGen.stripAttributes(true);
-	
-	methodGen.setMaxLocals();
-	methodGen.setMaxStack();
-	methodGen.removeNOPs();
-	classGen.addMethod(methodGen.getMethod());
 
-	// Restore original (complete) set of templates for this transformation
+        classGen.addMethod(methodGen);
+
+        // Restore original (complete) set of templates for this transformation
 	_templates = oldTemplates;
     }
 

Modified: xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/Number.java
URL: http://svn.apache.org/viewcvs/xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/Number.java?rev=395277&r1=395276&r2=395277&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/Number.java (original)
+++ xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/Number.java Wed Apr 19 08:37:09 2006
@@ -315,10 +315,7 @@
 	il.append(new INVOKESPECIAL(index));
 	il.append(RETURN);
 	
-	cons.stripAttributes(true);
-	cons.setMaxLocals();
-	cons.setMaxStack();
-	classGen.addMethod(cons.getMethod());
+	classGen.addMethod(cons);
     }
 
     /**
@@ -341,7 +338,7 @@
 				ITERATOR_FIELD_SIG);
 	il.append(ALOAD_0); // 'this' pointer on stack
 	il.append(new GETFIELD(field));
-	il.append(new ASTORE(local.getIndex()));
+	local.setStart(il.append(new ASTORE(local.getIndex())));
 	matchGen.setIteratorIndex(local.getIndex());
 	
 	// Get NodeCounter._translet and store locally
@@ -353,7 +350,7 @@
 	il.append(ALOAD_0); // 'this' pointer on stack
 	il.append(new GETFIELD(field));
 	il.append(new CHECKCAST(cpg.addClass(TRANSLET_CLASS)));
-	il.append(new ASTORE(local.getIndex()));
+	local.setStart(il.append(new ASTORE(local.getIndex())));
 	nodeCounterGen.setTransletIndex(local.getIndex());
 
 	// Get NodeCounter._document and store locally
@@ -364,7 +361,7 @@
 	il.append(ALOAD_0); // 'this' pointer on stack
 	il.append(new GETFIELD(field));
 	// Make sure we have the correct DOM type on the stack!!!
-	il.append(new ASTORE(local.getIndex()));
+	local.setStart(il.append(new ASTORE(local.getIndex())));
 	matchGen.setDomIndex(local.getIndex());
     }
 
@@ -428,11 +425,7 @@
 	    _from.synthesize(nodeCounterGen, matchGen);
 	    il.append(IRETURN);
 		    
-	    matchGen.stripAttributes(true);
-	    matchGen.setMaxLocals();
-	    matchGen.setMaxStack();
-	    matchGen.removeNOPs();
-	    nodeCounterGen.addMethod(matchGen.getMethod());
+	    nodeCounterGen.addMethod(matchGen);
 	}
 
 	/*
@@ -459,11 +452,7 @@
 	    
 	    il.append(IRETURN);
 		    
-	    matchGen.stripAttributes(true);
-	    matchGen.setMaxLocals();
-	    matchGen.setMaxStack();
-	    matchGen.removeNOPs();
-	    nodeCounterGen.addMethod(matchGen.getMethod());
+	    nodeCounterGen.addMethod(matchGen);
 	}
 	
 	getXSLTC().dumpClass(nodeCounterGen.getJavaClass());

Modified: xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/Predicate.java
URL: http://svn.apache.org/viewcvs/xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/Predicate.java?rev=395277&r1=395276&r2=395277&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/Predicate.java (original)
+++ xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/Predicate.java Wed Apr 19 08:37:09 2006
@@ -408,7 +408,7 @@
 	il.append(new CHECKCAST(cpg.addClass(className)));
 	il.append(new GETFIELD(cpg.addFieldref(className,
 					       DOM_FIELD, DOM_INTF_SIG)));
-	il.append(new ASTORE(local.getIndex()));
+	local.setStart(il.append(new ASTORE(local.getIndex())));
 
 	// Store the dom index in the test generator
 	testGen.setDomIndex(local.getIndex());
@@ -416,12 +416,8 @@
 	_exp.translate(filterGen, testGen);
 	il.append(IRETURN);
 	
-	testGen.stripAttributes(true);
-	testGen.setMaxLocals();
-	testGen.setMaxStack();
-	testGen.removeNOPs();
 	filterGen.addEmptyConstructor(ACC_PUBLIC);
-	filterGen.addMethod(testGen.getMethod());
+	filterGen.addMethod(testGen);
 		
 	getXSLTC().dumpClass(filterGen.getJavaClass());
     }

Modified: xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/Sort.java
URL: http://svn.apache.org/viewcvs/xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/Sort.java?rev=395277&r1=395276&r2=395277&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/Sort.java (original)
+++ xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/Sort.java Wed Apr 19 08:37:09 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2001-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -266,12 +266,12 @@
         LocalVariableGen nodesTemp =
             methodGen.addLocalVariable("sort_tmp1",
                                        Util.getJCRefType(NODE_ITERATOR_SIG),
-                                       il.getEnd(), null);
+                                       null, null);
 
         LocalVariableGen sortRecordFactoryTemp =
             methodGen.addLocalVariable("sort_tmp2",
                                       Util.getJCRefType(NODE_SORT_FACTORY_SIG),
-                                      il.getEnd(), null);
+                                      null, null);
 
 	// Get the current node iterator
 	if (nodeSet == null) {	// apply-templates default
@@ -287,17 +287,19 @@
 	    nodeSet.translate(classGen, methodGen);
 	}
 
-        il.append(new ASTORE(nodesTemp.getIndex()));
+        nodesTemp.setStart(il.append(new ASTORE(nodesTemp.getIndex())));
 	
 	// Compile the code for the NodeSortRecord producing class and pass
 	// that as the last argument to the SortingIterator constructor.
 	compileSortRecordFactory(sortObjects, classGen, methodGen);
-        il.append(new ASTORE(sortRecordFactoryTemp.getIndex()));
+        sortRecordFactoryTemp.setStart(
+                il.append(new ASTORE(sortRecordFactoryTemp.getIndex())));
 
 	il.append(new NEW(cpg.addClass(SORT_ITERATOR)));
 	il.append(DUP);
-        il.append(new ALOAD(nodesTemp.getIndex()));
-        il.append(new ALOAD(sortRecordFactoryTemp.getIndex()));
+        nodesTemp.setEnd(il.append(new ALOAD(nodesTemp.getIndex())));
+        sortRecordFactoryTemp.setEnd(
+                il.append(new ALOAD(sortRecordFactoryTemp.getIndex())));
 	il.append(new INVOKESPECIAL(init));
     }
 
@@ -342,7 +344,7 @@
         LocalVariableGen sortOrderTemp
                  = methodGen.addLocalVariable("sort_order_tmp",
                                       Util.getJCRefType("[" + STRING_SIG),
-                                      il.getEnd(), null);
+                                      null, null);
 	il.append(new PUSH(cpg, nsorts));
 	il.append(new ANEWARRAY(cpg.addClass(STRING)));
 	for (int level = 0; level < nsorts; level++) {
@@ -352,12 +354,12 @@
 	    sort.translateSortOrder(classGen, methodGen);
 	    il.append(AASTORE);
 	}
-        il.append(new ASTORE(sortOrderTemp.getIndex()));
+        sortOrderTemp.setStart(il.append(new ASTORE(sortOrderTemp.getIndex())));
 
         LocalVariableGen sortTypeTemp
                  = methodGen.addLocalVariable("sort_type_tmp",
                                       Util.getJCRefType("[" + STRING_SIG),
-                                      il.getEnd(), null);
+                                      null, null);
 	il.append(new PUSH(cpg, nsorts));
 	il.append(new ANEWARRAY(cpg.addClass(STRING)));
 	for (int level = 0; level < nsorts; level++) {
@@ -367,12 +369,12 @@
 	    sort.translateSortType(classGen, methodGen);
 	    il.append(AASTORE);
 	}
-        il.append(new ASTORE(sortTypeTemp.getIndex()));
+        sortTypeTemp.setStart(il.append(new ASTORE(sortTypeTemp.getIndex())));
 
         LocalVariableGen sortLangTemp
                  = methodGen.addLocalVariable("sort_lang_tmp",
                                       Util.getJCRefType("[" + STRING_SIG),
-                                      il.getEnd(), null);
+                                      null, null);
         il.append(new PUSH(cpg, nsorts));
         il.append(new ANEWARRAY(cpg.addClass(STRING)));
         for (int level = 0; level < nsorts; level++) {
@@ -382,12 +384,12 @@
               sort.translateLang(classGen, methodGen);
               il.append(AASTORE);
         }
-        il.append(new ASTORE(sortLangTemp.getIndex()));
+        sortLangTemp.setStart(il.append(new ASTORE(sortLangTemp.getIndex())));
 
         LocalVariableGen sortCaseOrderTemp
                  = methodGen.addLocalVariable("sort_case_order_tmp",
                                       Util.getJCRefType("[" + STRING_SIG),
-                                      il.getEnd(), null);
+                                      null, null);
         il.append(new PUSH(cpg, nsorts));
         il.append(new ANEWARRAY(cpg.addClass(STRING)));
         for (int level = 0; level < nsorts; level++) {
@@ -397,7 +399,8 @@
             sort.translateCaseOrder(classGen, methodGen);
             il.append(AASTORE);
         }
-        il.append(new ASTORE(sortCaseOrderTemp.getIndex()));
+        sortCaseOrderTemp.setStart(
+                il.append(new ASTORE(sortCaseOrderTemp.getIndex())));
 	
 	il.append(new NEW(cpg.addClass(sortRecordFactoryClass)));
 	il.append(DUP);
@@ -405,10 +408,11 @@
 	il.append(new PUSH(cpg, sortRecordClass));
 	il.append(classGen.loadTranslet());
 
-        il.append(new ALOAD(sortOrderTemp.getIndex()));
-        il.append(new ALOAD(sortTypeTemp.getIndex()));
-        il.append(new ALOAD(sortLangTemp.getIndex()));
-        il.append(new ALOAD(sortCaseOrderTemp.getIndex()));
+        sortOrderTemp.setEnd(il.append(new ALOAD(sortOrderTemp.getIndex())));
+        sortTypeTemp.setEnd(il.append(new ALOAD(sortTypeTemp.getIndex())));
+        sortLangTemp.setEnd(il.append(new ALOAD(sortLangTemp.getIndex())));
+        sortCaseOrderTemp.setEnd(
+                il.append(new ALOAD(sortCaseOrderTemp.getIndex())));
 
 	il.append(new INVOKESPECIAL(
 	    cpg.addMethodref(sortRecordFactoryClass, "<init>", 
@@ -580,10 +584,10 @@
 
 	constructor.setMaxLocals();
 	constructor.setMaxStack();
-	sortRecordFactory.addMethod(constructor.getMethod());
+	sortRecordFactory.addMethod(constructor);
 	makeNodeSortRecord.setMaxLocals();
 	makeNodeSortRecord.setMaxStack();
-	sortRecordFactory.addMethod(makeNodeSortRecord.getMethod());
+	sortRecordFactory.addMethod(makeNodeSortRecord);
 	xsltc.dumpClass(sortRecordFactory.getJavaClass());
 
 	return className;
@@ -636,10 +640,10 @@
 	    }
 	}
 
-	Method init = compileInit(sortObjects, sortRecord,
-					 cpg, className);
-	Method extract = compileExtract(sortObjects, sortRecord,
-					cpg, className);
+	MethodGenerator init = compileInit(sortObjects, sortRecord,
+					   cpg, className);
+	MethodGenerator extract = compileExtract(sortObjects, sortRecord,
+					         cpg, className);
 	sortRecord.addMethod(init);
 	sortRecord.addMethod(extract);
 
@@ -652,7 +656,7 @@
      * collator in the super calls only when the stylesheet specifies a new
      * language in xsl:sort.
      */
-    private static Method compileInit(Vector sortObjects,
+    private static MethodGenerator compileInit(Vector sortObjects,
 					   NodeSortRecordGenerator sortRecord,
 					   ConstantPoolGen cpg,
 					   String className) 
@@ -673,18 +677,14 @@
 
 	il.append(RETURN);
 
-	init.stripAttributes(true);
-	init.setMaxLocals();
-	init.setMaxStack();
-
-	return init.getMethod();
+	return init;
     }
 
 
     /**
      * Compiles a method that overloads NodeSortRecord.extractValueFromDOM()
      */
-    private static Method compileExtract(Vector sortObjects,
+    private static MethodGenerator compileExtract(Vector sortObjects,
 					 NodeSortRecordGenerator sortRecord,
 					 ConstantPoolGen cpg,
 					 String className) {
@@ -741,11 +741,6 @@
 	    il.append(ARETURN);
 	}
 
-	extractMethod.stripAttributes(true);
-	extractMethod.setMaxLocals();
-	extractMethod.setMaxStack();
-	extractMethod.removeNOPs();
-
-	return extractMethod.getMethod();
+	return extractMethod;
     }
 }

Modified: xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/Stylesheet.java
URL: http://svn.apache.org/viewcvs/xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/Stylesheet.java?rev=395277&r1=395276&r2=395277&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/Stylesheet.java (original)
+++ xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/Stylesheet.java Wed Apr 19 08:37:09 2006
@@ -863,10 +863,7 @@
 
 	il.append(RETURN);
 
-	staticConst.stripAttributes(true);
-	staticConst.setMaxLocals();
-	staticConst.setMaxStack();
-	classGen.addMethod(staticConst.getMethod());
+	classGen.addMethod(staticConst);
     	
     }
 
@@ -948,10 +945,7 @@
 
 	il.append(RETURN);
 
-	constructor.stripAttributes(true);
-	constructor.setMaxLocals();
-	constructor.setMaxStack();
-	classGen.addMethod(constructor.getMethod());
+	classGen.addMethod(constructor);
     }
 
     /**
@@ -988,15 +982,15 @@
 	// Define and initialize 'current' variable with the root node
 	final LocalVariableGen current = 
 	    toplevel.addLocalVariable("current",
-				    org.apache.bcel.generic.Type.INT,
-				    il.getEnd(), null);
+				      org.apache.bcel.generic.Type.INT,
+				      null, null);
 
 	final int setFilter = cpg.addInterfaceMethodref(DOM_INTF,
 			       "setFilter",
 			       "(Lorg/apache/xalan/xsltc/StripFilter;)V");
 
 	il.append(new PUSH(cpg, DTM.ROOT_NODE));
-	il.append(new ISTORE(current.getIndex()));
+	current.setStart(il.append(new ISTORE(current.getIndex())));
 
 	// Resolve any forward referenes and translate global variables/params
 	_globals = resolveReferences(_globals);
@@ -1034,12 +1028,7 @@
 	il.append(RETURN);
 
 	// Compute max locals + stack and add method to class
-	toplevel.stripAttributes(true);
-	toplevel.setMaxLocals();
-	toplevel.setMaxStack();
-	toplevel.removeNOPs();
-
-	classGen.addMethod(toplevel.getMethod());
+	classGen.addMethod(toplevel);
 	
 	return("("+DOM_INTF_SIG+NODE_ITERATOR_SIG+TRANSLET_OUTPUT_SIG+")V");
     }
@@ -1156,13 +1145,8 @@
 	
 	il.append(RETURN);
 	
-	// Compute max locals + stack and add method to class
-	buildKeys.stripAttributes(true);
-	buildKeys.setMaxLocals();
-	buildKeys.setMaxStack();
-	buildKeys.removeNOPs();
-
-	classGen.addMethod(buildKeys.getMethod());
+	// Add method to class
+        classGen.addMethod(buildKeys);
 	
 	return("("+DOM_INTF_SIG+NODE_ITERATOR_SIG+TRANSLET_OUTPUT_SIG+"I)V");
     }
@@ -1205,7 +1189,7 @@
 	final LocalVariableGen current = 
 	    transf.addLocalVariable("current",
 				    org.apache.bcel.generic.Type.INT,
-				    il.getEnd(), null);
+				    null, null);
 	final String applyTemplatesSig = classGen.getApplyTemplatesSig();
 	final int applyTemplates = cpg.addMethodref(getClassName(),
 						    "applyTemplates",
@@ -1244,7 +1228,7 @@
 
 	// continue with globals initialization
 	il.append(new PUSH(cpg, DTM.ROOT_NODE));
-	il.append(new ISTORE(current.getIndex()));
+	current.setStart(il.append(new ISTORE(current.getIndex())));
 
 	// Transfer the output settings to the output post-processor
 	il.append(classGen.loadTranslet());
@@ -1309,12 +1293,7 @@
 	il.append(RETURN);
 
 	// Compute max locals + stack and add method to class
-	transf.stripAttributes(true);
-	transf.setMaxLocals();
-	transf.setMaxStack();
-	transf.removeNOPs();
-
-	classGen.addMethod(transf.getMethod());
+	classGen.addMethod(transf);
     }
 
     /**

Modified: xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/Whitespace.java
URL: http://svn.apache.org/viewcvs/xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/Whitespace.java?rev=395277&r1=395276&r2=395277&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/Whitespace.java (original)
+++ xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/Whitespace.java Wed Apr 19 08:37:09 2006
@@ -422,12 +422,7 @@
 	    compileStripSpace(strip, sCount, il);
 	}
 
-	stripSpace.stripAttributes(true);
-	stripSpace.setMaxLocals();
-	stripSpace.setMaxStack();
-	stripSpace.removeNOPs();
-
-	classGen.addMethod(stripSpace.getMethod());
+	classGen.addMethod(stripSpace);
     }
 
     /**
@@ -459,12 +454,7 @@
 	    il.append(ICONST_0);
 	il.append(IRETURN);
 
-	stripSpace.stripAttributes(true);
-	stripSpace.setMaxLocals();
-	stripSpace.setMaxStack();
-	stripSpace.removeNOPs();
-
-	classGen.addMethod(stripSpace.getMethod());
+	classGen.addMethod(stripSpace);
     }
 
 

Modified: xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/util/ClassGenerator.java
URL: http://svn.apache.org/viewcvs/xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/util/ClassGenerator.java?rev=395277&r1=395276&r2=395277&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/util/ClassGenerator.java (original)
+++ xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/util/ClassGenerator.java Wed Apr 19 08:37:09 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2004 The Apache Software Foundation.
+ * Copyright 2001-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@
 
 package org.apache.xalan.xsltc.compiler.util;
 
+import org.apache.bcel.classfile.Method;
 import org.apache.bcel.generic.ALOAD;
 import org.apache.bcel.generic.ClassGen;
 import org.apache.bcel.generic.Instruction;
@@ -129,4 +130,11 @@
     public boolean isExternal() {
 	return false;
     }
-}
+
+    public void addMethod(MethodGenerator methodGen) {
+        Method[] methodsToAdd = methodGen.getGeneratedMethods(this);
+        for (int i = 0; i < methodsToAdd.length; i++) {
+            addMethod(methodsToAdd[i]);
+        }
+    }
+}
\ No newline at end of file



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