本文整理汇总了Java中com.sun.org.apache.bcel.internal.generic.InstructionList.getEnd方法的典型用法代码示例。如果您正苦于以下问题:Java InstructionList.getEnd方法的具体用法?Java InstructionList.getEnd怎么用?Java InstructionList.getEnd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.org.apache.bcel.internal.generic.InstructionList
的用法示例。
在下文中一共展示了InstructionList.getEnd方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: translate
import com.sun.org.apache.bcel.internal.generic.InstructionList; //导入方法依赖的package包/类
/**
* Translate the "test" expression and contents of this element.
* The contents will be ignored if we know the test will always fail.
*/
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
final InstructionList il = methodGen.getInstructionList();
_test.translateDesynthesized(classGen, methodGen);
// remember end of condition
final InstructionHandle truec = il.getEnd();
if (!_ignore) {
translateContents(classGen, methodGen);
}
_test.backPatchFalseList(il.append(NOP));
_test.backPatchTrueList(truec.getNext());
}
示例2: getGeneratedMethods
import com.sun.org.apache.bcel.internal.generic.InstructionList; //导入方法依赖的package包/类
/**
* <p>Get all {@link Method}s generated by this {@link MethodGenerator}.
* The {@link MethodGen#getMethod()} only returns a single
* <code>Method</code> object. This method takes into account the Java
* Virtual Machine Specification limit of 64KB on the size of a method, and
* may return more than one <code>Method</code>.</p>
* <p>If the code associated with the <code>MethodGenerator</code> would
* exceed the 64KB limit, this method will attempt to split the code in
* the {@link InstructionList} associated with this
* <code>MethodGenerator</code> into several methods.</p>
* @param classGen the {@link ClassGenerator} of which these methods are
* members
* @return an array of all the <code>Method</code>s generated
*/
Method[] getGeneratedMethods(ClassGenerator classGen) {
Method[] generatedMethods;
InstructionList il = getInstructionList();
InstructionHandle last = il.getEnd();
il.setPositions();
int instructionListSize =
last.getPosition() + last.getInstruction().getLength();
// Need to look for any branch target offsets that exceed the range
// [-32768,32767]
if (instructionListSize > MAX_BRANCH_TARGET_OFFSET) {
boolean ilChanged = widenConditionalBranchTargetOffsets();
// If any branch instructions needed widening, recompute the size
// of the byte code for the method
if (ilChanged) {
il.setPositions();
last = il.getEnd();
instructionListSize =
last.getPosition() + last.getInstruction().getLength();
}
}
if (instructionListSize > MAX_METHOD_SIZE) {
generatedMethods = outlineChunks(classGen, instructionListSize);
} else {
generatedMethods = new Method[] {getThisMethod()};
}
return generatedMethods;
}