当前位置: 首页>>代码示例>>Java>>正文


Java InstructionList.getStart方法代码示例

本文整理汇总了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;
}
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:25,代码来源:Cashmerec.java

示例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;
   }
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:21,代码来源:SpawningMethod.java

示例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);
        }
    }
}
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:12,代码来源:Cashmerec.java

示例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;
}
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:39,代码来源:SpawningMethod.java

示例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;
   }
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:15,代码来源:MethodGen.java

示例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();
}
 
开发者ID:typetools,项目名称:annotation-tools,代码行数:34,代码来源:BCELPerfTest.java

示例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();

    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:33,代码来源:BetterCFGBuilder2.java


注:本文中的org.apache.bcel.generic.InstructionList.getStart方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。