use of soot in project soot by Sable.
the class InterfaceDecl method jimplify1phase2.
/**
* @ast method
* @aspect EmitJimple
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddExtensions/JimpleBackend/EmitJimple.jrag:186
*/
public void jimplify1phase2() {
SootClass sc = getSootClassDecl();
sc.setResolvingLevel(SootClass.DANGLING);
sc.setModifiers(sootTypeModifiers());
sc.setApplicationClass();
SourceFileTag st = new soot.tagkit.SourceFileTag(sourceNameWithoutPath());
st.setAbsolutePath(compilationUnit().pathName());
sc.addTag(st);
sc.setSuperclass(typeObject().getSootClassDecl());
for (Iterator iter = superinterfacesIterator(); iter.hasNext(); ) {
TypeDecl typeDecl = (TypeDecl) iter.next();
if (typeDecl != typeObject() && !sc.implementsInterface(typeDecl.getSootClassDecl().getName()))
sc.addInterface(typeDecl.getSootClassDecl());
}
if (isNestedType())
sc.setOuterClass(enclosingType().getSootClassDecl());
sc.setResolvingLevel(SootClass.HIERARCHY);
super.jimplify1phase2();
sc.setResolvingLevel(SootClass.SIGNATURES);
}
use of soot in project soot by Sable.
the class ClassDecl method jimplify1phase2.
/**
* @ast method
* @aspect EmitJimple
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddExtensions/JimpleBackend/EmitJimple.jrag:163
*/
public void jimplify1phase2() {
SootClass sc = getSootClassDecl();
sc.setResolvingLevel(SootClass.DANGLING);
sc.setModifiers(sootTypeModifiers());
sc.setApplicationClass();
SourceFileTag st = new soot.tagkit.SourceFileTag(sourceNameWithoutPath());
st.setAbsolutePath(compilationUnit().pathName());
sc.addTag(st);
if (hasSuperclass()) {
sc.setSuperclass(superclass().getSootClassDecl());
}
for (Iterator iter = interfacesIterator(); iter.hasNext(); ) {
TypeDecl typeDecl = (TypeDecl) iter.next();
if (!sc.implementsInterface(typeDecl.getSootClassDecl().getName()))
sc.addInterface(typeDecl.getSootClassDecl());
}
if (isNestedType())
sc.setOuterClass(enclosingType().getSootClassDecl());
sc.setResolvingLevel(SootClass.HIERARCHY);
super.jimplify1phase2();
sc.setResolvingLevel(SootClass.SIGNATURES);
}
use of soot in project soot by Sable.
the class VarAccess method eval.
/**
* @ast method
* @aspect GenericsCodegen
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddExtensions/Jimple1.5Backend/GenericsCodegen.jrag:38
*/
public soot.Value eval(Body b) {
Variable v = decl();
soot.Value result;
if (v instanceof FieldDeclaration) {
FieldDeclaration f = ((FieldDeclaration) v).erasedField();
if (f.hostType().isArrayDecl() && f.name().equals("length")) {
return b.newLengthExpr(asImmediate(b, createLoadQualifier(b)), this);
}
if (f.isStatic()) {
if (isQualified() && !qualifier().isTypeAccess())
b.newTemp(qualifier().eval(b));
if (requiresAccessor()) {
ArrayList list = new ArrayList();
result = b.newStaticInvokeExpr(f.createAccessor(fieldQualifierType().erasure()).sootRef(), list, this);
} else
result = b.newStaticFieldRef(sootRef(), this);
} else {
if (requiresAccessor()) {
soot.Local base = base(b);
ArrayList list = new ArrayList();
list.add(base);
result = b.newStaticInvokeExpr(f.createAccessor(fieldQualifierType().erasure()).sootRef(), list, this);
} else {
soot.Local base = createLoadQualifier(b);
result = b.newInstanceFieldRef(base, sootRef(), this);
}
}
if (f.type() != v.type())
result = f.type().emitCastTo(b, result, v.type(), this);
return result;
} else
return refined_Expressions_VarAccess_eval(b);
}
use of soot in project soot by Sable.
the class VarAccess method refined_Expressions_VarAccess_emitStore.
/**
* @ast method
* @aspect Expressions
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddExtensions/JimpleBackend/Expressions.jrag:270
*/
public soot.Value refined_Expressions_VarAccess_emitStore(Body b, soot.Value lvalue, soot.Value rvalue, ASTNode location) {
Variable v = decl();
if (v instanceof FieldDeclaration) {
FieldDeclaration f = (FieldDeclaration) v;
if (requiresAccessor()) {
if (f.isStatic()) {
ArrayList list = new ArrayList();
list.add(rvalue);
return asLocal(b, b.newStaticInvokeExpr(f.createAccessorWrite(fieldQualifierType()).sootRef(), list, location));
} else {
soot.Local base = base(b);
ArrayList list = new ArrayList();
list.add(base);
list.add(asLocal(b, rvalue, lvalue.getType()));
return asLocal(b, b.newStaticInvokeExpr(f.createAccessorWrite(fieldQualifierType()).sootRef(), list, location));
}
}
}
return super.emitStore(b, lvalue, rvalue, location);
}
use of soot in project soot by Sable.
the class VarAccess method refined_Expressions_VarAccess_eval.
/**
* @ast method
* @aspect Expressions
* @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddExtensions/JimpleBackend/Expressions.jrag:194
*/
public soot.Value refined_Expressions_VarAccess_eval(Body b) {
Variable v = decl();
if (v instanceof VariableDeclaration) {
VariableDeclaration decl = (VariableDeclaration) v;
if (decl.hostType() == hostType())
return decl.local;
else
return emitLoadLocalInNestedClass(b, decl);
} else if (v instanceof ParameterDeclaration) {
ParameterDeclaration decl = (ParameterDeclaration) v;
if (decl.hostType() == hostType())
return decl.local;
else
return emitLoadLocalInNestedClass(b, decl);
} else if (v instanceof FieldDeclaration) {
FieldDeclaration f = (FieldDeclaration) v;
if (f.hostType().isArrayDecl() && f.name().equals("length")) {
return b.newLengthExpr(asImmediate(b, createLoadQualifier(b)), this);
}
if (f.isStatic()) {
if (isQualified() && !qualifier().isTypeAccess())
b.newTemp(qualifier().eval(b));
if (requiresAccessor()) {
ArrayList list = new ArrayList();
return b.newStaticInvokeExpr(f.createAccessor(fieldQualifierType()).sootRef(), list, this);
} else
return b.newStaticFieldRef(sootRef(), this);
} else {
if (requiresAccessor()) {
soot.Local base = base(b);
ArrayList list = new ArrayList();
list.add(base);
return b.newStaticInvokeExpr(f.createAccessor(fieldQualifierType()).sootRef(), list, this);
} else {
soot.Local base = createLoadQualifier(b);
return b.newInstanceFieldRef(base, sootRef(), this);
}
}
} else
return super.eval(b);
}
Aggregations