本文整理汇总了Java中org.apache.bcel.generic.InstructionList.getStart方法的典型用法代码示例。如果您正苦于以下问题:Java InstructionList.getStart方法的具体用法?Java InstructionList.getStart怎么用?Java InstructionList.getStart使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.bcel.generic.InstructionList
的用法示例。
在下文中一共展示了InstructionList.getStart方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: pushParams
import org.apache.bcel.generic.InstructionList; //导入方法依赖的package包/类
InstructionHandle pushParams(InstructionList il, Method m) {
Type[] params = mtab.typesOfParams(m);
InstructionHandle pos = il.getStart();
for (int i = 0, param = 0; i < params.length; i++, param++) {
if (params[i].equals(Type.BOOLEAN) || params[i].equals(Type.BYTE)
|| params[i].equals(Type.SHORT) || params[i].equals(Type.CHAR)
|| params[i].equals(Type.INT)) {
il.insert(pos, new ILOAD(param));
} else if (params[i].equals(Type.FLOAT)) {
il.insert(pos, new FLOAD(param));
} else if (params[i].equals(Type.LONG)) {
il.insert(pos, new LLOAD(param));
param++;
} else if (params[i].equals(Type.DOUBLE)) {
il.insert(pos, new DLOAD(param));
param++;
} else {
il.insert(pos, new ALOAD(param));
}
}
return pos;
}
示例2: callsSync
import org.apache.bcel.generic.InstructionList; //导入方法依赖的package包/类
private boolean callsSync() {
ConstantPoolGen cpg = getConstantPool();
InstructionList instructionList = getInstructionList();
InstructionHandle handle = instructionList.getStart();
while (handle != null) {
Instruction ins = handle.getInstruction();
if (ins instanceof INVOKEVIRTUAL) {
INVOKEVIRTUAL inv = (INVOKEVIRTUAL) ins;
if (inv.getMethodName(cpg).equals("sync") &&
inv.getSignature(cpg).equals("()V")) {
JavaClass cl = findMethodClass(inv, cpg);
if (cl != null && cl.getClassName().equals("ibis.cashmere.CashmereObject")) {
return true;
}
}
}
handle = handle.getNext();
}
return false;
}
示例3: insertAllDeleteLocalRecords
import org.apache.bcel.generic.InstructionList; //导入方法依赖的package包/类
void insertAllDeleteLocalRecords(MethodGen m) {
int maxLocals = m.getMaxLocals();
InstructionList il = m.getInstructionList();
for (InstructionHandle i = il.getStart(); i != null; i = i.getNext()) {
Instruction ins = i.getInstruction();
if (ins instanceof ReturnInstruction) {
i = insertDeleteLocalRecord(m, il, i, maxLocals);
}
}
}
示例4: getSpawnableCalls
import org.apache.bcel.generic.InstructionList; //导入方法依赖的package包/类
private ArrayList<SpawnableCall> getSpawnableCalls(ConstantPoolGen constantPoolGen, MethodGen spawnSignatureGen) throws
AssumptionFailure {
ArrayList<SpawnableCall> spawnableCalls =
new ArrayList<SpawnableCall>();
InstructionList il = getInstructionList();
int indexSpawnableCall =
constantPoolGen.lookupMethodref(spawnSignatureGen);
if (indexSpawnableCall < 0) return spawnableCalls;
INVOKEVIRTUAL spawnableInvoke =
new INVOKEVIRTUAL(indexSpawnableCall);
InstructionHandle ih = il.getStart();
do {
Instruction instruction = ih.getInstruction();
if (instruction.equals(spawnableInvoke)) {
if (instruction.produceStack(constantPoolGen) > 0) {
spawnableCalls.add(getSpawnableCallReturningValue(ih));
} else if (instruction.produceStack(constantPoolGen) == 0) {
if (spawnSignatureGen.getExceptions().length > 0) {
spawnableCalls.add(getSpawnableCallWithException(ih, spawnSignatureGen));
} else {
throw new AssumptionFailure("Not satisfying assumption that spawnable method returns something or throws something");
}
} else {
throw new AssumptionFailure("Not satisfying assumption that spawnable method returns something or throws something");
}
} else {
// OK
}
} while((ih = ih.getNext()) != null);
return spawnableCalls;
}
示例5: getAllObjectLoadInstructions
import org.apache.bcel.generic.InstructionList; //导入方法依赖的package包/类
private ArrayList<InstructionHandle> getAllObjectLoadInstructions(InstructionList il) {
ArrayList<InstructionHandle> objectLoadInstructions = new ArrayList<InstructionHandle>();
InstructionHandle current = il.getStart();
while(current != null) {
Instruction instruction = current.getInstruction();
if (instruction instanceof ALOAD || instruction instanceof GETSTATIC) {
objectLoadInstructions.add(current);
}
current = current.getNext();
}
return objectLoadInstructions;
}
示例6: nullAdaptClass
import org.apache.bcel.generic.InstructionList; //导入方法依赖的package包/类
byte[] nullAdaptClass(final InputStream is, final String name)
throws Exception
{
JavaClass jc = new ClassParser(is, name + ".class").parse();
ClassGen cg = new ClassGen(jc);
ConstantPoolGen cp = cg.getConstantPool();
Method[] ms = cg.getMethods();
for (int j = 0; j < ms.length; ++j) {
MethodGen mg = new MethodGen(ms[j], cg.getClassName(), cp);
boolean lv = ms[j].getLocalVariableTable() == null;
boolean ln = ms[j].getLineNumberTable() == null;
if (lv) {
mg.removeLocalVariables();
}
if (ln) {
mg.removeLineNumbers();
}
mg.stripAttributes(skipDebug);
InstructionList il = mg.getInstructionList();
if (il != null) {
InstructionHandle ih = il.getStart();
while (ih != null) {
ih = ih.getNext();
}
if (compute) {
mg.setMaxStack();
mg.setMaxLocals();
}
}
cg.replaceMethod(ms[j], mg.getMethod());
}
return cg.getJavaClass().getBytes();
}
示例7: build
import org.apache.bcel.generic.InstructionList; //导入方法依赖的package包/类
public void build() throws CFGBuilderException {
InstructionList instructionList = methodGen.getInstructionList();
optimize(instructionList);
topLevelSubroutine = new Subroutine(instructionList.getStart());
subroutineWorkList.add(topLevelSubroutine);
// Build top level subroutine and all JSR subroutines
while (!subroutineWorkList.isEmpty()) {
Subroutine subroutine = subroutineWorkList.removeFirst();
if (DEBUG)
System.out.println("Starting subroutine " + subroutine.getStartInstruction());
build(subroutine);
}
// Inline everything into the top level subroutine
cfg = inlineAll();
// Add a NOP instruction to the entry block.
// This allows analyses to construct a Location
// representing the entry to the method.
BasicBlock entryBlock = cfg.getEntry();
InstructionList il = new InstructionList();
entryBlock.addInstruction(il.append(new NOP()));
if (VERIFY_INTEGRITY)
cfg.checkIntegrity();
if (true) {
cfg.checkIntegrity();
}
}