• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java LocalVariableGen类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.bcel.generic.LocalVariableGen的典型用法代码示例。如果您正苦于以下问题:Java LocalVariableGen类的具体用法?Java LocalVariableGen怎么用?Java LocalVariableGen使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



LocalVariableGen类属于org.apache.bcel.generic包,在下文中一共展示了LocalVariableGen类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getLocal

import org.apache.bcel.generic.LocalVariableGen; //导入依赖的package包/类
final LocalVariableGen getLocal(MethodGen m, LocalVariableInstruction curr,
    int pos) {
int localNr = curr.getIndex();
LocalVariableGen[] lt = getLocalTable(m);

for (int i = 0; i < lt.length; i++) {
    // Watch out. The first initialization seems not to be included in
    // the range given in the local variable table!

    if (localNr == lt[i].getIndex()) {
	// System.err.println("Looking for local " + localNr
	// + " on position " + pos);
	// System.err.println("found one with range "
	// + lt[i].getStart().getPrev().getPosition() + ", "
	// + lt[i].getEnd().getPosition());

	if (pos >= lt[i].getStart().getPrev().getPosition()
		&& pos < (lt[i].getEnd().getPosition())) {
	    return lt[i];
	}
    }
}

return null;
   }
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:26,代码来源:MethodTable.java


示例2: getIndicesStores

import org.apache.bcel.generic.LocalVariableGen; //导入依赖的package包/类
private void getIndicesStores(InstructionHandle start,
    InstructionHandle end, ArrayList<LocalVariableGen> resultIndices) {

for (InstructionHandle current = start.getNext() ;current != end.getNext(); current = current.getNext()) {
    try {
	LocalVariableGen l = getIndexStore(current);
	if (! resultIndices.contains(l)) {
	    resultIndices.add(l);
	}
	for (LocalVariableGen ll : this.getLocalVariables()) {
	    if (ll != l && l.getIndex() == ll.getIndex() && l.getName().equals(ll.getName())) {
		if (! resultIndices.contains(ll)) {
		    resultIndices.add(ll);
		}
	    }		    
	}
    }
    catch (ClassCastException e) {
	// no problem, just not a store 
    }
}
   }
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:23,代码来源:SpawningMethod.java


示例3: getSpawnableCallWithException

import org.apache.bcel.generic.LocalVariableGen; //导入依赖的package包/类
private SpawnableCall getSpawnableCallWithException(InstructionHandle invokeInstruction, 
    ArrayList<CodeExceptionGen> exceptionHandlers) {

ArrayList<LocalVariableGen> resultIndices = new ArrayList<LocalVariableGen>();
for (CodeExceptionGen exceptionHandler : exceptionHandlers) {
    InstructionHandle start = exceptionHandler.getHandlerPC(); 
    InstructionHandle end = getEndExceptionHandler(exceptionHandler);
    getIndicesStores(start, end, resultIndices);
}

LocalVariableGen[] dummy = new LocalVariableGen[resultIndices.size()];

return new SpawnableCall(invokeInstruction,
	getObjectReferenceLoadInstruction(invokeInstruction),
	resultIndices.toArray(dummy));
   }
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:17,代码来源:SpawningMethod.java


示例4: storesIn

import org.apache.bcel.generic.LocalVariableGen; //导入依赖的package包/类
/** Tests whether this spawnable call stores in variables with index index.
    *
    * @param index The index which is tested.
    * @return true if the spawnable call stores in a variable with index
    * index; false otherwise.
    */
   public boolean storesIn(int index, InstructionHandle ih) {
int insNo = ih.getPosition();
       for (LocalVariableGen g : indicesStores) {
           if (g.getIndex() == index) {
       	InstructionHandle end = g.getEnd();
       	InstructionHandle start = g.getStart();
       	if (start.getPrev() != null) {
       	    start = start.getPrev();
       	}
       	if (insNo >= start.getPosition() && insNo <= end.getPosition()) {
       	    return true;
       	}
           }
       }
return false;
   }
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:23,代码来源:SpawnableCall.java


示例5: toString

import org.apache.bcel.generic.LocalVariableGen; //导入依赖的package包/类
/** Returns a string representation.
    */
   public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(invokeInstruction.toString());
