< prev index next >
src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/ApplyTemplates.java
Print this page
rev 886 : 8150704: XALAN: ERROR: 'No more DTM IDs are available' when transforming with lots of temporary result trees
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -15,13 +15,10 @@
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/*
- * $Id: ApplyTemplates.java,v 1.2.4.1 2005/09/12 09:59:21 pvedula Exp $
- */
package com.sun.org.apache.xalan.internal.xsltc.compiler;
import java.util.Enumeration;
import java.util.Vector;
@@ -120,16 +117,14 @@
final ConstantPoolGen cpg = classGen.getConstantPool();
final InstructionList il = methodGen.getInstructionList();
final int current = methodGen.getLocalIndex("current");
// check if sorting nodes is required
- final Vector sortObjects = new Vector();
- final Iterator<SyntaxTreeNode> children = elements();
- while (children.hasNext()) {
- final SyntaxTreeNode child = children.next();
+ final Vector<Sort> sortObjects = new Vector<>();
+ for (final SyntaxTreeNode child : getContents()) {
if (child instanceof Sort) {
- sortObjects.addElement(child);
+ sortObjects.addElement((Sort)child);
}
}
// Push a new parameter frame
if (stylesheet.hasLocalParams() || hasContents()) {
@@ -191,10 +186,17 @@
final int applyTemplates = cpg.addMethodref(className,
_functionName,
applyTemplatesSig);
il.append(new INVOKEVIRTUAL(applyTemplates));
+ // unmap parameters to release temporary result trees
+ for (final SyntaxTreeNode child : getContents()) {
+ if (child instanceof WithParam) {
+ ((WithParam)child).releaseResultTree(classGen, methodGen);
+ }
+ }
+
// Pop parameter frame
if (stylesheet.hasLocalParams() || hasContents()) {
il.append(classGen.loadTranslet());
final int popFrame = cpg.addMethodref(TRANSLET_CLASS,
POP_PARAM_FRAME,
< prev index next >