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


Java ReturnStmt.setOp方法代码示例

本文整理汇总了Java中soot.jimple.ReturnStmt.setOp方法的典型用法代码示例。如果您正苦于以下问题:Java ReturnStmt.setOp方法的具体用法?Java ReturnStmt.setOp怎么用?Java ReturnStmt.setOp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在soot.jimple.ReturnStmt的用法示例。


在下文中一共展示了ReturnStmt.setOp方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: caseReturnStmt

import soot.jimple.ReturnStmt; //导入方法依赖的package包/类
public void caseReturnStmt(ReturnStmt stmt) {
	if (stmt.getOp() instanceof Local) {
		if (((Local) stmt.getOp()).getType() instanceof IntegerType) {
			if (!ClassHierarchy
					.v()
					.typeNode(((Local) stmt.getOp()).getType())
					.hasAncestor_1(
							ClassHierarchy.v().typeNode(
									stmtBody.getMethod().getReturnType()))) {
				if (fix) {
					stmt.setOp(insertCast((Local) stmt.getOp(), stmtBody
							.getMethod().getReturnType(), stmt));
				} else {
					error("Type Error(19)");
				}
			}
		}
	}
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:20,代码来源:ConstraintChecker.java

示例2: internalTransform

import soot.jimple.ReturnStmt; //导入方法依赖的package包/类
@Override
protected void internalTransform(Body body, String phaseName,
		Map<String, String> options) {
	Iterator<Unit> it = body.getUnits().snapshotIterator();
	while (it.hasNext()) {
		Unit u = it.next();
		if (u instanceof GotoStmt) {
			GotoStmt gtStmt = (GotoStmt) u;
			if (gtStmt.getTarget() instanceof AssignStmt) {
				AssignStmt assign = (AssignStmt) gtStmt.getTarget();
				if (assign.getRightOp() instanceof CastExpr) {
					CastExpr ce = (CastExpr) assign.getRightOp();
					// We have goto that ends up at a cast statement
					Unit nextStmt = body.getUnits().getSuccOf(assign);
					if (nextStmt instanceof ReturnStmt) {
						ReturnStmt retStmt = (ReturnStmt) nextStmt;
						if (retStmt.getOp() == assign.getLeftOp()) {
							// We need to replace the GOTO with the return
							ReturnStmt newStmt = (ReturnStmt) retStmt.clone();
							newStmt.setOp(ce.getOp());

							for (Trap t : body.getTraps())
								for (UnitBox ubox : t.getUnitBoxes())
									if (ubox.getUnit() == gtStmt)
										ubox.setUnit(newStmt);
							
							while (!gtStmt.getBoxesPointingToThis().isEmpty())
								gtStmt.getBoxesPointingToThis().get(0).setUnit(newStmt);
							body.getUnits().swapWith(gtStmt, newStmt);
						}
					}
				}
			}
		}
	}
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:37,代码来源:CastAndReturnInliner.java

示例3: caseReturnStmt

import soot.jimple.ReturnStmt; //导入方法依赖的package包/类
public void caseReturnStmt(ReturnStmt stmt)
{
	stmt.setOp(this.uv.visit(
		stmt.getOp(), this.jb.getMethod().getReturnType(), stmt));
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:6,代码来源:UseChecker.java

示例4: internalTransform

import soot.jimple.ReturnStmt; //导入方法依赖的package包/类
@Override
protected void internalTransform(Body body, String phaseName, Map<String, String> options) {
       ExceptionalUnitGraph graph = new ExceptionalUnitGraph(body, DalvikThrowAnalysis.v(), true);
       LocalDefs localDefs = LocalDefs.Factory.newLocalDefs(graph);
       LocalUses localUses = null;
       LocalCreation localCreation = null;
       
	// If a return statement's operand has only one definition and this is
	// a copy statement, we take the original operand
	for (Unit u : body.getUnits())
		if (u instanceof ReturnStmt) {
			ReturnStmt retStmt = (ReturnStmt) u;
			if (retStmt.getOp() instanceof Local) {
				List<Unit> defs = localDefs.getDefsOfAt((Local) retStmt.getOp(), retStmt);
				if (defs.size() == 1 && defs.get(0) instanceof AssignStmt) {
					AssignStmt assign = (AssignStmt) defs.get(0);
					final Value rightOp = assign.getRightOp();
					final Value leftOp = assign.getLeftOp();
					
					// Copy over the left side if it is a local
					if (rightOp instanceof Local) {
						// We must make sure that the definition we propagate to
						// the return statement is not overwritten in between
						// a = 1; b = a; a = 3; return b; may not be translated
						// to return a;
						if (!isRedefined((Local) rightOp, u, assign, graph))
							retStmt.setOp(rightOp);
					}
					else if (rightOp instanceof Constant) {
						retStmt.setOp(rightOp);
					}
					// If this is a field access which has no other uses,
					// we rename the local to help splitting
					else if (rightOp instanceof FieldRef) {
						if (localUses == null)
							localUses = LocalUses.Factory.newLocalUses(body, localDefs);
						if (localUses.getUsesOf(assign).size() == 1) {
							if (localCreation == null)
								localCreation = new LocalCreation(body.getLocals(), "ret");
							Local newLocal = localCreation.newLocal(leftOp.getType());
							assign.setLeftOp(newLocal);
							retStmt.setOp(newLocal);
						}
					}
				}
			}
		}
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:49,代码来源:DexReturnValuePropagator.java


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