sb.append(", resultIndices: ");
if (indicesStores == null) {
    sb.append("(none), exceptions are not handled");
}
else {
    for (LocalVariableGen i : indicesStores) {
	sb.append(i);
	sb.append(", ");
    }
    sb.delete(sb.length()-2, sb.length());
}
return sb.toString();
   }
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:19,代码来源:SpawnableCall.java


示例6: getEndExceptionHandler

import org.apache.bcel.generic.LocalVariableGen; //导入依赖的package包/类
/** Returns the end of an exception handler.
    *
    * @param codeException The codeException which end is returned.
    * @return The instructionHandle that is the end of the exception handler.
    */
   public InstructionHandle getEndExceptionHandler(CodeExceptionGen codeException) {
LocalVariableGen[] localVars = getLocalVariables();
InstructionHandle startHandler = codeException.getHandlerPC();

for (LocalVariableGen localVar : localVars) {
    InstructionHandle startScope = localVar.getStart();
    InstructionHandle endScope = localVar.getEnd();

    if (startScope == startHandler || startScope == startHandler.getNext() || 
	    startScope == startHandler.getNext().getNext() &&
	    localVar.getType().equals(codeException.getCatchType()))
	return endScope.getPrev();
}
throw new Error("no end exceptionhandler...");
   }
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:21,代码来源:MethodGen.java


示例7: noAliasesLoadWithIndexBefore

import org.apache.bcel.generic.LocalVariableGen; //导入依赖的package包/类
boolean noAliasesLoadWithIndexBefore(InstructionHandle ih, LocalVariableGen lg) {
      for (InstructionContext ic : instructions) {
          InstructionHandle current = ic.getInstruction();
          if (current.equals(ih)) {
              break;
          }
          LocalVariableGen l = methodGen.findLocalVar(current, lg.getIndex(), false);
          if (l == lg && methodGen.instructionLoadsTo(current, lg.getIndex())) {
// OK, there is a load, but maybe it does not create an alias?
if (! methodGen.isUsedForArrayLoad(current) && ! methodGen.isUsedForArrayLength(current)
	&& ! methodGen.isUsedForArrayStore(current) && ! methodGen.isUsedForPutField(current)
	&& ! methodGen.isUsedForGetField(current)) {
    return false;
}
          }
      }
      return true;
  }
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:19,代码来源:LoadAwareBasicBlock.java


示例8: containsLoadWithIndexAfter

import org.apache.bcel.generic.LocalVariableGen; //导入依赖的package包/类
private boolean containsLoadWithIndexAfter(InstructionHandle ih, boolean ignoreInstructions, LocalVariableGen lg) {
       InstructionHandle start = lg.getStart();
       InstructionHandle prev = start.getPrev();
       // The initial store is not included in the start/end range, so include the previous
       // instruction if it exists.
       InstructionHandle end = lg.getEnd();
       int startPosition = prev != null ? prev.getPosition() : start.getPosition();
       int endPosition = end.getPosition();
for (InstructionContext ic : instructions) {
    InstructionHandle current = ic.getInstruction();
    if (ignoreInstructions) { 
        ignoreInstructions = !current.equals(ih);
    } else if (current.getPosition() >= startPosition && current.getPosition() <= endPosition
	    && methodGen.instructionLoadsTo(current, lg.getIndex())) {
        return true;
    }
}
return false;
   }
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:20,代码来源:LoadAwareBasicBlock.java


示例9: noAliasesLoadWithIndex

import org.apache.bcel.generic.LocalVariableGen; //导入依赖的package包/类
private boolean noAliasesLoadWithIndex(InstructionHandle ih, boolean ignoreInstructions, LocalVariableGen lg) {
       InstructionHandle start = lg.getStart();
       InstructionHandle prev = start.getPrev();
       // The initial store is not included in the start/end range, so include the previous
       // instruction if it exists.
       InstructionHandle end = lg.getEnd();
       int startPosition = prev != null ? prev.getPosition() : start.getPosition();
       int endPosition = end.getPosition();
for (InstructionContext ic : instructions) {
    InstructionHandle current = ic.getInstruction();
    if (ignoreInstructions) { 
        ignoreInstructions = !current.equals(ih);
    } else if (current.getPosition() >= startPosition && current.getPosition() <= endPosition
	    && methodGen.instructionLoadsTo(current, lg.getIndex())) {
	// OK, there is a load, but maybe it does not create an alias?
	if (! methodGen.isUsedForArrayLoad(current) && ! methodGen.isUsedForArrayLength(current)
		&& ! methodGen.isUsedForArrayStore(current) && ! methodGen.isUsedForPutField(current)
		&& ! methodGen.isUsedForGetField(current)) {
	    return false;
	}
    }
}
return true;
   }
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:25,代码来源:LoadAwareBasicBlock.java


