src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Template.java
changeset 47359 e1a6c0168741
parent 47216 71c04702a3d5
child 48409 5ab69533994b
equal deleted inserted replaced
47358:d07d5f7cab35 47359:e1a6c0168741
     1 /*
     1 /*
     2  * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
       
     3  * @LastModified: Oct 2017
     3  */
     4  */
     4 /*
     5 /*
     5  * Licensed to the Apache Software Foundation (ASF) under one or more
     6  * Licensed to the Apache Software Foundation (ASF) under one or more
     6  * contributor license agreements.  See the NOTICE file distributed with
     7  * contributor license agreements.  See the NOTICE file distributed with
     7  * this work for additional information regarding copyright ownership.
     8  * this work for additional information regarding copyright ownership.
    18  * limitations under the License.
    19  * limitations under the License.
    19  */
    20  */
    20 
    21 
    21 package com.sun.org.apache.xalan.internal.xsltc.compiler;
    22 package com.sun.org.apache.xalan.internal.xsltc.compiler;
    22 
    23 
    23 import java.util.Vector;
       
    24 
       
    25 import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
    24 import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
    26 import com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL;
    25 import com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL;
    27 import com.sun.org.apache.bcel.internal.generic.InstructionHandle;
    26 import com.sun.org.apache.bcel.internal.generic.InstructionHandle;
    28 import com.sun.org.apache.bcel.internal.generic.InstructionList;
    27 import com.sun.org.apache.bcel.internal.generic.InstructionList;
    29 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator;
    28 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator;
    32 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.NamedMethodGenerator;
    31 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.NamedMethodGenerator;
    33 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
    32 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
    34 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
    33 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
    35 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util;
    34 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util;
    36 import com.sun.org.apache.xml.internal.utils.XML11Char;
    35 import com.sun.org.apache.xml.internal.utils.XML11Char;
       
    36 import java.util.ArrayList;
    37 import java.util.List;
    37 import java.util.List;
    38 
    38 
    39 
    39 
    40 /**
    40 /**
    41  * @author Jacek Ambroziak
    41  * @author Jacek Ambroziak
    58     // template is a template which only has a name but no match pattern.
    58     // template is a template which only has a name but no match pattern.
    59     private boolean _isSimpleNamedTemplate = false;
    59     private boolean _isSimpleNamedTemplate = false;
    60 
    60 
    61     // The list of parameters in this template. This is only used
    61     // The list of parameters in this template. This is only used
    62     // for simple named templates.
    62     // for simple named templates.
    63     private Vector<Param> _parameters = new Vector<>();
    63     private List<Param> _parameters = new ArrayList<>();
    64 
    64 
    65     public boolean hasParams() {
    65     public boolean hasParams() {
    66         return _parameters.size() > 0;
    66         return _parameters.size() > 0;
    67     }
    67     }
    68 
    68 
    77     public boolean isSimpleNamedTemplate() {
    77     public boolean isSimpleNamedTemplate() {
    78         return _isSimpleNamedTemplate;
    78         return _isSimpleNamedTemplate;
    79     }
    79     }
    80 
    80 
    81     public void addParameter(Param param) {
    81     public void addParameter(Param param) {
    82         _parameters.addElement(param);
    82         _parameters.add(param);
    83     }
    83     }
    84 
    84 
    85     public Vector<Param> getParameters() {
    85     public List<Param> getParameters() {
    86         return _parameters;
    86         return _parameters;
    87     }
    87     }
    88 
    88 
    89     public void disable() {
    89     public void disable() {
    90         _disabled = true;
    90         _disabled = true;
   326             int numParams = _parameters.size();
   326             int numParams = _parameters.size();
   327             NamedMethodGenerator namedMethodGen = (NamedMethodGenerator)methodGen;
   327             NamedMethodGenerator namedMethodGen = (NamedMethodGenerator)methodGen;
   328 
   328 
   329             // Update load/store instructions to access Params from the stack
   329             // Update load/store instructions to access Params from the stack
   330             for (int i = 0; i < numParams; i++) {
   330             for (int i = 0; i < numParams; i++) {
   331                 Param param = (Param)_parameters.elementAt(i);
   331                 Param param = _parameters.get(i);
   332                 param.setLoadInstruction(namedMethodGen.loadParameter(i));
   332                 param.setLoadInstruction(namedMethodGen.loadParameter(i));
   333                 param.setStoreInstruction(namedMethodGen.storeParameter(i));
   333                 param.setStoreInstruction(namedMethodGen.storeParameter(i));
   334             }
   334             }
   335         }
   335         }
   336 
   336