本文整理汇总了Java中com.sun.org.apache.bcel.internal.generic.ConstantPoolGen类的典型用法代码示例。如果您正苦于以下问题:Java ConstantPoolGen类的具体用法?Java ConstantPoolGen怎么用?Java ConstantPoolGen使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConstantPoolGen类属于com.sun.org.apache.bcel.internal.generic包,在下文中一共展示了ConstantPoolGen类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: compileInit
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; //导入依赖的package包/类
/**
* Create a constructor for the new class. Updates the reference to the
* collator in the super calls only when the stylesheet specifies a new
* language in xsl:sort.
*/
private static MethodGenerator compileInit(Vector sortObjects,
NodeSortRecordGenerator sortRecord,
ConstantPoolGen cpg,
String className)
{
final InstructionList il = new InstructionList();
final MethodGenerator init =
new MethodGenerator(ACC_PUBLIC,
com.sun.org.apache.bcel.internal.generic.Type.VOID,
null, null, "<init>", className,
il, cpg);
// Call the constructor in the NodeSortRecord superclass
il.append(ALOAD_0);
il.append(new INVOKESPECIAL(cpg.addMethodref(NODE_SORT_RECORD,
"<init>", "()V")));
il.append(RETURN);
return init;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:29,代码来源:Sort.java
示例2: compileDefaultRecursion
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; //导入依赖的package包/类
/**
* Compiles the default handling for DOM elements: traverse all children
*/
private InstructionList compileDefaultRecursion(ClassGenerator classGen,
MethodGenerator methodGen,
InstructionHandle next) {
final ConstantPoolGen cpg = classGen.getConstantPool();
final InstructionList il = new InstructionList();
final String applyTemplatesSig = classGen.getApplyTemplatesSig();
final int git = cpg.addInterfaceMethodref(DOM_INTF,
GET_CHILDREN,
GET_CHILDREN_SIG);
final int applyTemplates = cpg.addMethodref(getClassName(),
functionName(),
applyTemplatesSig);
il.append(classGen.loadTranslet());
il.append(methodGen.loadDOM());
il.append(methodGen.loadDOM());
il.append(new ILOAD(_currentIndex));
il.append(new INVOKEINTERFACE(git, 2));
il.append(methodGen.loadHandler());
il.append(new INVOKEVIRTUAL(applyTemplates));
il.append(new GOTO_W(next));
return il;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:Mode.java
示例3: translateTo
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; //导入依赖的package包/类
/**
* Translates reference into object of internal type <code>type</code>.
*
* @see com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo
*/
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
StringType type) {
final int current = methodGen.getLocalIndex("current");
ConstantPoolGen cpg = classGen.getConstantPool();
InstructionList il = methodGen.getInstructionList();
// If no current, conversion is a top-level
if (current < 0) {
il.append(new PUSH(cpg, DTM.ROOT_NODE)); // push root node
}
else {
il.append(new ILOAD(current));
}
il.append(methodGen.loadDOM());
final int stringF = cpg.addMethodref(BASIS_LIBRARY_CLASS,
"stringF",
"("
+ OBJECT_SIG
+ NODE_SIG
+ DOM_INTF_SIG
+ ")" + STRING_SIG);
il.append(new INVOKESTATIC(stringF));
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:29,代码来源:ReferenceType.java
示例4: compileDefaultText
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; //导入依赖的package包/类
/**
* Compiles the default action for DOM text nodes and attribute nodes:
* output the node's text value
*/
private InstructionList compileDefaultText(ClassGenerator classGen,
MethodGenerator methodGen,
InstructionHandle next) {
final ConstantPoolGen cpg = classGen.getConstantPool();
final InstructionList il = new InstructionList();
final int chars = cpg.addInterfaceMethodref(DOM_INTF,
CHARACTERS,
CHARACTERS_SIG);
il.append(methodGen.loadDOM());
il.append(new ILOAD(_currentIndex));
il.append(methodGen.loadHandler());
il.append(new INVOKEINTERFACE(chars, 3));
il.append(new GOTO_W(next));
return il;
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:Mode.java
示例5: translate
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; //导入依赖的package包/类
/**
* This method is called when the constructor is compiled in
* Stylesheet.compileConstructor() and not as the syntax tree is traversed.
*/
public void translate(ClassGenerator classGen,
MethodGenerator methodGen) {
final ConstantPoolGen cpg = classGen.getConstantPool();
final InstructionList il = methodGen.getInstructionList();
// Returns the name of a node in the DOM
final int getNodeName = cpg.addInterfaceMethodref(DOM_INTF,
"getNodeName",
"(I)"+STRING_SIG);
final int getLocalName = cpg.addMethodref(BASIS_LIBRARY_CLASS,
"getLocalName",
"(Ljava/lang/String;)"+
"Ljava/lang/String;");
super.translate(classGen, methodGen);
il.append(new INVOKEINTERFACE(getNodeName, 2));
il.append(new INVOKESTATIC(getLocalName));
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:LocalNameCall.java
示例6: loadAsArrayOffsetLength
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; //导入依赖的package包/类
/**
* Generates code that loads the array that will contain the character
* data represented by this Text node, followed by the offset of the
* data from the start of the array, and then the length of the data.
*
* The pre-condition to calling this method is that
* canLoadAsArrayOffsetLength() returns true.
* @see #canLoadArrayOffsetLength()
*/
public void loadAsArrayOffsetLength(ClassGenerator classGen,
MethodGenerator methodGen) {
final ConstantPoolGen cpg = classGen.getConstantPool();
final InstructionList il = methodGen.getInstructionList();
final XSLTC xsltc = classGen.getParser().getXSLTC();
// The XSLTC object keeps track of character data
// that is to be stored in char arrays.
final int offset = xsltc.addCharacterData(_text);
final int length = _text.length();
String charDataFieldName =
STATIC_CHAR_DATA_FIELD + (xsltc.getCharacterDataCount()-1);
il.append(new GETSTATIC(cpg.addFieldref(xsltc.getClassName(),
charDataFieldName,
STATIC_CHAR_DATA_FIELD_SIG)));
il.append(new PUSH(cpg, offset));
il.append(new PUSH(cpg, _text.length()));
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:29,代码来源:Text.java
示例7: translate
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; //导入依赖的package包/类
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
final InstructionList il = methodGen.getInstructionList();
if (methodGen instanceof CompareGenerator) {
il.append(((CompareGenerator)methodGen).loadLastNode());
}
else if (methodGen instanceof TestGenerator) {
il.append(new ILOAD(LAST_INDEX));
}
else {
final ConstantPoolGen cpg = classGen.getConstantPool();
final int getLast = cpg.addInterfaceMethodref(NODE_ITERATOR,
"getLast",
"()I");
il.append(methodGen.loadIterator());
il.append(new INVOKEINTERFACE(getLast, 1));
}
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:LastCall.java
示例8: translate
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; //导入依赖的package包/类
/**
* Translate a predicate expression. If non of the optimizations apply
* then this translation pushes two references on the stack: a reference
* to a newly created filter object and a reference to the predicate's
* closure. See class <code>Step</code> for further details.
*/
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
final ConstantPoolGen cpg = classGen.getConstantPool();
final InstructionList il = methodGen.getInstructionList();
if (_nthPositionFilter || _nthDescendant) {
_exp.translate(classGen, methodGen);
}
else if (isNodeValueTest() && (getParent() instanceof Step)) {
_value.translate(classGen, methodGen);
il.append(new CHECKCAST(cpg.addClass(STRING_CLASS)));
il.append(new PUSH(cpg, ((EqualityExpr)_exp).getOp()));
}
else {
translateFilter(classGen, methodGen);
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:Predicate.java
示例9: translateValue
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; //导入依赖的package包/类
/**
* Compile the value of the parameter, which is either in an expression in
* a 'select' attribute, or in the with-param element's body
*/
public void translateValue(ClassGenerator classGen,
MethodGenerator methodGen) {
// Compile expression is 'select' attribute if present
if (_select != null) {
_select.translate(classGen, methodGen);
_select.startIterator(classGen, methodGen);
}
// If not, compile result tree from parameter body if present.
else if (hasContents()) {
compileResultTree(classGen, methodGen);
}
// If neither are present then store empty string in parameter slot
else {
final ConstantPoolGen cpg = classGen.getConstantPool();
final InstructionList il = methodGen.getInstructionList();
il.append(new PUSH(cpg, Constants.EMPTYSTRING));
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:WithParam.java
示例10: translate
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; //导入依赖的package包/类
/**
* This method is called when the constructor is compiled in
* Stylesheet.compileConstructor() and not as the syntax tree is traversed.
*/
public void translate(ClassGenerator classGen,
MethodGenerator methodGen) {
final ConstantPoolGen cpg = classGen.getConstantPool();
final InstructionList il = methodGen.getInstructionList();
final int tst = cpg.addMethodref(BASIS_LIBRARY_CLASS,
"testLanguage",
"("+STRING_SIG+DOM_INTF_SIG+"I)Z");
_lang.translate(classGen,methodGen);
il.append(methodGen.loadDOM());
if (classGen instanceof FilterGenerator)
il.append(new ILOAD(1));
else
il.append(methodGen.loadContextNode());
il.append(new INVOKESTATIC(tst));
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:LangCall.java
示例11: translateTo
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; //导入依赖的package包/类
/**
* Expects an integer on the stack and pushes its string value by calling
* <code>Integer.toString(int i)</code>.
*
* @see com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo
*/
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
StringType type) {
final ConstantPoolGen cpg = classGen.getConstantPool();
final InstructionList il = methodGen.getInstructionList();
il.append(DUP);
final BranchHandle ifNull = il.append(new IFNULL(null));
il.append(new INVOKEVIRTUAL(cpg.addMethodref(_javaClassName,
"toString",
"()" + STRING_SIG)));
final BranchHandle gotobh = il.append(new GOTO(null));
ifNull.setTarget(il.append(POP));
il.append(new PUSH(cpg, ""));
gotobh.setTarget(il.append(NOP));
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:ObjectType.java
示例12: compileInit
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; //导入依赖的package包/类
/**
* Create a constructor for the new class. Updates the reference to the
* collator in the super calls only when the stylesheet specifies a new
* language in xsl:sort.
*/
private static MethodGenerator compileInit(NodeSortRecordGenerator sortRecord,
ConstantPoolGen cpg,
String className)
{
final InstructionList il = new InstructionList();
final MethodGenerator init =
new MethodGenerator(ACC_PUBLIC,
com.sun.org.apache.bcel.internal.generic.Type.VOID,
null, null, "<init>", className,
il, cpg);
// Call the constructor in the NodeSortRecord superclass
il.append(ALOAD_0);
il.append(new INVOKESPECIAL(cpg.addMethodref(NODE_SORT_RECORD,
"<init>", "()V")));
il.append(RETURN);
return init;
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:28,代码来源:Sort.java
示例13: releaseResultTree
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; //导入依赖的package包/类
/**
* Release the compiled result tree.
*/
public void releaseResultTree(ClassGenerator classGen,
MethodGenerator methodGen)
{
if (_domAdapter != null) {
final ConstantPoolGen cpg = classGen.getConstantPool();
final InstructionList il = methodGen.getInstructionList();
if (classGen.getStylesheet().callsNodeset() &&
classGen.getDOMClass().equals(MULTI_DOM_CLASS))
{
final int removeDA =
cpg.addMethodref(MULTI_DOM_CLASS, "removeDOMAdapter",
"(" + DOM_ADAPTER_SIG + ")V");
il.append(methodGen.loadDOM());
il.append(new CHECKCAST(cpg.addClass(MULTI_DOM_CLASS)));
il.append(new ALOAD(_domAdapter.getIndex()));
il.append(new CHECKCAST(cpg.addClass(DOM_ADAPTER_CLASS)));
il.append(new INVOKEVIRTUAL(removeDA));
}
final int release =
cpg.addInterfaceMethodref(DOM_IMPL_CLASS, "release", "()V");
il.append(new ALOAD(_domAdapter.getIndex()));
il.append(new INVOKEINTERFACE(release, 1));
_domAdapter.setEnd(il.getEnd());
methodGen.removeLocalVariable(_domAdapter);
_domAdapter = null;
}
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:31,代码来源:WithParam.java
示例14: compileGetChildren
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; //导入依赖的package包/类
public static void compileGetChildren(ClassGenerator classGen,
MethodGenerator methodGen,
int node) {
final ConstantPoolGen cpg = classGen.getConstantPool();
final InstructionList il = methodGen.getInstructionList();
final int git = cpg.addInterfaceMethodref(DOM_INTF,
GET_CHILDREN,
GET_CHILDREN_SIG);
il.append(methodGen.loadDOM());
il.append(new ILOAD(node));
il.append(new INVOKEINTERFACE(git, 2));
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:Mode.java
示例15: initialize
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; //导入依赖的package包/类
/**
* This method is part of a little trick that is needed to use local
* variables inside nested for-each loops. See the initializeVariables()
* method in the ForEach class for an explanation
*/
public void initialize(ClassGenerator classGen, MethodGenerator methodGen) {
final ConstantPoolGen cpg = classGen.getConstantPool();
final InstructionList il = methodGen.getInstructionList();
// This is only done for local variables that are actually used
if (isLocal() && !_refs.isEmpty()) {
// Create a variable slot if none is allocated
if (_local == null) {
_local = methodGen.addLocalVariable2(getEscapedName(),
_type.toJCType(),
null);
}
// Push the default value on the JVM's stack
if ((_type instanceof IntType) ||
(_type instanceof NodeType) ||
(_type instanceof BooleanType))
il.append(new ICONST(0)); // 0 for node-id, integer and boolean
else if (_type instanceof RealType)
il.append(new DCONST(0)); // 0.0 for floating point numbers
else
il.append(new ACONST_NULL()); // and 'null' for anything else
// Mark the store as the start of the live range of the variable
_local.setStart(il.append(_type.STORE(_local.getIndex())));
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:33,代码来源:Variable.java
示例16: translate
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; //导入依赖的package包/类
/**
* Translate the code required for getting the node for which the
* QName, local-name or namespace URI should be extracted.
*/
public void translate(ClassGenerator classGen,
MethodGenerator methodGen) {
final ConstantPoolGen cpg = classGen.getConstantPool();
final InstructionList il = methodGen.getInstructionList();
il.append(methodGen.loadDOM());
// Function was called with no parameters
if (argumentCount() == 0) {
il.append(methodGen.loadContextNode());
}
// Function was called with node parameter
else if (_paramType == Type.Node) {
_param.translate(classGen, methodGen);
}
else if (_paramType == Type.Reference) {
_param.translate(classGen, methodGen);
il.append(new INVOKESTATIC(cpg.addMethodref
(BASIS_LIBRARY_CLASS,
"referenceToNodeSet",
"("
+ OBJECT_SIG
+ ")"
+ NODE_ITERATOR_SIG)));
il.append(methodGen.nextNode());
}
// Function was called with node-set parameter
else {
_param.translate(classGen, methodGen);
_param.startIterator(classGen, methodGen);
il.append(methodGen.nextNode());
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:38,代码来源:NameBase.java
示例17: translate
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; //导入依赖的package包/类
/**
* Generate a call to the method compiled for this attribute set
*/
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
final ConstantPoolGen cpg = classGen.getConstantPool();
final InstructionList il = methodGen.getInstructionList();
final SymbolTable symbolTable = getParser().getSymbolTable();
// Go through each attribute set and generate a method call
for (int i=0; i<_sets.size(); i++) {
// Get the attribute set name
final QName name = (QName)_sets.elementAt(i);
// Get the AttributeSet reference from the symbol table
final AttributeSet attrs = symbolTable.lookupAttributeSet(name);
// Compile the call to the set's method if the set exists
if (attrs != null) {
final String methodName = attrs.getMethodName();
il.append(classGen.loadTranslet());
il.append(methodGen.loadDOM());
il.append(methodGen.loadIterator());
il.append(methodGen.loadHandler());
il.append(methodGen.loadCurrentNode());
final int method = cpg.addMethodref(classGen.getClassName(),
methodName, ATTR_SET_SIG);
il.append(new INVOKESPECIAL(method));
}
// Generate an error if the attribute set does not exist
else {
final Parser parser = getParser();
final String atrs = name.toString();
reportError(this, parser, ErrorMsg.ATTRIBSET_UNDEF_ERR, atrs);
}
}
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:36,代码来源:UseAttributeSets.java
示例18: translateUnBox
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; //导入依赖的package包/类
/**
* Translates an object of this type to its unboxed representation.
*/
public void translateUnBox(ClassGenerator classGen,
MethodGenerator methodGen) {
final ConstantPoolGen cpg = classGen.getConstantPool();
final InstructionList il = methodGen.getInstructionList();
il.append(new CHECKCAST(cpg.addClass(RUNTIME_NODE_CLASS)));
il.append(new GETFIELD(cpg.addFieldref(RUNTIME_NODE_CLASS,
NODE_FIELD,
NODE_FIELD_SIG)));
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:NodeType.java
示例19: translate
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; //导入依赖的package包/类
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
final ConstantPoolGen cpg = classGen.getConstantPool();
final InstructionList il = methodGen.getInstructionList();
if (argumentCount() > 0) {
argument().translate(classGen, methodGen);
}
else {
il.append(methodGen.loadContextNode());
Type.Node.translateTo(classGen, methodGen, Type.String);
}
il.append(new INVOKESTATIC(cpg.addMethodref(BASIS_LIBRARY_CLASS,
"getStringLength",
"(Ljava/lang/String;)I")));
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:StringLengthCall.java
示例20: translate
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; //导入依赖的package包/类
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
final ConstantPoolGen cpg = classGen.getConstantPool();
final InstructionList il = methodGen.getInstructionList();
_value.translate(classGen, methodGen);
_format.translate(classGen, methodGen);
final int fn3arg = cpg.addMethodref(BASIS_LIBRARY_CLASS,
"formatNumber",
"(DLjava/lang/String;"+
"Ljava/text/DecimalFormat;)"+
"Ljava/lang/String;");
final int get = cpg.addMethodref(TRANSLET_CLASS,
"getDecimalFormat",
"(Ljava/lang/String;)"+
"Ljava/text/DecimalFormat;");
il.append(classGen.loadTranslet());
if (_name == null) {
il.append(new PUSH(cpg, EMPTYSTRING));
}
else if (_resolvedQName != null) {
il.append(new PUSH(cpg, _resolvedQName.toString()));
}
else {
_name.translate(classGen, methodGen);
}
il.append(new INVOKEVIRTUAL(get));
il.append(new INVOKESTATIC(fn3arg));
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:31,代码来源:FormatNumberCall.java
注:本文中的com.sun.org.apache.bcel.internal.generic.ConstantPoolGen类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论