示例10: fillStoreLoadPaths

import org.apache.bcel.generic.LocalVariableGen; //导入依赖的package包/类
private void fillStoreLoadPaths(ArrayList<StoreLoadPath> storeLoadPaths, Path path, SpawnableCall spawnableCall) {
LocalVariableGen[] indicesStores = spawnableCall.getIndicesStores();
InstructionHandle invokeInstruction = spawnableCall.getInvokeInstruction();

if (!spawnableCall.exceptionsHandled()) {
    return;
}
else {
    StoreLoadPath storeLoadPath = null;
    try {
	storeLoadPath = new StoreLoadPath(invokeInstruction, path, indicesStores);
    }
    catch (NeverReadException e) {
    }
    if (storeLoadPath != null && !storeLoadPaths.contains(storeLoadPath)) {
	storeLoadPaths.add(storeLoadPath);
    }
}
   }
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:20,代码来源:SpawnableCallAnalysis.java


示例11: getIndexEarliestBasicBlock

import org.apache.bcel.generic.LocalVariableGen; //导入依赖的package包/类
private int getIndexEarliestBasicBlock(LocalVariableGen[] localVariableIndices, InstructionHandle storeInstruction) throws NeverReadException {
for (int i = 0; i < size(); i++) {
    LoadAwareBasicBlock basicBlock = new LoadAwareBasicBlock(get(i));
    if (i == 0) {
	if (containsLoadWithIndexAfter(basicBlock, localVariableIndices, storeInstruction)) {
	    return i;
	}
    }
    else {
	if (containsLoadWithIndex(basicBlock, localVariableIndices)) {
	    return i;
	}
    }
}
throw new NeverReadException();
   }
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:17,代码来源:StoreLoadPath.java


示例12: toString

import org.apache.bcel.generic.LocalVariableGen; //导入依赖的package包/类
public String toString(MethodGen method) {
    String[] variables = new String[method.getLocalVariables().length];
    LocalVariableGen[] variablesGen = method.getLocalVariables();
    for(int i=0; i<variablesGen.length ;i++) {
        variables[i] = variablesGen[i].getName();
    }
    return toString(variables);
}
 
开发者ID:blackarbiter,项目名称:Android_Code_Arbiter,代码行数:9,代码来源:TaintFrame.java


示例13: getEndOfCatchBlock

import org.apache.bcel.generic.LocalVariableGen; //导入依赖的package包/类
static InstructionHandle getEndOfCatchBlock(MethodGen m,
    CodeExceptionGen catchBlock) {

if (catchBlock.getCatchType() == null) {
    // finally clause, no local variable!
    return null;
}

LocalVariableGen[] lt = m.getLocalVariables();

InstructionHandle handler = catchBlock.getHandlerPC();

for (int i = 0; i < lt.length; i++) {
    InstructionHandle start = lt[i].getStart();
    InstructionHandle end = lt[i].getEnd();

    // dangerous, javac is one instruction further...
    if ((start == handler || start == handler.getNext() || start == handler
	    .getNext().getNext())
	    && lt[i].getType().equals(catchBlock.getCatchType())) {
	// System.out.println("found range of catch block: "
	// + handler + " - " + end);
	return end.getPrev();
    }
}

System.err
	.println("Could not find end of catch block, did you compile "
		+ "with the '-g' option?");
System.exit(1);
return null;
   }
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:33,代码来源:MethodTable.java


示例14: getLocalTable

