本文整理汇总了Java中soot.jimple.JimpleBody类的典型用法代码示例。如果您正苦于以下问题:Java JimpleBody类的具体用法?Java JimpleBody怎么用?Java JimpleBody使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JimpleBody类属于soot.jimple包,在下文中一共展示了JimpleBody类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getBafBody
import soot.jimple.JimpleBody; //导入依赖的package包/类
/**
* Gets the baf body for the given SootMethod. This method will first check
* whether the method already has a baf body. If not, it will query the local
* cache. If this fails as well, it will construct a new baf body.
* @param method The method for which to obtain a baf body
* @return The baf body for the given method
*/
protected BafBody getBafBody(SootMethod method) {
final Body activeBody = method.getActiveBody();
if (activeBody instanceof BafBody)
return (BafBody) activeBody;
BafBody body = bafBodyCache.get(method);
if (body != null)
return body;
if (activeBody instanceof JimpleBody) {
body = PackManager.v().convertJimpleBodyToBaf(method);
} else {
throw new RuntimeException(
"ASM-backend can only translate Baf- and JimpleBodies!");
}
bafBodyCache.put(method, body);
return body;
}
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:27,代码来源:AbstractASMBackend.java
示例2: TypeResolver
import soot.jimple.JimpleBody; //导入依赖的package包/类
private TypeResolver(JimpleBody stmtBody, Scene scene)
{
this.stmtBody = stmtBody;
hierarchy = ClassHierarchy.classHierarchy(scene);
OBJECT = hierarchy.OBJECT;
NULL = hierarchy.NULL;
typeVariable(OBJECT);
typeVariable(NULL);
// hack for J2ME library, reported by Stephen Cheng
if (!Options.v().j2me()) {
typeVariable(hierarchy.CLONEABLE);
typeVariable(hierarchy.SERIALIZABLE);
}
}
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:17,代码来源:TypeResolver.java
示例3: typingFailed
import soot.jimple.JimpleBody; //导入依赖的package包/类
private boolean typingFailed(JimpleBody b) {
// Check to see if any locals are untyped
{
Iterator<Local> localIt = b.getLocals().iterator();
while (localIt.hasNext()) {
Local l = localIt.next();
if (l.getType().equals(UnknownType.v())
|| l.getType().equals(ErroneousType.v())) {
return true;
}
}
}
return false;
}
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:18,代码来源:TypeAssigner.java
示例4: TypeResolverBV
import soot.jimple.JimpleBody; //导入依赖的package包/类
private TypeResolverBV(JimpleBody stmtBody, Scene scene)
{
this.stmtBody = stmtBody;
hierarchy = ClassHierarchy.classHierarchy(scene);
OBJECT = hierarchy.OBJECT;
NULL = hierarchy.NULL;
typeVariable(OBJECT);
typeVariable(NULL);
// hack for J2ME library, reported by Stephen Cheng
if (!Options.v().j2me()) {
typeVariable(hierarchy.CLONEABLE);
typeVariable(hierarchy.SERIALIZABLE);
}
}
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:17,代码来源:TypeResolverBV.java
示例5: createAverroesAbstractLibraryInit
import soot.jimple.JimpleBody; //导入依赖的package包/类
/**
* Create the default constructor for the Averroes library class.
*/
private void createAverroesAbstractLibraryInit() {
SootMethod init = Hierarchy.getNewDefaultConstructor();
JimpleBody body = Jimple.v().newBody(init);
init.setActiveBody(body);
averroesAbstractLibraryClass.addMethod(init);
// Call superclass constructor
body.insertIdentityStmts();
body.getUnits().add(
Jimple.v().newInvokeStmt(
Jimple.v().newSpecialInvokeExpr(body.getThisLocal(),
Hierarchy.getDefaultConstructor(Hierarchy.v().getJavaLangObject()).makeRef(),
Collections.<Value> emptyList())));
// Add return statement
body.getUnits().addLast(Jimple.v().newReturnVoidStmt());
// Finally validate the Jimple body
body.validate();
}
开发者ID:karimhamdanali,项目名称:averroes,代码行数:25,代码来源:CodeGenerator.java
示例6: createAverroesLibraryInit
import soot.jimple.JimpleBody; //导入依赖的package包/类
/**
* Create the static initializer for the Averroes library class.
*/
private void createAverroesLibraryInit() {
SootMethod init = Hierarchy.getNewDefaultConstructor();
JimpleBody body = Jimple.v().newBody(init);
init.setActiveBody(body);
averroesLibraryClass.addMethod(init);
// Call superclass constructor
body.insertIdentityStmts();
body.getUnits().add(
Jimple.v().newInvokeStmt(
Jimple.v().newSpecialInvokeExpr(body.getThisLocal(),
Hierarchy.getDefaultConstructor(averroesAbstractLibraryClass).makeRef(),
Collections.<Value> emptyList())));
// Add return statement
body.getUnits().addLast(Jimple.v().newReturnVoidStmt());
// Finally validate the Jimple body
body.validate();
}
开发者ID:karimhamdanali,项目名称:averroes,代码行数:25,代码来源:CodeGenerator.java
示例7: genericMethod
import soot.jimple.JimpleBody; //导入依赖的package包/类
private static SootMethod genericMethod(SootMethod m, boolean removeSync) {
SootClass c = m.getDeclaringClass();
SootMethod s = new SootMethod(m.getName(), m.getParameterTypes(), m.getReturnType(), m.getModifiers() & ~Modifier.NATIVE);
if (removeSync) s.setModifiers(s.getModifiers() & ~Modifier.SYNCHRONIZED);
c.removeMethod(m);
c.addMethod(s);
if (s.isConcrete()) {
JimpleBody body = Jimple.v().newBody(s);
Chain<Unit> units = body.getUnits();
Chain<Local> locals = body.getLocals();
boolean isStatic = (s.getModifiers() & Modifier.STATIC) != 0;
if (!isStatic) {
Local thisLcl = Jimple.v().newLocal("this", c.getType());
locals.add(thisLcl);
units.add(Jimple.v().newIdentityStmt(thisLcl, Jimple.v().newThisRef(c.getType())));
}
int paramCnt = s.getParameterCount();
List<Type> paramTypeList = s.getParameterTypes();
for (int i = 0; i < paramCnt; i++) {
Local lcl = Jimple.v().newLocal("l" + i, paramTypeList.get(i));
locals.add(lcl);
units.add(Jimple.v().newIdentityStmt(lcl, Jimple.v().newParameterRef(paramTypeList.get(i), i)));
}
s.setActiveBody(body);
}
return s;
}
开发者ID:petablox-project,项目名称:petablox,代码行数:28,代码来源:StubMethodSupport.java
示例8: getThreadStartEquiv
import soot.jimple.JimpleBody; //导入依赖的package包/类
/**
* Stub for instance method "void start()" in class java.lang.Thread.
*/
private static SootMethod getThreadStartEquiv(SootMethod m) {
SootMethod s = genericMethod(m, true);
JimpleBody body =(JimpleBody) s.retrieveActiveBody();
SootClass c = s.getDeclaringClass();
String runSig = "void run()";
SootMethod runM = c.getMethod(runSig);
Chain<Unit> units = body.getUnits();
Local thisLcl = body.getThisLocal();
units.add(Jimple.v().newInvokeStmt(Jimple.v().newVirtualInvokeExpr(thisLcl, runM.makeRef())));
units.add(Jimple.v().newReturnVoidStmt());
methodToStub.put(m, s);
methodToStub.put(s, s);
if (Config.verbose >= 2)
System.out.println("Custom stub (getThreadStartEquiv) for method: " + s.getName() + ":" + s.getDeclaringClass());
return s;
}
开发者ID:petablox-project,项目名称:petablox,代码行数:20,代码来源:StubMethodSupport.java
示例9: getCloneEquiv
import soot.jimple.JimpleBody; //导入依赖的package包/类
/**
* Stub for instance method "java.lang.Object clone()" in class java.lang.Object.
*/
private static SootMethod getCloneEquiv(SootMethod m) {
SootMethod s = genericMethod(m, false);
JimpleBody body =(JimpleBody) s.retrieveActiveBody();
SootClass c = s.getDeclaringClass();
Chain<Unit> units = body.getUnits();
Chain<Local> locals = body.getLocals();
Local lcl1 = Jimple.v().newLocal("l", c.getType());
locals.add(lcl1);
Local thisLocal = body.getThisLocal();
units.add(Jimple.v().newAssignStmt(lcl1,thisLocal));
units.add(Jimple.v().newReturnStmt(lcl1));
methodToStub.put(m, s);
methodToStub.put(s, s);
if (Config.verbose >= 2)
System.out.println("Custom stub (getCloneEquiv) for method: " + s.getName() + ":" + s.getDeclaringClass());
return s;
}
开发者ID:petablox-project,项目名称:petablox,代码行数:21,代码来源:StubMethodSupport.java
示例10: getDoPrivileged
import soot.jimple.JimpleBody; //导入依赖的package包/类
private static SootMethod getDoPrivileged(SootMethod m){
SootMethod s = genericMethod(m,false);
JimpleBody body =(JimpleBody) s.retrieveActiveBody();
List<Type> paramTypes = m.getParameterTypes();
RefType param1 = (RefType)paramTypes.get(0);
SootClass c = param1.getSootClass();
String runSig = "java.lang.Object run()";
SootMethod runM = c.getMethod(runSig);
Chain<Unit> units = body.getUnits();
Chain<Local> locals = body.getLocals();
Local invokeBase = locals.getFirst();
Local t0 = Jimple.v().newLocal("t0", RefType.v("java.lang.Object"));
locals.add(t0);
units.add(Jimple.v().newAssignStmt(t0, Jimple.v().newInterfaceInvokeExpr(invokeBase, runM.makeRef())));
units.add(Jimple.v().newReturnStmt(t0));
methodToStub.put(m, s);
methodToStub.put(s, s);
if (Config.verbose >= 2)
System.out.println("Custom stub (getDoPrivileged1) for method: " + s.getName() + ":" + s.getDeclaringClass());
return s;
}
开发者ID:petablox-project,项目名称:petablox,代码行数:22,代码来源:StubMethodSupport.java
示例11: emptyStub
import soot.jimple.JimpleBody; //导入依赖的package包/类
/**
* Empty stub for unsupported native methods / excluded methods
*/
private static SootMethod emptyStub(SootMethod m) {
SootMethod s = genericMethod(m, false);
if (s.isConcrete()) {
JimpleBody body =(JimpleBody) s.retrieveActiveBody();
SootClass c = s.getDeclaringClass();
Chain<Unit> units = body.getUnits();
if (s.getReturnType() instanceof VoidType)
units.add(Jimple.v().newReturnVoidStmt());
else {
Chain<Local> locals = body.getLocals();
Local lcl = Jimple.v().newLocal("retlcl", s.getReturnType());
locals.add(lcl);
units.add(Jimple.v().newReturnStmt(lcl));
}
}
methodToStub.put(m, s);
methodToStub.put(s, s);
if (Config.verbose >= 2)
System.out.println("Empty stub for method: " + s.getName() + ":" + s.getDeclaringClass());
return s;
}
开发者ID:petablox-project,项目名称:petablox,代码行数:25,代码来源:StubMethodSupport.java
示例12: buildArrayOfType
import soot.jimple.JimpleBody; //导入依赖的package包/类
/**
* Constructs an array of the given type with a single element of this type
* in the given method
* @param body The body of the method in which to create the array
* @param gen The local generator
* @param tp The type of which to create the array
* @param constructionStack Set of classes currently being built to avoid
* constructor loops
* @param parentClasses If a requested type is compatible with one of the
* types in this list, the already-created object is used instead of
* creating a new one.
* @return The local referencing the newly created array, or null if the
* array generation failed
*/
private Value buildArrayOfType(JimpleBody body, LocalGenerator gen, ArrayType tp,
Set<SootClass> constructionStack, Set<SootClass> parentClasses) {
Local local = gen.generateLocal(tp);
// Generate a new single-element array
NewArrayExpr newArrayExpr = Jimple.v().newNewArrayExpr(tp.getElementType(),
IntConstant.v(1));
AssignStmt assignArray = Jimple.v().newAssignStmt(local, newArrayExpr);
body.getUnits().add(assignArray);
// Generate a single element in the array
AssignStmt assign = Jimple.v().newAssignStmt
(Jimple.v().newArrayRef(local, IntConstant.v(19)),
getValueForType(body, gen, tp.getElementType(), constructionStack, parentClasses));
body.getUnits().add(assign);
return local;
}
开发者ID:0-14N,项目名称:soot-inflow,代码行数:32,代码来源:BaseEntryPointCreator.java
示例13: createInit
import soot.jimple.JimpleBody; //导入依赖的package包/类
/**
* Create default constructor of the wrapper class.
* @return
*/
private SootMethod createInit() {
SootMethod method = new SootMethod("<init>", new ArrayList<Type>(), VoidType.v(), Modifier.PUBLIC);
JimpleBody body = Jimple.v().newBody(method);
method.setActiveBody(body);
Chain <Local> locals = body.getLocals();
PatchingChain<Unit> units = body.getUnits();
RefType thisType = RefType.v(WRAPPER_PATH);
Local r0 = jimple.newLocal("r0", thisType);
locals.add(r0);
units.add(jimple.newIdentityStmt(r0, jimple.newThisRef(thisType)));
SootMethod initObject = scene.getMethod("<java.lang.Object: void <init>()>");
units.add(jimple.newInvokeStmt
(jimple.newSpecialInvokeExpr(r0, initObject.makeRef())));
units.add(jimple.newReturnVoidStmt());
return method;
}
开发者ID:Orange-OpenSource,项目名称:matos-tool,代码行数:23,代码来源:AndroidWrapper.java
示例14: getLocals
import soot.jimple.JimpleBody; //导入依赖的package包/类
private static Map/*<Integer,Local>*/ getLocals(SootClass sc, String methodname, String typename) {
Map res = new HashMap();
Iterator mi = sc.getMethods().iterator();
while (mi.hasNext()) {
SootMethod sm = (SootMethod)mi.next();
System.err.println(sm.getName());
if (true && sm.getName().equals(methodname) && sm.isConcrete()) {
JimpleBody jb = (JimpleBody)sm.retrieveActiveBody();
Iterator ui = jb.getUnits().iterator();
while (ui.hasNext()) {
Stmt s = (Stmt)ui.next();
int line = getLineNumber(s);
// find definitions
Iterator bi = s.getDefBoxes().iterator();
while (bi.hasNext()) {
Object o = bi.next();
if (o instanceof ValueBox) {
Value v = ((ValueBox)o).getValue();
if (v.getType().toString().equals(typename) && v instanceof Local)
res.put(new Integer(line),v);
}
}
}
}
}
return res;
}
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:29,代码来源:PointsToAnalysis.java
示例15: stashBodiesForClass
import soot.jimple.JimpleBody; //导入依赖的package包/类
private void stashBodiesForClass(SootClass sc)
{
methodToParsedBodyMap = new HashMap<SootMethod, JimpleBody>();
Walker w = new BodyExtractorWalker(sc, SootResolver.v(), methodToParsedBodyMap);
boolean oldPhantomValue = Scene.v().getPhantomRefs();
Scene.v().setPhantomRefs(true);
mTree.apply(w);
Scene.v().setPhantomRefs(oldPhantomValue);
}
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:13,代码来源:JimpleAST.java
示例16: TypeResolver
import soot.jimple.JimpleBody; //导入依赖的package包/类
public TypeResolver(JimpleBody jb)
{
this.jb = jb;
this.assignments = new ArrayList<DefinitionStmt>();
this.depends = new HashMap<Local, BitSet>();
for ( Local v : this.jb.getLocals() )
this.addLocal(v);
this.initAssignments();
}
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:11,代码来源:TypeResolver.java
示例17: CastInsertionUseVisitor
import soot.jimple.JimpleBody; //导入依赖的package包/类
public CastInsertionUseVisitor(boolean countOnly, JimpleBody jb,
Typing tg, IHierarchy h)
{
this.jb = jb;
this.tg = tg;
this.h = h;
this.countOnly = countOnly;
this.count = 0;
}
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:11,代码来源:TypeResolver.java
示例18: TypePromotionUseVisitor
import soot.jimple.JimpleBody; //导入依赖的package包/类
public TypePromotionUseVisitor(JimpleBody jb, Typing tg)
{
this.jb = jb;
this.tg = tg;
this.fail = false;
this.typingChanged = false;
}
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:9,代码来源:TypeResolver.java
示例19: check
import soot.jimple.JimpleBody; //导入依赖的package包/类
public void check(Stmt stmt, JimpleBody stmtBody) throws TypeException {
try {
this.stmtBody = stmtBody;
stmt.apply(this);
} catch (RuntimeTypeException e) {
StringWriter st = new StringWriter();
PrintWriter pw = new PrintWriter(st);
e.printStackTrace(pw);
pw.close();
throw new TypeException(st.toString());
}
}
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:13,代码来源:ConstraintChecker.java
示例20: compareTypings
import soot.jimple.JimpleBody; //导入依赖的package包/类
private static int compareTypings(JimpleBody a, JimpleBody b) {
int r = 0;
Iterator<Local> ib = b.getLocals().iterator();
for (Local v : a.getLocals()) {
Type ta = v.getType(), tb = ib.next().getType();
if (soot.jimple.toolkits.typing.fast.TypeResolver
.typesEqual(ta, tb))
continue;
/*
* Sometimes there is no reason to choose between the char and byte /
* short types. Enabling this check allows one algorithm to select
* char and the other to select byte / short without returning
* incomparable.
*/
else if (true && ((ta instanceof CharType && (tb instanceof ByteType || tb instanceof ShortType))
|| (tb instanceof CharType && (ta instanceof ByteType || ta instanceof ShortType))))
continue;
else if (soot.jimple.toolkits.typing.fast.AugHierarchy.ancestor_(
ta, tb)) {
if (r == -1)
return 3;
else
r = 1;
} else if (soot.jimple.toolkits.typing.fast.AugHierarchy.ancestor_(
tb, ta)) {
if (r == 1)
return 3;
else
r = -1;
} else
return 3;
}
return r;
}
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:38,代码来源:TypeAssigner.java
注:本文中的soot.jimple.JimpleBody类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论