com.sun.org.apache.bcel.internal.generic.SWITCH Java Examples
The following examples show how to use
com.sun.org.apache.bcel.internal.generic.SWITCH.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Mode.java From jdk1.8-source-analysis with Apache License 2.0 | 4 votes |
private InstructionList compileNamespaces(ClassGenerator classGen, MethodGenerator methodGen, boolean[] isNamespace, boolean[] isAttribute, boolean attrFlag, InstructionHandle defaultTarget) { final XSLTC xsltc = classGen.getParser().getXSLTC(); final ConstantPoolGen cpg = classGen.getConstantPool(); // Append switch() statement - namespace test dispatch loop final Vector namespaces = xsltc.getNamespaceIndex(); final Vector names = xsltc.getNamesIndex(); final int namespaceCount = namespaces.size() + 1; final int namesCount = names.size(); final InstructionList il = new InstructionList(); final int[] types = new int[namespaceCount]; final InstructionHandle[] targets = new InstructionHandle[types.length]; if (namespaceCount > 0) { boolean compiled = false; // Initialize targets for namespace() switch statement for (int i = 0; i < namespaceCount; i++) { targets[i] = defaultTarget; types[i] = i; } // Add test sequences for known namespace types for (int i = DTM.NTYPES; i < (DTM.NTYPES+namesCount); i++) { if ((isNamespace[i]) && (isAttribute[i] == attrFlag)) { String name = (String)names.elementAt(i-DTM.NTYPES); String namespace = name.substring(0,name.lastIndexOf(':')); final int type = xsltc.registerNamespace(namespace); if ((i < _testSeq.length) && (_testSeq[i] != null)) { targets[type] = (_testSeq[i]).compile(classGen, methodGen, defaultTarget); compiled = true; } } } // Return "null" if no test sequences were compiled if (!compiled) return(null); // Append first code in applyTemplates() - get type of current node final int getNS = cpg.addInterfaceMethodref(DOM_INTF, "getNamespaceType", "(I)I"); il.append(methodGen.loadDOM()); il.append(new ILOAD(_currentIndex)); il.append(new INVOKEINTERFACE(getNS, 2)); il.append(new SWITCH(types, targets, defaultTarget)); return(il); } else { return(null); } }
Example #2
Source File: Mode.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
private InstructionList compileNamespaces(ClassGenerator classGen, MethodGenerator methodGen, boolean[] isNamespace, boolean[] isAttribute, boolean attrFlag, InstructionHandle defaultTarget) { final XSLTC xsltc = classGen.getParser().getXSLTC(); final ConstantPoolGen cpg = classGen.getConstantPool(); // Append switch() statement - namespace test dispatch loop final Vector namespaces = xsltc.getNamespaceIndex(); final Vector names = xsltc.getNamesIndex(); final int namespaceCount = namespaces.size() + 1; final int namesCount = names.size(); final InstructionList il = new InstructionList(); final int[] types = new int[namespaceCount]; final InstructionHandle[] targets = new InstructionHandle[types.length]; if (namespaceCount > 0) { boolean compiled = false; // Initialize targets for namespace() switch statement for (int i = 0; i < namespaceCount; i++) { targets[i] = defaultTarget; types[i] = i; } // Add test sequences for known namespace types for (int i = DTM.NTYPES; i < (DTM.NTYPES+namesCount); i++) { if ((isNamespace[i]) && (isAttribute[i] == attrFlag)) { String name = (String)names.elementAt(i-DTM.NTYPES); String namespace = name.substring(0,name.lastIndexOf(':')); final int type = xsltc.registerNamespace(namespace); if ((i < _testSeq.length) && (_testSeq[i] != null)) { targets[type] = (_testSeq[i]).compile(classGen, methodGen, defaultTarget); compiled = true; } } } // Return "null" if no test sequences were compiled if (!compiled) return(null); // Append first code in applyTemplates() - get type of current node final int getNS = cpg.addInterfaceMethodref(DOM_INTF, "getNamespaceType", "(I)I"); il.append(methodGen.loadDOM()); il.append(new ILOAD(_currentIndex)); il.append(new INVOKEINTERFACE(getNS, 2)); il.append(new SWITCH(types, targets, defaultTarget)); return(il); } else { return(null); } }
Example #3
Source File: Mode.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
private InstructionList compileNamespaces(ClassGenerator classGen, MethodGenerator methodGen, boolean[] isNamespace, boolean[] isAttribute, boolean attrFlag, InstructionHandle defaultTarget) { final XSLTC xsltc = classGen.getParser().getXSLTC(); final ConstantPoolGen cpg = classGen.getConstantPool(); // Append switch() statement - namespace test dispatch loop final Vector namespaces = xsltc.getNamespaceIndex(); final Vector names = xsltc.getNamesIndex(); final int namespaceCount = namespaces.size() + 1; final int namesCount = names.size(); final InstructionList il = new InstructionList(); final int[] types = new int[namespaceCount]; final InstructionHandle[] targets = new InstructionHandle[types.length]; if (namespaceCount > 0) { boolean compiled = false; // Initialize targets for namespace() switch statement for (int i = 0; i < namespaceCount; i++) { targets[i] = defaultTarget; types[i] = i; } // Add test sequences for known namespace types for (int i = DTM.NTYPES; i < (DTM.NTYPES+namesCount); i++) { if ((isNamespace[i]) && (isAttribute[i] == attrFlag)) { String name = (String)names.elementAt(i-DTM.NTYPES); String namespace = name.substring(0,name.lastIndexOf(':')); final int type = xsltc.registerNamespace(namespace); if ((i < _testSeq.length) && (_testSeq[i] != null)) { targets[type] = (_testSeq[i]).compile(classGen, methodGen, defaultTarget); compiled = true; } } } // Return "null" if no test sequences were compiled if (!compiled) return(null); // Append first code in applyTemplates() - get type of current node final int getNS = cpg.addInterfaceMethodref(DOM_INTF, "getNamespaceType", "(I)I"); il.append(methodGen.loadDOM()); il.append(new ILOAD(_currentIndex)); il.append(new INVOKEINTERFACE(getNS, 2)); il.append(new SWITCH(types, targets, defaultTarget)); return(il); } else { return(null); } }
Example #4
Source File: Mode.java From JDKSourceCode1.8 with MIT License | 4 votes |
private InstructionList compileNamespaces(ClassGenerator classGen, MethodGenerator methodGen, boolean[] isNamespace, boolean[] isAttribute, boolean attrFlag, InstructionHandle defaultTarget) { final XSLTC xsltc = classGen.getParser().getXSLTC(); final ConstantPoolGen cpg = classGen.getConstantPool(); // Append switch() statement - namespace test dispatch loop final Vector namespaces = xsltc.getNamespaceIndex(); final Vector names = xsltc.getNamesIndex(); final int namespaceCount = namespaces.size() + 1; final int namesCount = names.size(); final InstructionList il = new InstructionList(); final int[] types = new int[namespaceCount]; final InstructionHandle[] targets = new InstructionHandle[types.length]; if (namespaceCount > 0) { boolean compiled = false; // Initialize targets for namespace() switch statement for (int i = 0; i < namespaceCount; i++) { targets[i] = defaultTarget; types[i] = i; } // Add test sequences for known namespace types for (int i = DTM.NTYPES; i < (DTM.NTYPES+namesCount); i++) { if ((isNamespace[i]) && (isAttribute[i] == attrFlag)) { String name = (String)names.elementAt(i-DTM.NTYPES); String namespace = name.substring(0,name.lastIndexOf(':')); final int type = xsltc.registerNamespace(namespace); if ((i < _testSeq.length) && (_testSeq[i] != null)) { targets[type] = (_testSeq[i]).compile(classGen, methodGen, defaultTarget); compiled = true; } } } // Return "null" if no test sequences were compiled if (!compiled) return(null); // Append first code in applyTemplates() - get type of current node final int getNS = cpg.addInterfaceMethodref(DOM_INTF, "getNamespaceType", "(I)I"); il.append(methodGen.loadDOM()); il.append(new ILOAD(_currentIndex)); il.append(new INVOKEINTERFACE(getNS, 2)); il.append(new SWITCH(types, targets, defaultTarget)); return(il); } else { return(null); } }
Example #5
Source File: Mode.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
private InstructionList compileNamespaces(ClassGenerator classGen, MethodGenerator methodGen, boolean[] isNamespace, boolean[] isAttribute, boolean attrFlag, InstructionHandle defaultTarget) { final XSLTC xsltc = classGen.getParser().getXSLTC(); final ConstantPoolGen cpg = classGen.getConstantPool(); // Append switch() statement - namespace test dispatch loop final Vector namespaces = xsltc.getNamespaceIndex(); final Vector names = xsltc.getNamesIndex(); final int namespaceCount = namespaces.size() + 1; final int namesCount = names.size(); final InstructionList il = new InstructionList(); final int[] types = new int[namespaceCount]; final InstructionHandle[] targets = new InstructionHandle[types.length]; if (namespaceCount > 0) { boolean compiled = false; // Initialize targets for namespace() switch statement for (int i = 0; i < namespaceCount; i++) { targets[i] = defaultTarget; types[i] = i; } // Add test sequences for known namespace types for (int i = DTM.NTYPES; i < (DTM.NTYPES+namesCount); i++) { if ((isNamespace[i]) && (isAttribute[i] == attrFlag)) { String name = (String)names.elementAt(i-DTM.NTYPES); String namespace = name.substring(0,name.lastIndexOf(':')); final int type = xsltc.registerNamespace(namespace); if ((i < _testSeq.length) && (_testSeq[i] != null)) { targets[type] = (_testSeq[i]).compile(classGen, methodGen, defaultTarget); compiled = true; } } } // Return "null" if no test sequences were compiled if (!compiled) return(null); // Append first code in applyTemplates() - get type of current node final int getNS = cpg.addInterfaceMethodref(DOM_INTF, "getNamespaceType", "(I)I"); il.append(methodGen.loadDOM()); il.append(new ILOAD(_currentIndex)); il.append(new INVOKEINTERFACE(getNS, 2)); il.append(new SWITCH(types, targets, defaultTarget)); return(il); } else { return(null); } }
Example #6
Source File: Mode.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
private InstructionList compileNamespaces(ClassGenerator classGen, MethodGenerator methodGen, boolean[] isNamespace, boolean[] isAttribute, boolean attrFlag, InstructionHandle defaultTarget) { final XSLTC xsltc = classGen.getParser().getXSLTC(); final ConstantPoolGen cpg = classGen.getConstantPool(); // Append switch() statement - namespace test dispatch loop final Vector namespaces = xsltc.getNamespaceIndex(); final Vector names = xsltc.getNamesIndex(); final int namespaceCount = namespaces.size() + 1; final int namesCount = names.size(); final InstructionList il = new InstructionList(); final int[] types = new int[namespaceCount]; final InstructionHandle[] targets = new InstructionHandle[types.length]; if (namespaceCount > 0) { boolean compiled = false; // Initialize targets for namespace() switch statement for (int i = 0; i < namespaceCount; i++) { targets[i] = defaultTarget; types[i] = i; } // Add test sequences for known namespace types for (int i = DTM.NTYPES; i < (DTM.NTYPES+namesCount); i++) { if ((isNamespace[i]) && (isAttribute[i] == attrFlag)) { String name = (String)names.elementAt(i-DTM.NTYPES); String namespace = name.substring(0,name.lastIndexOf(':')); final int type = xsltc.registerNamespace(namespace); if ((i < _testSeq.length) && (_testSeq[i] != null)) { targets[type] = (_testSeq[i]).compile(classGen, methodGen, defaultTarget); compiled = true; } } } // Return "null" if no test sequences were compiled if (!compiled) return(null); // Append first code in applyTemplates() - get type of current node final int getNS = cpg.addInterfaceMethodref(DOM_INTF, "getNamespaceType", "(I)I"); il.append(methodGen.loadDOM()); il.append(new ILOAD(_currentIndex)); il.append(new INVOKEINTERFACE(getNS, 2)); il.append(new SWITCH(types, targets, defaultTarget)); return(il); } else { return(null); } }
Example #7
Source File: Mode.java From Bytecoder with Apache License 2.0 | 4 votes |
private InstructionList compileNamespaces(ClassGenerator classGen, MethodGenerator methodGen, boolean[] isNamespace, boolean[] isAttribute, boolean attrFlag, InstructionHandle defaultTarget) { final XSLTC xsltc = classGen.getParser().getXSLTC(); final ConstantPoolGen cpg = classGen.getConstantPool(); // Append switch() statement - namespace test dispatch loop final List<String> namespaces = xsltc.getNamespaceIndex(); final List<String> names = xsltc.getNamesIndex(); final int namespaceCount = namespaces.size() + 1; final int namesCount = names.size(); final InstructionList il = new InstructionList(); final int[] types = new int[namespaceCount]; final InstructionHandle[] targets = new InstructionHandle[types.length]; if (namespaceCount > 0) { boolean compiled = false; // Initialize targets for namespace() switch statement for (int i = 0; i < namespaceCount; i++) { targets[i] = defaultTarget; types[i] = i; } // Add test sequences for known namespace types for (int i = DTM.NTYPES; i < (DTM.NTYPES+namesCount); i++) { if ((isNamespace[i]) && (isAttribute[i] == attrFlag)) { String name = names.get(i-DTM.NTYPES); String namespace = name.substring(0,name.lastIndexOf(':')); final int type = xsltc.registerNamespace(namespace); if ((i < _testSeq.length) && (_testSeq[i] != null)) { targets[type] = (_testSeq[i]).compile(classGen, methodGen, defaultTarget); compiled = true; } } } // Return "null" if no test sequences were compiled if (!compiled) return(null); // Append first code in applyTemplates() - get type of current node final int getNS = cpg.addInterfaceMethodref(DOM_INTF, "getNamespaceType", "(I)I"); il.append(methodGen.loadDOM()); il.append(new ILOAD(_currentIndex)); il.append(new INVOKEINTERFACE(getNS, 2)); il.append(new SWITCH(types, targets, defaultTarget)); return(il); } else { return(null); } }
Example #8
Source File: Mode.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
private InstructionList compileNamespaces(ClassGenerator classGen, MethodGenerator methodGen, boolean[] isNamespace, boolean[] isAttribute, boolean attrFlag, InstructionHandle defaultTarget) { final XSLTC xsltc = classGen.getParser().getXSLTC(); final ConstantPoolGen cpg = classGen.getConstantPool(); // Append switch() statement - namespace test dispatch loop final Vector namespaces = xsltc.getNamespaceIndex(); final Vector names = xsltc.getNamesIndex(); final int namespaceCount = namespaces.size() + 1; final int namesCount = names.size(); final InstructionList il = new InstructionList(); final int[] types = new int[namespaceCount]; final InstructionHandle[] targets = new InstructionHandle[types.length]; if (namespaceCount > 0) { boolean compiled = false; // Initialize targets for namespace() switch statement for (int i = 0; i < namespaceCount; i++) { targets[i] = defaultTarget; types[i] = i; } // Add test sequences for known namespace types for (int i = DTM.NTYPES; i < (DTM.NTYPES+namesCount); i++) { if ((isNamespace[i]) && (isAttribute[i] == attrFlag)) { String name = (String)names.elementAt(i-DTM.NTYPES); String namespace = name.substring(0,name.lastIndexOf(':')); final int type = xsltc.registerNamespace(namespace); if ((i < _testSeq.length) && (_testSeq[i] != null)) { targets[type] = (_testSeq[i]).compile(classGen, methodGen, defaultTarget); compiled = true; } } } // Return "null" if no test sequences were compiled if (!compiled) return(null); // Append first code in applyTemplates() - get type of current node final int getNS = cpg.addInterfaceMethodref(DOM_INTF, "getNamespaceType", "(I)I"); il.append(methodGen.loadDOM()); il.append(new ILOAD(_currentIndex)); il.append(new INVOKEINTERFACE(getNS, 2)); il.append(new SWITCH(types, targets, defaultTarget)); return(il); } else { return(null); } }
Example #9
Source File: Mode.java From hottub with GNU General Public License v2.0 | 4 votes |
private InstructionList compileNamespaces(ClassGenerator classGen, MethodGenerator methodGen, boolean[] isNamespace, boolean[] isAttribute, boolean attrFlag, InstructionHandle defaultTarget) { final XSLTC xsltc = classGen.getParser().getXSLTC(); final ConstantPoolGen cpg = classGen.getConstantPool(); // Append switch() statement - namespace test dispatch loop final Vector namespaces = xsltc.getNamespaceIndex(); final Vector names = xsltc.getNamesIndex(); final int namespaceCount = namespaces.size() + 1; final int namesCount = names.size(); final InstructionList il = new InstructionList(); final int[] types = new int[namespaceCount]; final InstructionHandle[] targets = new InstructionHandle[types.length]; if (namespaceCount > 0) { boolean compiled = false; // Initialize targets for namespace() switch statement for (int i = 0; i < namespaceCount; i++) { targets[i] = defaultTarget; types[i] = i; } // Add test sequences for known namespace types for (int i = DTM.NTYPES; i < (DTM.NTYPES+namesCount); i++) { if ((isNamespace[i]) && (isAttribute[i] == attrFlag)) { String name = (String)names.elementAt(i-DTM.NTYPES); String namespace = name.substring(0,name.lastIndexOf(':')); final int type = xsltc.registerNamespace(namespace); if ((i < _testSeq.length) && (_testSeq[i] != null)) { targets[type] = (_testSeq[i]).compile(classGen, methodGen, defaultTarget); compiled = true; } } } // Return "null" if no test sequences were compiled if (!compiled) return(null); // Append first code in applyTemplates() - get type of current node final int getNS = cpg.addInterfaceMethodref(DOM_INTF, "getNamespaceType", "(I)I"); il.append(methodGen.loadDOM()); il.append(new ILOAD(_currentIndex)); il.append(new INVOKEINTERFACE(getNS, 2)); il.append(new SWITCH(types, targets, defaultTarget)); return(il); } else { return(null); } }
Example #10
Source File: Mode.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
private InstructionList compileNamespaces(ClassGenerator classGen, MethodGenerator methodGen, boolean[] isNamespace, boolean[] isAttribute, boolean attrFlag, InstructionHandle defaultTarget) { final XSLTC xsltc = classGen.getParser().getXSLTC(); final ConstantPoolGen cpg = classGen.getConstantPool(); // Append switch() statement - namespace test dispatch loop final Vector namespaces = xsltc.getNamespaceIndex(); final Vector names = xsltc.getNamesIndex(); final int namespaceCount = namespaces.size() + 1; final int namesCount = names.size(); final InstructionList il = new InstructionList(); final int[] types = new int[namespaceCount]; final InstructionHandle[] targets = new InstructionHandle[types.length]; if (namespaceCount > 0) { boolean compiled = false; // Initialize targets for namespace() switch statement for (int i = 0; i < namespaceCount; i++) { targets[i] = defaultTarget; types[i] = i; } // Add test sequences for known namespace types for (int i = DTM.NTYPES; i < (DTM.NTYPES+namesCount); i++) { if ((isNamespace[i]) && (isAttribute[i] == attrFlag)) { String name = (String)names.elementAt(i-DTM.NTYPES); String namespace = name.substring(0,name.lastIndexOf(':')); final int type = xsltc.registerNamespace(namespace); if ((i < _testSeq.length) && (_testSeq[i] != null)) { targets[type] = (_testSeq[i]).compile(classGen, methodGen, defaultTarget); compiled = true; } } } // Return "null" if no test sequences were compiled if (!compiled) return(null); // Append first code in applyTemplates() - get type of current node final int getNS = cpg.addInterfaceMethodref(DOM_INTF, "getNamespaceType", "(I)I"); il.append(methodGen.loadDOM()); il.append(new ILOAD(_currentIndex)); il.append(new INVOKEINTERFACE(getNS, 2)); il.append(new SWITCH(types, targets, defaultTarget)); return(il); } else { return(null); } }
Example #11
Source File: Mode.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
private InstructionList compileNamespaces(ClassGenerator classGen, MethodGenerator methodGen, boolean[] isNamespace, boolean[] isAttribute, boolean attrFlag, InstructionHandle defaultTarget) { final XSLTC xsltc = classGen.getParser().getXSLTC(); final ConstantPoolGen cpg = classGen.getConstantPool(); // Append switch() statement - namespace test dispatch loop final Vector namespaces = xsltc.getNamespaceIndex(); final Vector names = xsltc.getNamesIndex(); final int namespaceCount = namespaces.size() + 1; final int namesCount = names.size(); final InstructionList il = new InstructionList(); final int[] types = new int[namespaceCount]; final InstructionHandle[] targets = new InstructionHandle[types.length]; if (namespaceCount > 0) { boolean compiled = false; // Initialize targets for namespace() switch statement for (int i = 0; i < namespaceCount; i++) { targets[i] = defaultTarget; types[i] = i; } // Add test sequences for known namespace types for (int i = DTM.NTYPES; i < (DTM.NTYPES+namesCount); i++) { if ((isNamespace[i]) && (isAttribute[i] == attrFlag)) { String name = (String)names.elementAt(i-DTM.NTYPES); String namespace = name.substring(0,name.lastIndexOf(':')); final int type = xsltc.registerNamespace(namespace); if ((i < _testSeq.length) && (_testSeq[i] != null)) { targets[type] = (_testSeq[i]).compile(classGen, methodGen, defaultTarget); compiled = true; } } } // Return "null" if no test sequences were compiled if (!compiled) return(null); // Append first code in applyTemplates() - get type of current node final int getNS = cpg.addInterfaceMethodref(DOM_INTF, "getNamespaceType", "(I)I"); il.append(methodGen.loadDOM()); il.append(new ILOAD(_currentIndex)); il.append(new INVOKEINTERFACE(getNS, 2)); il.append(new SWITCH(types, targets, defaultTarget)); return(il); } else { return(null); } }