import org.apache.bcel.generic.LocalVariableGen; //导入依赖的package包/类
private final LocalVariableGen[] getLocalTable(MethodGen m) {
LocalVariableGen[] lt = m.getLocalVariables();

if (lt == null) {
    System.err.println("Could not get local variable table, did you "
	    + "compile with the '-g' option?");
    System.exit(1);
}

return lt;
   }
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:12,代码来源:MethodTable.java


示例15: getLocalName

import org.apache.bcel.generic.LocalVariableGen; //导入依赖的package包/类
String getLocalName(MethodGen m, LocalVariableInstruction curr, int pos) {
LocalVariableGen a = getLocal(m, curr, pos);

if (a == null) {
    return null;
}

return a.getName();
   }
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:10,代码来源:MethodTable.java


示例16: getLocalType

import org.apache.bcel.generic.LocalVariableGen; //导入依赖的package包/类
Type getLocalType(MethodGen m, LocalVariableInstruction curr, int pos) {
LocalVariableGen a = getLocal(m, curr, pos);

if (a == null) {
    return null;
}

return a.getType();
   }
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:10,代码来源:MethodTable.java


示例17: findIndexStore

import org.apache.bcel.generic.LocalVariableGen; //导入依赖的package包/类
private LocalVariableGen[] findIndexStore(InstructionHandle spawnableMethodInvoke) throws ResultNotStored {
InstructionHandle[] stackConsumers = findInstructionConsumers(spawnableMethodInvoke);
if (stackConsumers.length != 1) {
    /*
    throw new Error("Uncovered situation, invoke instruction's " + 
	    "result is consumed by multiple instructions. " + 
	    "Is there controlflow right after the spawnable invoke???");
	    */
    throw new ResultNotStored();
    // I think this is a better solution. Controlflow right after the
    // invoke is something that is hard to analyze and rare. Better to
    // just mark it as a result that isn't stored.
}
try {
    ArrayList<LocalVariableGen> resultIndices = new ArrayList<LocalVariableGen>();
    LocalVariableGen l = getIndexStore(stackConsumers[0]);
    resultIndices.add(l);
    for (LocalVariableGen ll : this.getLocalVariables()) {
	if (ll != l && l.getIndex() == ll.getIndex() && l.getName().equals(ll.getName())) {
	    if (! resultIndices.contains(ll)) {
		resultIndices.add(ll);
	    }
	}		    
    }
    return resultIndices.toArray(new LocalVariableGen[resultIndices.size()]);
}
catch (ClassCastException e) {
    throw new ResultNotStored();
}
   }
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:31,代码来源:SpawningMethod.java


示例18: SpawnableCall

import org.apache.bcel.generic.LocalVariableGen; //导入依赖的package包/类
SpawnableCall(InstructionHandle invokeInstruction, 
    InstructionHandle objectReference, LocalVariableGen[] indicesStores) {
this.invokeInstruction = invokeInstruction;
this.objectReference = objectReference;
this.indicesStores = indicesStores;
this.type = Type.NORMAL;
   }
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:8,代码来源:SpawnableCall.java


示例19: containsLoadWithIndexBefore

import org.apache.bcel.generic.LocalVariableGen; //导入依赖的package包/类
boolean containsLoadWithIndexBefore(InstructionHandle ih, LocalVariableGen lg) {
    for (InstructionContext ic : instructions) {
        InstructionHandle current = ic.getInstruction();
        if (current.equals(ih)) {
            break;
        }
        LocalVariableGen l = methodGen.findLocalVar(current, lg.getIndex(), false);
        if (l == lg && methodGen.instructionLoadsTo(current, lg.getIndex())) {
            return true;
        }
    }
    return false;
}
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:14,代码来源:LoadAwareBasicBlock.java


示例20: StoreLoadPath

import org.apache.bcel.generic.LocalVariableGen; //导入依赖的package包/类
StoreLoadPath(InstructionHandle storeInstruction, BasicBlock block, LocalVariableGen[] localVariableIndices) {
    super(new Path());
    add(block);
    this.storeInstruction = storeInstruction;
    this.localVariableIndices = localVariableIndices;
    aliasProblem = true;
}
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:8,代码来源:StoreLoadPath.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DTDGrammarUtil类代码示例发布时间:2022-05-23
下一篇:
Java HsqlName类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap