本文整理汇总了Java中org.apache.bcel.generic.MethodGen.getMaxLocals方法的典型用法代码示例。如果您正苦于以下问题:Java MethodGen.getMaxLocals方法的具体用法?Java MethodGen.getMaxLocals怎么用?Java MethodGen.getMaxLocals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.bcel.generic.MethodGen
的用法示例。
在下文中一共展示了MethodGen.getMaxLocals方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SpawnTableEntry
import org.apache.bcel.generic.MethodGen; //导入方法依赖的package包/类
SpawnTableEntry(SpawnTableEntry orig, MethodGen mg, MethodGen origM) {
isLocalUsed = new boolean[origM.getMaxLocals()];
hasInlet = orig.hasInlet;
if (hasInlet) {
/* copy and rewite exception table */
CodeExceptionGen origE[] = origM.getExceptionHandlers();
CodeExceptionGen newE[] = mg.getExceptionHandlers();
catchBlocks = new ArrayList<CodeExceptionGen>();
for (int i = 0; i < orig.catchBlocks.size(); i++) {
CodeExceptionGen origCatch = orig.catchBlocks.get(i);
for (int j = 0; j < origE.length; j++) {
if (origCatch == origE[j]) {
catchBlocks.add(newE[j]);
break;
}
}
}
}
}
示例2: ValueNumberAnalysis
import org.apache.bcel.generic.MethodGen; //导入方法依赖的package包/类
public ValueNumberAnalysis(MethodGen methodGen, DepthFirstSearch dfs,
LoadedFieldSet loadedFieldSet,
RepositoryLookupFailureCallback lookupFailureCallback) {
super(dfs);
this.methodGen = methodGen;
this.factory = new ValueNumberFactory();
this.cache = new ValueNumberCache();
this.visitor = new ValueNumberFrameModelingVisitor(methodGen, factory, cache,
loadedFieldSet,
lookupFailureCallback);
int numLocals = methodGen.getMaxLocals();
this.entryLocalValueList = new ValueNumber[numLocals];
for (int i = 0; i < numLocals; ++i)
this.entryLocalValueList[i] = factory.createFreshValue();
this.exceptionHandlerValueNumberMap = new IdentityHashMap<BasicBlock, ValueNumber>();
// For non-static methods, keep track of which value represents the
// "this" reference
if (!methodGen.isStatic())
this.thisValue = entryLocalValueList[0];
this.factAtLocationMap = new HashMap<Location, ValueNumberFrame>();
this.factAfterLocationMap = new HashMap<Location, ValueNumberFrame>();
}
示例3: insertAllDeleteLocalRecords
import org.apache.bcel.generic.MethodGen; //导入方法依赖的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: removeUnusedLocals
import org.apache.bcel.generic.MethodGen; //导入方法依赖的package包/类
void removeUnusedLocals(Method mOrig, MethodGen m) {
InstructionList il = m.getInstructionList();
InstructionHandle[] ins = il.getInstructionHandles();
for (int i = 0; i < ins.length; i++) {
Instruction in = ins[i].getInstruction();
if (in instanceof LocalVariableInstruction) {
LocalVariableInstruction curr = (LocalVariableInstruction) in;
if (mtab.getLocal(m, curr, ins[i].getPosition()) != null
&& curr.getIndex() < m.getMaxLocals() - 5
&& !mtab.isLocalUsedInInlet(mOrig, curr.getIndex())) {
if (curr instanceof IINC) {
ins[i].setInstruction(new NOP());
} else if (curr instanceof LSTORE || curr instanceof DSTORE) {
ins[i].setInstruction(new POP2());
} else if (curr instanceof StoreInstruction) {
ins[i].setInstruction(new POP());
} else if (curr instanceof ALOAD) {
ins[i].setInstruction(new ACONST_NULL());
} else if (curr instanceof FLOAD) {
ins[i].setInstruction(new FCONST((float) 0.0));
} else if (curr instanceof ILOAD) {
ins[i].setInstruction(new ICONST(0));
} else if (curr instanceof DLOAD) {
ins[i].setInstruction(new DCONST(0.0));
} else if (curr instanceof LLOAD) {
ins[i].setInstruction(new LCONST(0L));
} else {
System.out.println("unhandled ins in "
+ "removeUnusedLocals: " + curr);
System.exit(1);
}
}
}
}
}
示例5: ValueNumberAnalysis
import org.apache.bcel.generic.MethodGen; //导入方法依赖的package包/类
public ValueNumberAnalysis(MethodGen methodGen, DepthFirstSearch dfs, LoadedFieldSet loadedFieldSet,
RepositoryLookupFailureCallback lookupFailureCallback) {
super(dfs);
this.methodGen = methodGen;
this.factory = new ValueNumberFactory();
ValueNumberCache cache = new ValueNumberCache();
this.visitor = new ValueNumberFrameModelingVisitor(methodGen, factory, cache, loadedFieldSet, lookupFailureCallback);
int numLocals = methodGen.getMaxLocals();
this.entryLocalValueList = new ValueNumber[numLocals];
for (int i = 0; i < numLocals; ++i)
this.entryLocalValueList[i] = factory.createFreshValue();
this.exceptionHandlerValueNumberMap = new IdentityHashMap<BasicBlock, ValueNumber>();
// For non-static methods, keep track of which value represents the
// "this" reference
if (!methodGen.isStatic())
this.thisValue = entryLocalValueList[0];
this.factAtLocationMap = new HashMap<Location, ValueNumberFrame>();
this.factAfterLocationMap = new HashMap<Location, ValueNumberFrame>();
if (DEBUG)
System.out.println("VNA Analysis " + methodGen.getClassName() + "." + methodGen.getName() + " : "
+ methodGen.getSignature());
}
示例6: LiveLocalStoreAnalysis
import org.apache.bcel.generic.MethodGen; //导入方法依赖的package包/类
public LiveLocalStoreAnalysis(MethodGen methodGen, ReverseDepthFirstSearch rdfs) {
super(rdfs);
this.topBit = methodGen.getMaxLocals() * 2;
this.killedByStoreOffset = methodGen.getMaxLocals();
}
示例7: realMaxLocals
import org.apache.bcel.generic.MethodGen; //导入方法依赖的package包/类
static int realMaxLocals(MethodGen m) {
m.setMaxLocals();
return m.getMaxLocals();
}
示例8: LiveLocalStoreAnalysis
import org.apache.bcel.generic.MethodGen; //导入方法依赖的package包/类
public LiveLocalStoreAnalysis(MethodGen methodGen, ReverseDepthFirstSearch rdfs, DepthFirstSearch dfs) {
super(rdfs, dfs);
this.topBit = methodGen.getMaxLocals() * 2;
this.killedByStoreOffset = methodGen.getMaxLocals();
}