本文整理汇总了Java中com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL类的典型用法代码示例。如果您正苦于以下问题:Java INVOKEVIRTUAL类的具体用法?Java INVOKEVIRTUAL怎么用?Java INVOKEVIRTUAL使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
INVOKEVIRTUAL类属于com.sun.org.apache.bcel.internal.generic包,在下文中一共展示了INVOKEVIRTUAL类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: compileDefaultRecursion
import com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL; //导入依赖的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
示例2: translateTo
import com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL; //导入依赖的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
示例3: unmapRegister
import com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL; //导入依赖的package包/类
/**
* Remove the mapping of this variable to a register.
* Called when we leave the AST scope of the variable's declaration
*/
public void unmapRegister(ClassGenerator classGen, MethodGenerator methodGen) {
if (_local != null) {
if (_type instanceof ResultTreeType) {
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(loadInstruction());
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(loadInstruction());
il.append(new INVOKEINTERFACE(release, 1));
}
_local.setEnd(methodGen.getInstructionList().getEnd());
methodGen.removeLocalVariable(_local);
_refs = null;
_local = null;
}
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:29,代码来源:VariableBase.java
示例4: releaseResultTree
import com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL; //导入依赖的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 = null;
}
}
开发者ID:campolake,项目名称:openjdk9,代码行数:22,代码来源:WithParam.java
示例5: translate
import com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL; //导入依赖的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
示例6: translate
import com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL; //导入依赖的package包/类
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
final ConstantPoolGen cpg = classGen.getConstantPool();
final InstructionList il = methodGen.getInstructionList();
final int init = cpg.addMethodref(UNION_ITERATOR_CLASS,
"<init>",
"("+DOM_INTF_SIG+")V");
final int iter = cpg.addMethodref(UNION_ITERATOR_CLASS,
ADD_ITERATOR,
ADD_ITERATOR_SIG);
// Create the UnionIterator and leave it on the stack
il.append(new NEW(cpg.addClass(UNION_ITERATOR_CLASS)));
il.append(DUP);
il.append(methodGen.loadDOM());
il.append(new INVOKESPECIAL(init));
// Add the various iterators to the UnionIterator
final int length = _components.length;
for (int i = 0; i < length; i++) {
_components[i].translate(classGen, methodGen);
il.append(new INVOKEVIRTUAL(iter));
}
// Order the iterator only if strictly needed
if (_reverse) {
final int order = cpg.addInterfaceMethodref(DOM_INTF,
ORDER_ITERATOR,
ORDER_ITERATOR_SIG);
il.append(methodGen.loadDOM());
il.append(SWAP);
il.append(methodGen.loadContextNode());
il.append(new INVOKEINTERFACE(order, 3));
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:37,代码来源:UnionPathExpr.java
示例7: translateDesynthesized
import com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL; //导入依赖的package包/类
/**
* Compile expression and update true/false-lists
*/
public void translateDesynthesized(ClassGenerator classGen,
MethodGenerator methodGen) {
final ConstantPoolGen cpg = classGen.getConstantPool();
final InstructionList il = methodGen.getInstructionList();
_base.translate(classGen, methodGen);
_token.translate(classGen, methodGen);
il.append(new INVOKEVIRTUAL(cpg.addMethodref(STRING_CLASS,
"indexOf",
"("+STRING_SIG+")I")));
_falseList.add(il.append(new IFLT(null)));
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:ContainsCall.java
示例8: translate
import com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL; //导入依赖的package包/类
/**
* This code generates a sequence of bytecodes that call the
* addParameter() method in AbstractTranslet. The method call will add
* (or update) the parameter frame with the new parameter value.
*/
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
final ConstantPoolGen cpg = classGen.getConstantPool();
final InstructionList il = methodGen.getInstructionList();
// Translate the value and put it on the stack
if (_doParameterOptimization) {
translateValue(classGen, methodGen);
return;
}
// Make name acceptable for use as field name in class
String name = Util.escape(getEscapedName());
// Load reference to the translet (method is in AbstractTranslet)
il.append(classGen.loadTranslet());
// Load the name of the parameter
il.append(new PUSH(cpg, name)); // TODO: namespace ?
// Generete the value of the parameter (use value in 'select' by def.)
translateValue(classGen, methodGen);
// Mark this parameter value is not being the default value
il.append(new PUSH(cpg, false));
// Pass the parameter to the template
il.append(new INVOKEVIRTUAL(cpg.addMethodref(TRANSLET_CLASS,
ADD_PARAMETER,
ADD_PARAMETER_SIG)));
il.append(POP); // cleanup stack
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:34,代码来源:WithParam.java
示例9: translateToDesynthesized
import com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL; //导入依赖的package包/类
/**
* Translates a string into a non-synthesized boolean. It does not push a
* 0 or a 1 but instead returns branchhandle list to be appended to the
* false list.
*
* @see com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateToDesynthesized
*/
public FlowList translateToDesynthesized(ClassGenerator classGen,
MethodGenerator methodGen,
BooleanType type) {
final ConstantPoolGen cpg = classGen.getConstantPool();
final InstructionList il = methodGen.getInstructionList();
il.append(new INVOKEVIRTUAL(cpg.addMethodref(STRING_CLASS,
"length", "()I")));
return new FlowList(il.append(new IFEQ(null)));
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:StringType.java
示例10: translateUnBox
import com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL; //导入依赖的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(INTEGER_CLASS)));
final int index = cpg.addMethodref(INTEGER_CLASS,
INT_VALUE,
INT_VALUE_SIG);
il.append(new INVOKEVIRTUAL(index));
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:IntType.java
示例11: translateUnBox
import com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL; //导入依赖的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(DOUBLE_CLASS)));
il.append(new INVOKEVIRTUAL(cpg.addMethodref(DOUBLE_CLASS,
DOUBLE_VALUE,
DOUBLE_VALUE_SIG)));
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:RealType.java
示例12: translateUnBox
import com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL; //导入依赖的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(BOOLEAN_CLASS)));
il.append(new INVOKEVIRTUAL(cpg.addMethodref(BOOLEAN_CLASS,
BOOLEAN_VALUE,
BOOLEAN_VALUE_SIG)));
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:BooleanType.java
示例13: translate
import com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL; //导入依赖的package包/类
/**
* Compile the expression - leave boolean expression on stack
*/
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
final ConstantPoolGen cpg = classGen.getConstantPool();
final InstructionList il = methodGen.getInstructionList();
_base.translate(classGen, methodGen);
_token.translate(classGen, methodGen);
il.append(new INVOKEVIRTUAL(cpg.addMethodref(STRING_CLASS,
"startsWith",
"("+STRING_SIG+")Z")));
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:StartsWithCall.java
示例14: releaseResultTree
import com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL; //导入依赖的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
示例15: generateAddReads
import com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL; //导入依赖的package包/类
private void generateAddReads(ClassGenerator classGen, MethodGenerator methodGen,
String clazz) {
final ConstantPoolGen cpg = classGen.getConstantPool();
final InstructionList il = methodGen.getInstructionList();
// Generate call to Module.addReads:
// <TransletClass>.class.getModule().addReads(
// Class.forName(<clazz>).getModule());
// Class.forName may throw ClassNotFoundException.
// This is OK as it will caught higher up the stack in
// TransformerImpl.transform() and wrapped into a
// TransformerException.
methodGen.markChunkStart();
int index = cpg.addMethodref(CLASS_CLASS,
GET_MODULE,
GET_MODULE_SIG);
int index2 = cpg.addMethodref(CLASS_CLASS,
FOR_NAME,
FOR_NAME_SIG);
il.append(new LDC(cpg.addString(classGen.getClassName())));
il.append(new INVOKESTATIC(index2));
il.append(new INVOKEVIRTUAL(index));
il.append(new LDC(cpg.addString(clazz)));
il.append(new INVOKESTATIC(index2));
il.append(new INVOKEVIRTUAL(index));
index = cpg.addMethodref(MODULE_CLASS,
ADD_READS,
ADD_READS_SIG);
il.append(new INVOKEVIRTUAL(index));
il.append(InstructionConst.POP);
methodGen.markChunkEnd();
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:35,代码来源:FunctionCall.java
注:本文中的com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论