repo
stringlengths 1
191
⌀ | file
stringlengths 23
351
| code
stringlengths 0
5.32M
| file_length
int64 0
5.32M
| avg_line_length
float64 0
2.9k
| max_line_length
int64 0
288k
| extension_type
stringclasses 1
value |
|---|---|---|---|---|---|---|
soot
|
soot-master/src/main/java/soot/jimple/NoSuchLocalException.java
|
package soot.jimple;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1997 - 1999 Raja Vallee-Rai
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
public class NoSuchLocalException extends RuntimeException {
public NoSuchLocalException(String s) {
super(s);
}
public NoSuchLocalException() {
}
}
| 991
| 29.060606
| 71
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/NopStmt.java
|
package soot.jimple;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1997 - 1999 Raja Vallee-Rai
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import soot.NopUnit;
public interface NopStmt extends NopUnit, Stmt {
}
| 901
| 31.214286
| 71
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/NullConstant.java
|
package soot.jimple;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1997 - 1999 Raja Vallee-Rai
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import soot.G;
import soot.NullType;
import soot.Singletons;
import soot.Type;
import soot.util.Switch;
public class NullConstant extends Constant {
public NullConstant(Singletons.Global g) {
}
public static NullConstant v() {
return G.v().soot_jimple_NullConstant();
}
@Override
public boolean equals(Object c) {
return c == G.v().soot_jimple_NullConstant();
}
@Override
public int hashCode() {
return 982;
}
@Override
public String toString() {
return Jimple.NULL;
}
@Override
public Type getType() {
return NullType.v();
}
@Override
public void apply(Switch sw) {
((ConstantSwitch) sw).caseNullConstant(this);
}
}
| 1,516
| 22.338462
| 71
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/NumericConstant.java
|
package soot.jimple;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1997 - 1999 Raja Vallee-Rai
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
public abstract class NumericConstant extends Constant {
private static final long serialVersionUID = -2757437961775194243L;
// PTC 1999/06/28
public abstract NumericConstant add(NumericConstant c);
public abstract NumericConstant subtract(NumericConstant c);
public abstract NumericConstant multiply(NumericConstant c);
public abstract NumericConstant divide(NumericConstant c);
public abstract NumericConstant remainder(NumericConstant c);
public abstract NumericConstant equalEqual(NumericConstant c);
public abstract NumericConstant notEqual(NumericConstant c);
public abstract boolean isLessThan(NumericConstant c);
public abstract NumericConstant lessThan(NumericConstant c);
public abstract NumericConstant lessThanOrEqual(NumericConstant c);
public abstract NumericConstant greaterThan(NumericConstant c);
public abstract NumericConstant greaterThanOrEqual(NumericConstant c);
public abstract NumericConstant negate();
}
| 1,802
| 31.196429
| 72
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/OrExpr.java
|
package soot.jimple;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1997 - 1999 Raja Vallee-Rai
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
public interface OrExpr extends BinopExpr {
}
| 875
| 31.444444
| 71
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/ParameterRef.java
|
package soot.jimple;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1997 - 1999 Raja Vallee-Rai
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.Collections;
import java.util.List;
import soot.Type;
import soot.UnitPrinter;
import soot.ValueBox;
import soot.util.Switch;
/**
* <code>ParameterRef</code> objects are used by <code>Body</code> objects to refer to the parameter slots on method entry.
* <br>
*
* For instance, in an instance method, the first statement will often be <code> this := @parameter0; </code>
*/
public class ParameterRef implements IdentityRef {
int n;
Type paramType;
/** Constructs a ParameterRef object of the specified type, representing the specified parameter number. */
public ParameterRef(Type paramType, int number) {
this.n = number;
this.paramType = paramType;
}
public boolean equivTo(Object o) {
if (o instanceof ParameterRef) {
return n == ((ParameterRef) o).n && paramType.equals(((ParameterRef) o).paramType);
}
return false;
}
public int equivHashCode() {
return n * 101 + paramType.hashCode() * 17;
}
/** Create a new ParameterRef object with the same paramType and number. */
public Object clone() {
return new ParameterRef(paramType, n);
}
/** Converts the given ParameterRef into a String i.e. <code>@parameter0: .int</code>. */
public String toString() {
return "@parameter" + n + ": " + paramType;
}
public void toString(UnitPrinter up) {
up.identityRef(this);
}
/** Returns the index of this ParameterRef. */
public int getIndex() {
return n;
}
/** Sets the index of this ParameterRef. */
public void setIndex(int index) {
n = index;
}
@Override
public final List<ValueBox> getUseBoxes() {
return Collections.emptyList();
}
/** Returns the type of this ParameterRef. */
public Type getType() {
return paramType;
}
/** Used with RefSwitch. */
public void apply(Switch sw) {
((RefSwitch) sw).caseParameterRef(this);
}
}
| 2,711
| 26.393939
| 123
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/PlaceholderStmt.java
|
package soot.jimple;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1997 - 1999 Raja Vallee-Rai
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import soot.Unit;
import soot.UnitPrinter;
import soot.jimple.internal.AbstractStmt;
public class PlaceholderStmt extends AbstractStmt {
private Unit source;
public String toString() {
return "<placeholder: " + source.toString() + ">";
}
public void toString(UnitPrinter up) {
up.literal("<placeholder: ");
source.toString(up);
up.literal(">");
}
PlaceholderStmt(Unit source) {
this.source = source;
}
public Unit getSource() {
return source;
}
public boolean fallsThrough() {
throw new RuntimeException();
}
public boolean branches() {
throw new RuntimeException();
}
public Object clone() {
throw new RuntimeException();
}
}
| 1,531
| 23.31746
| 71
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/PointerStmtSwitch.java
|
package soot.jimple;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 2003 Ondrej Lhotak
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import soot.ArrayType;
import soot.Local;
import soot.RefType;
import soot.Value;
public abstract class PointerStmtSwitch extends AbstractStmtSwitch {
Stmt statement;
/** A statement of the form l = constant; */
protected abstract void caseAssignConstStmt(Value dest, Constant c);
/** A statement of the form l = v; */
protected abstract void caseCopyStmt(Local dest, Local src);
/** A statement of the form l = (cl) v; */
protected void caseCastStmt(Local dest, Local src, CastExpr c) {
// default is to just ignore the cast
caseCopyStmt(dest, src);
}
/** An identity statement assigning a parameter to a local. */
protected abstract void caseIdentityStmt(Local dest, IdentityRef src);
/** A statement of the form l1 = l2.f; */
protected abstract void caseLoadStmt(Local dest, InstanceFieldRef src);
/** A statement of the form l1.f = l2; */
protected abstract void caseStoreStmt(InstanceFieldRef dest, Local src);
/** A statement of the form l1 = l2[i]; */
protected abstract void caseArrayLoadStmt(Local dest, ArrayRef src);
/** A statement of the form l1[i] = l2; */
protected abstract void caseArrayStoreStmt(ArrayRef dest, Local src);
/** A statement of the form l = cl.f; */
protected abstract void caseGlobalLoadStmt(Local dest, StaticFieldRef src);
/** A statement of the form cl.f = l; */
protected abstract void caseGlobalStoreStmt(StaticFieldRef dest, Local src);
/** A return statement. e is null if a non-reference type is returned. */
protected abstract void caseReturnStmt(Local val);
/** A return statement returning a constant. */
protected void caseReturnConstStmt(Constant val) {
// default is uninteresting
caseUninterestingStmt(statement);
}
/** Any type of new statement (NewStmt, NewArrayStmt, NewMultiArrayStmt) */
protected abstract void caseAnyNewStmt(Local dest, Expr e);
/** A new statement */
protected void caseNewStmt(Local dest, NewExpr e) {
caseAnyNewStmt(dest, e);
}
/** A newarray statement */
protected void caseNewArrayStmt(Local dest, NewArrayExpr e) {
caseAnyNewStmt(dest, e);
}
/** A anewarray statement */
protected void caseNewMultiArrayStmt(Local dest, NewMultiArrayExpr e) {
caseAnyNewStmt(dest, e);
}
/** A method invocation. dest is null if there is no reference type return value. */
protected abstract void caseInvokeStmt(Local dest, InvokeExpr e);
/** A throw statement */
protected void caseThrowStmt(Local thrownException) {
caseUninterestingStmt(statement);
}
/** A catch statement */
protected void caseCatchStmt(Local dest, CaughtExceptionRef cer) {
caseUninterestingStmt(statement);
}
/** Any other statement */
protected void caseUninterestingStmt(Stmt s) {
};
public final void caseAssignStmt(AssignStmt s) {
statement = s;
Value lhs = s.getLeftOp();
Value rhs = s.getRightOp();
if (!(lhs.getType() instanceof RefType) && !(lhs.getType() instanceof ArrayType)) {
if (rhs instanceof InvokeExpr) {
caseInvokeStmt(null, (InvokeExpr) rhs);
return;
}
caseUninterestingStmt(s);
return;
}
if (rhs instanceof InvokeExpr) {
caseInvokeStmt((Local) lhs, (InvokeExpr) rhs);
return;
}
if (lhs instanceof Local) {
if (rhs instanceof Local) {
caseCopyStmt((Local) lhs, (Local) rhs);
} else if (rhs instanceof InstanceFieldRef) {
caseLoadStmt((Local) lhs, (InstanceFieldRef) rhs);
} else if (rhs instanceof ArrayRef) {
caseArrayLoadStmt((Local) lhs, (ArrayRef) rhs);
} else if (rhs instanceof StaticFieldRef) {
caseGlobalLoadStmt((Local) lhs, (StaticFieldRef) rhs);
} else if (rhs instanceof NewExpr) {
caseNewStmt((Local) lhs, (NewExpr) rhs);
} else if (rhs instanceof NewArrayExpr) {
caseNewArrayStmt((Local) lhs, (NewArrayExpr) rhs);
} else if (rhs instanceof NewMultiArrayExpr) {
caseNewMultiArrayStmt((Local) lhs, (NewMultiArrayExpr) rhs);
} else if (rhs instanceof CastExpr) {
CastExpr r = (CastExpr) rhs;
Value rv = r.getOp();
if (rv instanceof Constant) {
caseAssignConstStmt(lhs, (Constant) rv);
} else {
caseCastStmt((Local) lhs, (Local) rv, r);
}
} else if (rhs instanceof Constant) {
caseAssignConstStmt(lhs, (Constant) rhs);
} else {
throw new RuntimeException("unhandled stmt " + s);
}
} else if (lhs instanceof InstanceFieldRef) {
if (rhs instanceof Local) {
caseStoreStmt((InstanceFieldRef) lhs, (Local) rhs);
} else if (rhs instanceof Constant) {
caseAssignConstStmt(lhs, (Constant) rhs);
} else {
throw new RuntimeException("unhandled stmt " + s);
}
} else if (lhs instanceof ArrayRef) {
if (rhs instanceof Local) {
caseArrayStoreStmt((ArrayRef) lhs, (Local) rhs);
} else if (rhs instanceof Constant) {
caseAssignConstStmt(lhs, (Constant) rhs);
} else {
throw new RuntimeException("unhandled stmt " + s);
}
} else if (lhs instanceof StaticFieldRef) {
if (rhs instanceof Local) {
caseGlobalStoreStmt((StaticFieldRef) lhs, (Local) rhs);
} else if (rhs instanceof Constant) {
caseAssignConstStmt(lhs, (Constant) rhs);
} else {
throw new RuntimeException("unhandled stmt " + s);
}
} else if (rhs instanceof Constant) {
caseAssignConstStmt(lhs, (Constant) rhs);
} else {
throw new RuntimeException("unhandled stmt " + s);
}
}
public final void caseReturnStmt(ReturnStmt s) {
statement = s;
Value op = s.getOp();
if (op.getType() instanceof RefType || op.getType() instanceof ArrayType) {
if (op instanceof Constant) {
caseReturnConstStmt((Constant) op);
} else {
caseReturnStmt((Local) op);
}
} else {
caseReturnStmt((Local) null);
}
}
public final void caseReturnVoidStmt(ReturnVoidStmt s) {
statement = s;
caseReturnStmt((Local) null);
}
public final void caseInvokeStmt(InvokeStmt s) {
statement = s;
caseInvokeStmt(null, s.getInvokeExpr());
}
public final void caseIdentityStmt(IdentityStmt s) {
statement = s;
Value lhs = s.getLeftOp();
Value rhs = s.getRightOp();
if (!(lhs.getType() instanceof RefType) && !(lhs.getType() instanceof ArrayType)) {
caseUninterestingStmt(s);
return;
}
Local llhs = (Local) lhs;
if (rhs instanceof CaughtExceptionRef) {
caseCatchStmt(llhs, (CaughtExceptionRef) rhs);
} else {
IdentityRef rrhs = (IdentityRef) rhs;
caseIdentityStmt(llhs, rrhs);
}
}
public final void caseThrowStmt(ThrowStmt s) {
statement = s;
caseThrowStmt((Local) s.getOp());
}
}
| 7,657
| 32.151515
| 87
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/ReachingTypeDumper.java
|
package soot.jimple;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 2002 Ondrej Lhotak
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Set;
import soot.Body;
import soot.Local;
import soot.PointsToAnalysis;
import soot.RefLikeType;
import soot.Scene;
import soot.SootClass;
import soot.SootMethod;
import soot.Type;
/**
* Dumps the reaching types of each local variable to a file in a format that can be easily compared with results of other
* analyses, such as VTA.
*
* @author Ondrej Lhotak
*/
public class ReachingTypeDumper {
private static class StringComparator<T> implements Comparator<T> {
public int compare(T o1, T o2) {
return o1.toString().compareTo(o2.toString());
}
}
public ReachingTypeDumper(PointsToAnalysis pa, String output_dir) {
this.pa = pa;
this.output_dir = output_dir;
}
public void dump() {
try {
PrintWriter file = new PrintWriter(new FileOutputStream(new File(output_dir, "types")));
for (SootClass cls : Scene.v().getApplicationClasses()) {
handleClass(file, cls);
}
for (SootClass cls : Scene.v().getLibraryClasses()) {
handleClass(file, cls);
}
file.close();
} catch (IOException e) {
throw new RuntimeException("Couldn't dump reaching types." + e);
}
}
/* End of public methods. */
/* End of package methods. */
protected PointsToAnalysis pa;
protected String output_dir;
protected void handleClass(PrintWriter out, SootClass c) {
for (SootMethod m : c.getMethods()) {
if (!m.isConcrete()) {
continue;
}
Body b = m.retrieveActiveBody();
Local[] sortedLocals = b.getLocals().toArray(new Local[b.getLocalCount()]);
Arrays.sort(sortedLocals, new StringComparator<Local>());
for (Local l : sortedLocals) {
out.println("V " + m + l);
if (l.getType() instanceof RefLikeType) {
Set<Type> types = pa.reachingObjects(l).possibleTypes();
Type[] sortedTypes = types.toArray(new Type[types.size()]);
Arrays.sort(sortedTypes, new StringComparator<Type>());
for (Type type : sortedTypes) {
out.println("T " + type);
}
}
}
}
}
}
| 3,088
| 27.869159
| 122
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/RealConstant.java
|
package soot.jimple;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1997 - 1999 Raja Vallee-Rai
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
/**
* Base type for floating point constants.
*
* @see DoubleConstant
* @see FloatConstant
*/
public abstract class RealConstant extends NumericConstant {
private static final long serialVersionUID = -5624501180441017529L;
/**
* Performs the indicated floating point comparison. For {@code NaN} comparisons {@code -1} is returned.
*
* @param constant
* the value to compare with
* @return {@code 0} if values are equal, {@code 1} if passed value less, or {@code -1} if passed value greater. When any
* of the values is {@code NaN} method returns {@code -1}.
*/
public abstract IntConstant cmpl(RealConstant constant);
/**
* Performs the indicated floating point comparison. For {@code NaN} comparisons {@code 1} is returned.
*
* @param constant
* the value to compare with
* @return {@code 0} if values are equal, {@code 1} if passed value less, or {@code -1} if passed value greater. When any
* of the values is {@code NaN} method returns {@code 1}.
*/
public abstract IntConstant cmpg(RealConstant constant);
}
| 1,937
| 33.607143
| 123
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/Ref.java
|
package soot.jimple;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1997 - 1999 Raja Vallee-Rai
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import soot.Value;
public interface Ref extends Value {
}
| 888
| 29.655172
| 71
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/RefSwitch.java
|
package soot.jimple;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1997 - 1999 Raja Vallee-Rai
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
public interface RefSwitch extends soot.util.Switch {
public abstract void caseArrayRef(ArrayRef v);
public abstract void caseStaticFieldRef(StaticFieldRef v);
public abstract void caseInstanceFieldRef(InstanceFieldRef v);
public abstract void caseParameterRef(ParameterRef v);
public abstract void caseCaughtExceptionRef(CaughtExceptionRef v);
public abstract void caseThisRef(ThisRef v);
public abstract void defaultCase(Object obj);
}
| 1,287
| 31.2
| 71
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/RemExpr.java
|
package soot.jimple;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1997 - 1999 Raja Vallee-Rai
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
public interface RemExpr extends BinopExpr {
}
| 876
| 31.481481
| 71
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/RetStmt.java
|
package soot.jimple;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1997 - 1999 Raja Vallee-Rai
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import soot.Value;
import soot.ValueBox;
public interface RetStmt extends Stmt {
public Value getStmtAddress();
public ValueBox getStmtAddressBox();
public void setStmtAddress(Value stmtAddress);
}
| 1,036
| 28.628571
| 71
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/ReturnStmt.java
|
package soot.jimple;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1997 - 1999 Raja Vallee-Rai
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import soot.Value;
import soot.ValueBox;
public interface ReturnStmt extends Stmt {
public ValueBox getOpBox();
public void setOp(Value returnValue);
public Value getOp();
}
| 1,012
| 27.942857
| 71
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/ReturnVoidStmt.java
|
package soot.jimple;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1997 - 1999 Raja Vallee-Rai
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
public interface ReturnVoidStmt extends Stmt {
}
| 878
| 31.555556
| 71
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/ShlExpr.java
|
package soot.jimple;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1997 - 1999 Raja Vallee-Rai
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
public interface ShlExpr extends BinopExpr {
}
| 876
| 31.481481
| 71
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/ShrExpr.java
|
package soot.jimple;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1997 - 1999 Raja Vallee-Rai
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
public interface ShrExpr extends BinopExpr {
}
| 876
| 31.481481
| 71
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/SpecialInvokeExpr.java
|
package soot.jimple;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1997 - 1999 Raja Vallee-Rai
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
public interface SpecialInvokeExpr extends InstanceInvokeExpr {
}
| 895
| 32.185185
| 71
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/StaticFieldRef.java
|
package soot.jimple;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1997 - 1999 Raja Vallee-Rai
* Copyright (C) 2004 Ondrej Lhotak
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.Collections;
import java.util.List;
import soot.SootField;
import soot.SootFieldRef;
import soot.Type;
import soot.Unit;
import soot.UnitPrinter;
import soot.ValueBox;
import soot.baf.Baf;
import soot.util.Switch;
public class StaticFieldRef implements FieldRef, ConvertToBaf {
protected SootFieldRef fieldRef;
protected StaticFieldRef(SootFieldRef fieldRef) {
if (!fieldRef.isStatic()) {
throw new RuntimeException("wrong static-ness");
}
this.fieldRef = fieldRef;
}
public Object clone() {
return new StaticFieldRef(fieldRef);
}
public String toString() {
return fieldRef.getSignature();
}
public void toString(UnitPrinter up) {
up.fieldRef(fieldRef);
}
public SootFieldRef getFieldRef() {
return fieldRef;
}
public void setFieldRef(SootFieldRef fieldRef) {
this.fieldRef = fieldRef;
}
public SootField getField() {
return fieldRef.resolve();
}
@Override
public List<ValueBox> getUseBoxes() {
return Collections.emptyList();
}
public Type getType() {
return fieldRef.type();
}
public void apply(Switch sw) {
((RefSwitch) sw).caseStaticFieldRef(this);
}
public boolean equivTo(Object o) {
if (o instanceof StaticFieldRef) {
return ((StaticFieldRef) o).getField().equals(getField());
}
return false;
}
public int equivHashCode() {
return getField().equivHashCode();
}
public void convertToBaf(JimpleToBafContext context, List<Unit> out) {
Unit u = Baf.v().newStaticGetInst(fieldRef);
u.addAllTagsOf(context.getCurrentUnit());
out.add(u);
}
}
| 2,485
| 22.903846
| 72
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/StaticInvokeExpr.java
|
package soot.jimple;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1997 - 1999 Raja Vallee-Rai
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import soot.Type;
import soot.util.Switch;
public interface StaticInvokeExpr extends InvokeExpr {
public Type getType();
public void apply(Switch sw);
}
| 988
| 28.969697
| 71
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/Stmt.java
|
package soot.jimple;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1997 - 1999 Raja Vallee-Rai
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import soot.Unit;
import soot.ValueBox;
public interface Stmt extends Unit {
public boolean containsInvokeExpr();
public InvokeExpr getInvokeExpr();
public ValueBox getInvokeExprBox();
public boolean containsArrayRef();
public ArrayRef getArrayRef();
public ValueBox getArrayRefBox();
public boolean containsFieldRef();
public FieldRef getFieldRef();
public ValueBox getFieldRefBox();
}
| 1,244
| 24.9375
| 71
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/StmtBody.java
|
package soot.jimple;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1997 - 1999 Raja Vallee-Rai
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import soot.Body;
import soot.SootMethod;
/** Abstract base class for Body's on Stmts (Jimple and Grimp). */
@SuppressWarnings("serial")
abstract public class StmtBody extends Body {
/** Creates a StmtBody associated with the given method. */
protected StmtBody(SootMethod m) {
super(m);
}
/** Creates an empty StmtBody. */
protected StmtBody() {
}
}
| 1,198
| 28.975
| 71
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/StmtSwitch.java
|
package soot.jimple;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1997 - 1999 Raja Vallee-Rai
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import soot.util.Switch;
public interface StmtSwitch extends Switch {
public abstract void caseBreakpointStmt(BreakpointStmt stmt);
public abstract void caseInvokeStmt(InvokeStmt stmt);
public abstract void caseAssignStmt(AssignStmt stmt);
public abstract void caseIdentityStmt(IdentityStmt stmt);
public abstract void caseEnterMonitorStmt(EnterMonitorStmt stmt);
public abstract void caseExitMonitorStmt(ExitMonitorStmt stmt);
public abstract void caseGotoStmt(GotoStmt stmt);
public abstract void caseIfStmt(IfStmt stmt);
public abstract void caseLookupSwitchStmt(LookupSwitchStmt stmt);
public abstract void caseNopStmt(NopStmt stmt);
public abstract void caseRetStmt(RetStmt stmt);
public abstract void caseReturnStmt(ReturnStmt stmt);
public abstract void caseReturnVoidStmt(ReturnVoidStmt stmt);
public abstract void caseTableSwitchStmt(TableSwitchStmt stmt);
public abstract void caseThrowStmt(ThrowStmt stmt);
public abstract void defaultCase(Object obj);
}
| 1,843
| 29.733333
| 71
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/StringConstant.java
|
package soot.jimple;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1997 - 1999 Raja Vallee-Rai
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import soot.RefType;
import soot.Type;
import soot.util.StringTools;
import soot.util.Switch;
public class StringConstant extends Constant {
public final String value;
public static final StringConstant EMPTY_STRING = new StringConstant("");
private StringConstant(String s) {
if (s == null) {
throw new IllegalArgumentException("String constant cannot be null");
}
this.value = s;
}
public static StringConstant v(String value) {
if (value.isEmpty()) {
return EMPTY_STRING;
}
return new StringConstant(value);
}
// In this case, equals should be structural equality.
@Override
public boolean equals(Object c) {
return (c instanceof StringConstant && ((StringConstant) c).value.equals(this.value));
}
/** Returns a hash code for this StringConstant object. */
@Override
public int hashCode() {
return value.hashCode();
}
@Override
public String toString() {
return StringTools.getQuotedStringOf(value);
}
@Override
public Type getType() {
return RefType.v("java.lang.String");
}
@Override
public void apply(Switch sw) {
((ConstantSwitch) sw).caseStringConstant(this);
}
}
| 2,012
| 25.486842
| 90
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/SubExpr.java
|
package soot.jimple;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1997 - 1999 Raja Vallee-Rai
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
public interface SubExpr extends BinopExpr {
}
| 876
| 31.481481
| 71
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/SwitchStmt.java
|
package soot.jimple;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1997 - 1999 Raja Vallee-Rai
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.List;
import soot.Unit;
import soot.UnitBox;
import soot.Value;
import soot.ValueBox;
public interface SwitchStmt extends Stmt {
public Unit getDefaultTarget();
public void setDefaultTarget(Unit defaultTarget);
public UnitBox getDefaultTargetBox();
public Value getKey();
public void setKey(Value key);
public ValueBox getKeyBox();
public List<Unit> getTargets();
public Unit getTarget(int index);
public void setTarget(int index, Unit target);
public UnitBox getTargetBox(int index);
}
| 1,364
| 24.754717
| 71
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/TableSwitchStmt.java
|
package soot.jimple;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1997 - 1999 Raja Vallee-Rai
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.List;
import soot.Unit;
public interface TableSwitchStmt extends SwitchStmt {
public void setLowIndex(int lowIndex);
public void setHighIndex(int highIndex);
public int getLowIndex();
public int getHighIndex();
public void setTargets(List<? extends Unit> targets);
}
| 1,129
| 27.25
| 71
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/ThisRef.java
|
package soot.jimple;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1997 - 1999 Raja Vallee-Rai
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.Collections;
import java.util.List;
import soot.RefType;
import soot.Type;
import soot.UnitPrinter;
import soot.ValueBox;
import soot.util.Switch;
public class ThisRef implements IdentityRef {
RefType thisType;
public ThisRef(RefType thisType) {
this.thisType = thisType;
}
@Override
public boolean equivTo(Object o) {
return (o instanceof ThisRef) && this.thisType.equals(((ThisRef) o).thisType);
}
@Override
public int equivHashCode() {
return thisType.hashCode();
}
@Override
public String toString() {
return "@this: " + thisType;
}
@Override
public void toString(UnitPrinter up) {
up.identityRef(this);
}
@Override
public final List<ValueBox> getUseBoxes() {
return Collections.emptyList();
}
@Override
public Type getType() {
return thisType;
}
@Override
public void apply(Switch sw) {
((RefSwitch) sw).caseThisRef(this);
}
@Override
public Object clone() {
return new ThisRef(thisType);
}
}
| 1,846
| 21.52439
| 82
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/ThrowStmt.java
|
package soot.jimple;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1997 - 1999 Raja Vallee-Rai
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import soot.Value;
import soot.ValueBox;
public interface ThrowStmt extends Stmt {
public ValueBox getOpBox();
public Value getOp();
public void setOp(Value op);
}
| 1,002
| 27.657143
| 71
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/UnopExpr.java
|
package soot.jimple;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1997 - 1999 Raja Vallee-Rai
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import soot.Value;
import soot.ValueBox;
public interface UnopExpr extends Expr {
public Value getOp();
public void setOp(Value op);
public ValueBox getOpBox();
}
| 1,001
| 27.628571
| 71
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/UshrExpr.java
|
package soot.jimple;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1997 - 1999 Raja Vallee-Rai
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
public interface UshrExpr extends BinopExpr {
}
| 877
| 31.518519
| 71
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/VirtualInvokeExpr.java
|
package soot.jimple;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1997 - 1999 Raja Vallee-Rai
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
public interface VirtualInvokeExpr extends InstanceInvokeExpr {
}
| 895
| 32.185185
| 71
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/XorExpr.java
|
package soot.jimple;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1997 - 1999 Raja Vallee-Rai
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
public interface XorExpr extends BinopExpr {
}
| 876
| 31.481481
| 71
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/AbstractBinopExpr.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.ArrayList;
import java.util.List;
import soot.UnitPrinter;
import soot.Value;
import soot.ValueBox;
import soot.grimp.PrecedenceTest;
import soot.jimple.Expr;
@SuppressWarnings("serial")
public abstract class AbstractBinopExpr implements Expr {
protected final ValueBox op1Box;
protected final ValueBox op2Box;
protected AbstractBinopExpr(ValueBox op1Box, ValueBox op2Box) {
this.op1Box = op1Box;
this.op2Box = op2Box;
}
/** Returns the unique symbol for an operator. */
protected abstract String getSymbol();
@Override
public abstract Object clone();
public Value getOp1() {
return op1Box.getValue();
}
public Value getOp2() {
return op2Box.getValue();
}
public ValueBox getOp1Box() {
return op1Box;
}
public ValueBox getOp2Box() {
return op2Box;
}
public void setOp1(Value op1) {
op1Box.setValue(op1);
}
public void setOp2(Value op2) {
op2Box.setValue(op2);
}
@Override
public final List<ValueBox> getUseBoxes() {
List<ValueBox> list = new ArrayList<ValueBox>();
list.addAll(op1Box.getValue().getUseBoxes());
list.add(op1Box);
list.addAll(op2Box.getValue().getUseBoxes());
list.add(op2Box);
return list;
}
@Override
public boolean equivTo(Object o) {
if (o instanceof AbstractBinopExpr) {
AbstractBinopExpr abe = (AbstractBinopExpr) o;
return this.op1Box.getValue().equivTo(abe.op1Box.getValue()) && this.op2Box.getValue().equivTo(abe.op2Box.getValue())
&& this.getSymbol().equals(abe.getSymbol());
}
return false;
}
/** Returns a hash code for this object, consistent with structural equality. */
@Override
public int equivHashCode() {
return op1Box.getValue().equivHashCode() * 101 + op2Box.getValue().equivHashCode() + 17 ^ getSymbol().hashCode();
}
@Override
public String toString() {
return op1Box.getValue().toString() + getSymbol() + op2Box.getValue().toString();
}
@Override
public void toString(UnitPrinter up) {
{
final boolean needsBrackets = PrecedenceTest.needsBrackets(op1Box, this);
if (needsBrackets) {
up.literal("(");
}
op1Box.toString(up);
if (needsBrackets) {
up.literal(")");
}
}
up.literal(getSymbol());
{
final boolean needsBrackets = PrecedenceTest.needsBracketsRight(op2Box, this);
if (needsBrackets) {
up.literal("(");
}
op2Box.toString(up);
if (needsBrackets) {
up.literal(")");
}
}
}
}
| 3,377
| 23.838235
| 123
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/AbstractCastExpr.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.ArrayList;
import java.util.List;
import soot.ArrayType;
import soot.RefType;
import soot.Type;
import soot.Unit;
import soot.UnitPrinter;
import soot.Value;
import soot.ValueBox;
import soot.baf.Baf;
import soot.grimp.PrecedenceTest;
import soot.jimple.CastExpr;
import soot.jimple.ConvertToBaf;
import soot.jimple.ExprSwitch;
import soot.jimple.Jimple;
import soot.jimple.JimpleToBafContext;
import soot.util.Switch;
@SuppressWarnings("serial")
public abstract class AbstractCastExpr implements CastExpr, ConvertToBaf {
protected final ValueBox opBox;
protected Type type;
AbstractCastExpr(Value op, Type type) {
this(Jimple.v().newImmediateBox(op), type);
}
@Override
public abstract Object clone();
protected AbstractCastExpr(ValueBox opBox, Type type) {
this.opBox = opBox;
this.type = type;
}
@Override
public boolean equivTo(Object o) {
if (o instanceof AbstractCastExpr) {
AbstractCastExpr ace = (AbstractCastExpr) o;
return this.opBox.getValue().equivTo(ace.opBox.getValue()) && this.type.equals(ace.type);
}
return false;
}
/** Returns a hash code for this object, consistent with structural equality. */
@Override
public int equivHashCode() {
return opBox.getValue().equivHashCode() * 101 + type.hashCode() + 17;
}
@Override
public String toString() {
return "(" + type.toString() + ") " + opBox.getValue().toString();
}
@Override
public void toString(UnitPrinter up) {
up.literal("(");
up.type(type);
up.literal(") ");
final boolean needsBrackets = PrecedenceTest.needsBrackets(opBox, this);
if (needsBrackets) {
up.literal("(");
}
opBox.toString(up);
if (needsBrackets) {
up.literal(")");
}
}
@Override
public Value getOp() {
return opBox.getValue();
}
@Override
public void setOp(Value op) {
opBox.setValue(op);
}
@Override
public ValueBox getOpBox() {
return opBox;
}
@Override
public final List<ValueBox> getUseBoxes() {
List<ValueBox> list = new ArrayList<ValueBox>(opBox.getValue().getUseBoxes());
list.add(opBox);
return list;
}
@Override
public Type getCastType() {
return type;
}
@Override
public void setCastType(Type castType) {
this.type = castType;
}
@Override
public Type getType() {
return type;
}
@Override
public void apply(Switch sw) {
((ExprSwitch) sw).caseCastExpr(this);
}
@Override
public void convertToBaf(JimpleToBafContext context, List<Unit> out) {
((ConvertToBaf) getOp()).convertToBaf(context, out);
Unit u;
final Type toType = getCastType();
if (toType instanceof ArrayType || toType instanceof RefType) {
u = Baf.v().newInstanceCastInst(toType);
} else {
final Type fromType = getOp().getType();
if (!fromType.equals(toType)) {
u = Baf.v().newPrimitiveCastInst(fromType, toType);
} else {
u = Baf.v().newNopInst();
}
}
out.add(u);
u.addAllTagsOf(context.getCurrentUnit());
}
}
| 3,891
| 23.173913
| 95
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/AbstractDefinitionStmt.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import soot.Value;
import soot.ValueBox;
import soot.jimple.DefinitionStmt;
@SuppressWarnings("serial")
public abstract class AbstractDefinitionStmt extends AbstractStmt implements DefinitionStmt {
protected final ValueBox leftBox;
protected final ValueBox rightBox;
protected AbstractDefinitionStmt(ValueBox leftBox, ValueBox rightBox) {
this.leftBox = leftBox;
this.rightBox = rightBox;
}
@Override
public final Value getLeftOp() {
return leftBox.getValue();
}
@Override
public final Value getRightOp() {
return rightBox.getValue();
}
@Override
public final ValueBox getLeftOpBox() {
return leftBox;
}
@Override
public final ValueBox getRightOpBox() {
return rightBox;
}
@Override
public final List<ValueBox> getDefBoxes() {
return Collections.singletonList(leftBox);
}
@Override
public final List<ValueBox> getUseBoxes() {
List<ValueBox> list = new ArrayList<ValueBox>();
list.addAll(getLeftOp().getUseBoxes());
list.add(rightBox);
list.addAll(getRightOp().getUseBoxes());
return list;
}
@Override
public boolean fallsThrough() {
return true;
}
@Override
public boolean branches() {
return false;
}
}
| 2,136
| 23.284091
| 93
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/AbstractFloatBinopExpr.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import soot.BooleanType;
import soot.ByteType;
import soot.CharType;
import soot.DoubleType;
import soot.FloatType;
import soot.IntType;
import soot.LongType;
import soot.ShortType;
import soot.Type;
import soot.UnknownType;
import soot.ValueBox;
@SuppressWarnings("serial")
public abstract class AbstractFloatBinopExpr extends AbstractBinopExpr {
protected AbstractFloatBinopExpr(ValueBox op1Box, ValueBox op2Box) {
super(op1Box, op2Box);
}
@Override
public Type getType() {
final Type t1 = op1Box.getValue().getType();
final Type t2 = op2Box.getValue().getType();
final IntType tyInt = IntType.v();
final ByteType tyByte = ByteType.v();
final ShortType tyShort = ShortType.v();
final CharType tyChar = CharType.v();
final BooleanType tyBool = BooleanType.v();
if ((tyInt.equals(t1) || tyByte.equals(t1) || tyShort.equals(t1) || tyChar.equals(t1) || tyBool.equals(t1))
&& (tyInt.equals(t2) || tyByte.equals(t2) || tyShort.equals(t2) || tyChar.equals(t2) || tyBool.equals(t2))) {
return tyInt;
}
final LongType tyLong = LongType.v();
if (tyLong.equals(t1) || tyLong.equals(t2)) {
return tyLong;
}
final DoubleType tyDouble = DoubleType.v();
if (tyDouble.equals(t1) || tyDouble.equals(t2)) {
return tyDouble;
}
final FloatType tyFloat = FloatType.v();
if (tyFloat.equals(t1) || tyFloat.equals(t2)) {
return tyFloat;
}
return UnknownType.v();
}
}
| 2,298
| 30.493151
| 117
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/AbstractInstanceFieldRef.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* Copyright (C) 2004 Ondrej Lhotak
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.ArrayList;
import java.util.List;
import soot.SootField;
import soot.SootFieldRef;
import soot.Type;
import soot.Unit;
import soot.UnitPrinter;
import soot.Value;
import soot.ValueBox;
import soot.baf.Baf;
import soot.grimp.PrecedenceTest;
import soot.jimple.ConvertToBaf;
import soot.jimple.InstanceFieldRef;
import soot.jimple.JimpleToBafContext;
import soot.jimple.RefSwitch;
import soot.util.Switch;
@SuppressWarnings("serial")
public abstract class AbstractInstanceFieldRef implements InstanceFieldRef, ConvertToBaf {
protected SootFieldRef fieldRef;
final ValueBox baseBox;
protected AbstractInstanceFieldRef(ValueBox baseBox, SootFieldRef fieldRef) {
if (fieldRef.isStatic()) {
throw new RuntimeException("wrong static-ness");
}
this.baseBox = baseBox;
this.fieldRef = fieldRef;
}
public abstract Object clone();
public String toString() {
return baseBox.getValue().toString() + "." + fieldRef.getSignature();
}
public void toString(UnitPrinter up) {
if (PrecedenceTest.needsBrackets(baseBox, this)) {
up.literal("(");
}
baseBox.toString(up);
if (PrecedenceTest.needsBrackets(baseBox, this)) {
up.literal(")");
}
up.literal(".");
up.fieldRef(fieldRef);
}
public Value getBase() {
return baseBox.getValue();
}
public ValueBox getBaseBox() {
return baseBox;
}
public void setBase(Value base) {
baseBox.setValue(base);
}
public SootFieldRef getFieldRef() {
return fieldRef;
}
public void setFieldRef(SootFieldRef fieldRef) {
this.fieldRef = fieldRef;
}
public SootField getField() {
return fieldRef.resolve();
}
@Override
public final List<ValueBox> getUseBoxes() {
List<ValueBox> useBoxes = new ArrayList<ValueBox>();
useBoxes.addAll(baseBox.getValue().getUseBoxes());
useBoxes.add(baseBox);
return useBoxes;
}
public Type getType() {
return fieldRef.type();
}
public void apply(Switch sw) {
((RefSwitch) sw).caseInstanceFieldRef(this);
}
public boolean equivTo(Object o) {
if (o instanceof AbstractInstanceFieldRef) {
AbstractInstanceFieldRef fr = (AbstractInstanceFieldRef) o;
return fr.getField().equals(getField()) && fr.baseBox.getValue().equivTo(baseBox.getValue());
}
return false;
}
/** Returns a hash code for this object, consistent with structural equality. */
public int equivHashCode() {
return getField().equivHashCode() * 101 + baseBox.getValue().equivHashCode() + 17;
}
public void convertToBaf(JimpleToBafContext context, List<Unit> out) {
((ConvertToBaf) getBase()).convertToBaf(context, out);
Unit u;
out.add(u = Baf.v().newFieldGetInst(fieldRef));
u.addAllTagsOf(context.getCurrentUnit());
}
}
| 3,648
| 25.442029
| 99
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/AbstractInstanceInvokeExpr.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import soot.SootMethodRef;
import soot.Value;
import soot.ValueBox;
import soot.jimple.InstanceInvokeExpr;
@SuppressWarnings("serial")
public abstract class AbstractInstanceInvokeExpr extends AbstractInvokeExpr implements InstanceInvokeExpr {
protected final ValueBox baseBox;
protected AbstractInstanceInvokeExpr(SootMethodRef methodRef, ValueBox baseBox, ValueBox[] argBoxes) {
super(methodRef, argBoxes);
this.baseBox = baseBox;
}
@Override
public Value getBase() {
return baseBox.getValue();
}
@Override
public ValueBox getBaseBox() {
return baseBox;
}
@Override
public void setBase(Value base) {
baseBox.setValue(base);
}
@Override
public List<ValueBox> getUseBoxes() {
List<ValueBox> list = new ArrayList<ValueBox>(baseBox.getValue().getUseBoxes());
list.add(baseBox);
if (argBoxes != null) {
Collections.addAll(list, argBoxes);
for (ValueBox element : argBoxes) {
list.addAll(element.getValue().getUseBoxes());
}
}
return list;
}
}
| 1,953
| 25.405405
| 107
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/AbstractInstanceOfExpr.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.ArrayList;
import java.util.List;
import soot.BooleanType;
import soot.Type;
import soot.UnitPrinter;
import soot.Value;
import soot.ValueBox;
import soot.jimple.ExprSwitch;
import soot.jimple.InstanceOfExpr;
import soot.jimple.Jimple;
import soot.util.Switch;
@SuppressWarnings("serial")
public abstract class AbstractInstanceOfExpr implements InstanceOfExpr {
protected final ValueBox opBox;
protected Type checkType;
protected AbstractInstanceOfExpr(ValueBox opBox, Type checkType) {
this.opBox = opBox;
this.checkType = checkType;
}
@Override
public abstract Object clone();
@Override
public boolean equivTo(Object o) {
if (o instanceof AbstractInstanceOfExpr) {
AbstractInstanceOfExpr aie = (AbstractInstanceOfExpr) o;
return this.opBox.getValue().equivTo(aie.opBox.getValue()) && this.checkType.equals(aie.checkType);
}
return false;
}
/** Returns a hash code for this object, consistent with structural equality. */
@Override
public int equivHashCode() {
return opBox.getValue().equivHashCode() * 101 + checkType.hashCode() * 17;
}
@Override
public String toString() {
return opBox.getValue().toString() + " " + Jimple.INSTANCEOF + " " + checkType.toString();
}
@Override
public void toString(UnitPrinter up) {
opBox.toString(up);
up.literal(" " + Jimple.INSTANCEOF + " ");
up.type(checkType);
}
@Override
public Value getOp() {
return opBox.getValue();
}
@Override
public void setOp(Value op) {
opBox.setValue(op);
}
@Override
public ValueBox getOpBox() {
return opBox;
}
@Override
public final List<ValueBox> getUseBoxes() {
List<ValueBox> list = new ArrayList<ValueBox>(opBox.getValue().getUseBoxes());
list.add(opBox);
return list;
}
@Override
public Type getType() {
return BooleanType.v();
}
@Override
public Type getCheckType() {
return checkType;
}
@Override
public void setCheckType(Type checkType) {
this.checkType = checkType;
}
@Override
public void apply(Switch sw) {
((ExprSwitch) sw).caseInstanceOfExpr(this);
}
}
| 2,975
| 23.595041
| 105
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/AbstractIntBinopExpr.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import soot.IntType;
import soot.Type;
import soot.ValueBox;
@SuppressWarnings("serial")
public abstract class AbstractIntBinopExpr extends AbstractBinopExpr {
protected AbstractIntBinopExpr(ValueBox op1Box, ValueBox op2Box) {
super(op1Box, op2Box);
}
@Override
public Type getType() {
return IntType.v();
}
}
| 1,158
| 27.268293
| 71
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/AbstractIntLongBinopExpr.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import soot.BooleanType;
import soot.ByteType;
import soot.CharType;
import soot.IntType;
import soot.LongType;
import soot.ShortType;
import soot.Type;
import soot.UnknownType;
import soot.ValueBox;
@SuppressWarnings("serial")
public abstract class AbstractIntLongBinopExpr extends AbstractBinopExpr {
protected AbstractIntLongBinopExpr(ValueBox op1Box, ValueBox op2Box) {
super(op1Box, op2Box);
}
public static boolean isIntLikeType(Type t) {
return IntType.v().equals(t) || ByteType.v().equals(t) || ShortType.v().equals(t) || CharType.v().equals(t)
|| BooleanType.v().equals(t);
}
@Override
public Type getType() {
final Type t1 = op1Box.getValue().getType();
final Type t2 = op2Box.getValue().getType();
final IntType tyInt = IntType.v();
final ByteType tyByte = ByteType.v();
final ShortType tyShort = ShortType.v();
final CharType tyChar = CharType.v();
final BooleanType tyBool = BooleanType.v();
if ((tyInt.equals(t1) || tyByte.equals(t1) || tyShort.equals(t1) || tyChar.equals(t1) || tyBool.equals(t1))
&& (tyInt.equals(t2) || tyByte.equals(t2) || tyShort.equals(t2) || tyChar.equals(t2) || tyBool.equals(t2))) {
return tyInt;
}
final LongType tyLong = LongType.v();
if (tyLong.equals(t1) && tyLong.equals(t2)) {
return tyLong;
}
return UnknownType.v();
}
}
| 2,202
| 31.397059
| 117
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/AbstractInterfaceInvokeExpr.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* Copyright (C) 2004 Ondrej Lhotak
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.List;
import soot.DoubleType;
import soot.LongType;
import soot.SootMethodRef;
import soot.Type;
import soot.Unit;
import soot.UnitPrinter;
import soot.ValueBox;
import soot.VoidType;
import soot.baf.Baf;
import soot.jimple.ConvertToBaf;
import soot.jimple.ExprSwitch;
import soot.jimple.InterfaceInvokeExpr;
import soot.jimple.Jimple;
import soot.jimple.JimpleToBafContext;
import soot.util.Switch;
@SuppressWarnings("serial")
public abstract class AbstractInterfaceInvokeExpr extends AbstractInstanceInvokeExpr
implements InterfaceInvokeExpr, ConvertToBaf {
protected AbstractInterfaceInvokeExpr(ValueBox baseBox, SootMethodRef methodRef, ValueBox[] argBoxes) {
super(methodRef, baseBox, argBoxes);
if (methodRef.isStatic()) {
throw new RuntimeException("wrong static-ness");
}
}
@Override
public boolean equivTo(Object o) {
if (o instanceof AbstractInterfaceInvokeExpr) {
AbstractInterfaceInvokeExpr ie = (AbstractInterfaceInvokeExpr) o;
if ((this.argBoxes == null ? 0 : this.argBoxes.length) != (ie.argBoxes == null ? 0 : ie.argBoxes.length)
|| !this.getMethod().equals(ie.getMethod()) || !this.baseBox.getValue().equivTo(ie.baseBox.getValue())) {
return false;
}
if (this.argBoxes != null) {
for (int i = 0, e = this.argBoxes.length; i < e; i++) {
if (!this.argBoxes[i].getValue().equivTo(ie.argBoxes[i].getValue())) {
return false;
}
}
}
return true;
}
return false;
}
/**
* Returns a hash code for this object, consistent with structural equality.
*/
@Override
public int equivHashCode() {
return baseBox.getValue().equivHashCode() * 101 + getMethod().equivHashCode() * 17;
}
@Override
public String toString() {
StringBuilder buf = new StringBuilder(Jimple.INTERFACEINVOKE + " ");
buf.append(baseBox.getValue().toString()).append('.').append(methodRef.getSignature()).append('(');
if (argBoxes != null) {
for (int i = 0, e = argBoxes.length; i < e; i++) {
if (i != 0) {
buf.append(", ");
}
buf.append(argBoxes[i].getValue().toString());
}
}
buf.append(')');
return buf.toString();
}
@Override
public void toString(UnitPrinter up) {
up.literal(Jimple.INTERFACEINVOKE + " ");
baseBox.toString(up);
up.literal(".");
up.methodRef(methodRef);
up.literal("(");
if (argBoxes != null) {
for (int i = 0, e = argBoxes.length; i < e; i++) {
if (i != 0) {
up.literal(", ");
}
argBoxes[i].toString(up);
}
}
up.literal(")");
}
@Override
public void apply(Switch sw) {
((ExprSwitch) sw).caseInterfaceInvokeExpr(this);
}
private static int sizeOfType(Type t) {
if (t instanceof DoubleType || t instanceof LongType) {
return 2;
} else if (t instanceof VoidType) {
return 0;
} else {
return 1;
}
}
private static int argCountOf(SootMethodRef m) {
int argCount = 0;
for (Type t : m.parameterTypes()) {
argCount += sizeOfType(t);
}
return argCount;
}
@Override
public void convertToBaf(JimpleToBafContext context, List<Unit> out) {
((ConvertToBaf) getBase()).convertToBaf(context, out);
if (argBoxes != null) {
for (ValueBox element : argBoxes) {
((ConvertToBaf) element.getValue()).convertToBaf(context, out);
}
}
Unit u = Baf.v().newInterfaceInvokeInst(methodRef, argCountOf(methodRef));
out.add(u);
u.addAllTagsOf(context.getCurrentUnit());
}
}
| 4,479
| 27.535032
| 115
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/AbstractInvokeExpr.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* Copyright (C) 2004 Ondrej Lhotak
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import soot.SootMethod;
import soot.SootMethodRef;
import soot.Type;
import soot.Value;
import soot.ValueBox;
import soot.jimple.InvokeExpr;
@SuppressWarnings("serial")
public abstract class AbstractInvokeExpr implements InvokeExpr {
protected SootMethodRef methodRef;
protected final ValueBox[] argBoxes;
protected AbstractInvokeExpr(SootMethodRef methodRef, ValueBox[] argBoxes) {
this.methodRef = methodRef;
this.argBoxes = argBoxes.length == 0 ? null : argBoxes;
}
@Override
public void setMethodRef(SootMethodRef methodRef) {
this.methodRef = methodRef;
}
@Override
public SootMethodRef getMethodRef() {
return methodRef;
}
@Override
public SootMethod getMethod() {
return methodRef.resolve();
}
@Override
public abstract Object clone();
@Override
public Value getArg(int index) {
if (argBoxes == null) {
return null;
}
ValueBox vb = argBoxes[index];
return vb == null ? null : vb.getValue();
}
@Override
public List<Value> getArgs() {
final ValueBox[] boxes = this.argBoxes;
final List<Value> r;
if (boxes == null) {
r = new ArrayList<>(0);
} else {
r = new ArrayList<>(boxes.length);
for (ValueBox element : boxes) {
r.add(element == null ? null : element.getValue());
}
}
return r;
}
@Override
public int getArgCount() {
return argBoxes == null ? 0 : argBoxes.length;
}
@Override
public void setArg(int index, Value arg) {
argBoxes[index].setValue(arg);
}
@Override
public ValueBox getArgBox(int index) {
return argBoxes[index];
}
@Override
public Type getType() {
return methodRef.returnType();
}
@Override
public List<ValueBox> getUseBoxes() {
final ValueBox[] boxes = argBoxes;
if (boxes == null) {
return Collections.emptyList();
}
List<ValueBox> list = new ArrayList<ValueBox>();
Collections.addAll(list, boxes);
for (ValueBox element : boxes) {
list.addAll(element.getValue().getUseBoxes());
}
return list;
}
}
| 3,015
| 23.128
| 78
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/AbstractJimpleBinopExpr.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import soot.Value;
import soot.jimple.Jimple;
@SuppressWarnings("serial")
public abstract class AbstractJimpleBinopExpr extends AbstractBinopExpr {
protected AbstractJimpleBinopExpr(Value op1, Value op2) {
super(Jimple.v().newArgBox(op1), Jimple.v().newArgBox(op2));
}
}
| 1,108
| 30.685714
| 73
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/AbstractJimpleFloatBinopExpr.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.List;
import soot.Type;
import soot.Unit;
import soot.Value;
import soot.ValueBox;
import soot.jimple.ConvertToBaf;
import soot.jimple.Jimple;
import soot.jimple.JimpleToBafContext;
@SuppressWarnings("serial")
public abstract class AbstractJimpleFloatBinopExpr extends AbstractFloatBinopExpr implements ConvertToBaf {
AbstractJimpleFloatBinopExpr(Value op1, Value op2) {
this(Jimple.v().newArgBox(op1), Jimple.v().newArgBox(op2));
}
protected AbstractJimpleFloatBinopExpr(ValueBox op1Box, ValueBox op2Box) {
super(op1Box, op2Box);
}
@Override
public void convertToBaf(JimpleToBafContext context, List<Unit> out) {
((ConvertToBaf) this.getOp1()).convertToBaf(context, out);
((ConvertToBaf) this.getOp2()).convertToBaf(context, out);
Unit u = makeBafInst(this.getOp1().getType());
out.add(u);
u.addAllTagsOf(context.getCurrentUnit());
}
protected abstract Unit makeBafInst(Type opType);
}
| 1,782
| 29.741379
| 107
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/AbstractJimpleIntBinopExpr.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.List;
import soot.Type;
import soot.Unit;
import soot.Value;
import soot.jimple.ConvertToBaf;
import soot.jimple.Jimple;
import soot.jimple.JimpleToBafContext;
@SuppressWarnings("serial")
public abstract class AbstractJimpleIntBinopExpr extends AbstractIntBinopExpr implements ConvertToBaf {
protected AbstractJimpleIntBinopExpr(Value op1, Value op2) {
super(Jimple.v().newArgBox(op1), Jimple.v().newArgBox(op2));
}
@Override
public void convertToBaf(JimpleToBafContext context, List<Unit> out) {
((ConvertToBaf) this.getOp1()).convertToBaf(context, out);
((ConvertToBaf) this.getOp2()).convertToBaf(context, out);
Unit u = makeBafInst(this.getOp1().getType());
out.add(u);
u.addAllTagsOf(context.getCurrentUnit());
}
protected abstract Unit makeBafInst(Type opType);
}
| 1,656
| 30.264151
| 103
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/AbstractJimpleIntLongBinopExpr.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.List;
import soot.Type;
import soot.Unit;
import soot.Value;
import soot.jimple.ConvertToBaf;
import soot.jimple.Jimple;
import soot.jimple.JimpleToBafContext;
@SuppressWarnings("serial")
public abstract class AbstractJimpleIntLongBinopExpr extends AbstractIntLongBinopExpr implements ConvertToBaf {
protected AbstractJimpleIntLongBinopExpr(Value op1, Value op2) {
super(Jimple.v().newArgBox(op1), Jimple.v().newArgBox(op2));
}
@Override
public void convertToBaf(JimpleToBafContext context, List<Unit> out) {
((ConvertToBaf) this.getOp1()).convertToBaf(context, out);
((ConvertToBaf) this.getOp2()).convertToBaf(context, out);
Unit u = makeBafInst(this.getOp1().getType());
out.add(u);
u.addAllTagsOf(context.getCurrentUnit());
}
protected abstract Unit makeBafInst(Type opType);
}
| 1,668
| 30.490566
| 111
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/AbstractLengthExpr.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import soot.IntType;
import soot.Type;
import soot.UnitPrinter;
import soot.ValueBox;
import soot.jimple.ExprSwitch;
import soot.jimple.Jimple;
import soot.jimple.LengthExpr;
import soot.util.Switch;
@SuppressWarnings("serial")
public abstract class AbstractLengthExpr extends AbstractUnopExpr implements LengthExpr {
protected AbstractLengthExpr(ValueBox opBox) {
super(opBox);
}
@Override
public boolean equivTo(Object o) {
if (o instanceof AbstractLengthExpr) {
return this.opBox.getValue().equivTo(((AbstractLengthExpr) o).opBox.getValue());
}
return false;
}
/** Returns a hash code for this object, consistent with structural equality. */
@Override
public int equivHashCode() {
return opBox.getValue().equivHashCode();
}
@Override
public String toString() {
return Jimple.LENGTHOF + " " + opBox.getValue().toString();
}
@Override
public void toString(UnitPrinter up) {
up.literal(Jimple.LENGTHOF + " ");
opBox.toString(up);
}
@Override
public Type getType() {
return IntType.v();
}
@Override
public void apply(Switch sw) {
((ExprSwitch) sw).caseLengthExpr(this);
}
}
| 1,996
| 25.276316
| 89
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/AbstractNegExpr.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import soot.BooleanType;
import soot.ByteType;
import soot.CharType;
import soot.DoubleType;
import soot.FloatType;
import soot.IntType;
import soot.LongType;
import soot.ShortType;
import soot.Type;
import soot.UnitPrinter;
import soot.UnknownType;
import soot.ValueBox;
import soot.jimple.ExprSwitch;
import soot.jimple.Jimple;
import soot.jimple.NegExpr;
import soot.util.Switch;
@SuppressWarnings("serial")
public abstract class AbstractNegExpr extends AbstractUnopExpr implements NegExpr {
protected AbstractNegExpr(ValueBox opBox) {
super(opBox);
}
/** Compares the specified object with this one for structural equality. */
@Override
public boolean equivTo(Object o) {
if (o instanceof AbstractNegExpr) {
return this.opBox.getValue().equivTo(((AbstractNegExpr) o).opBox.getValue());
}
return false;
}
/** Returns a hash code for this object, consistent with structural equality. */
@Override
public int equivHashCode() {
return opBox.getValue().equivHashCode();
}
@Override
public String toString() {
return Jimple.NEG + " " + opBox.getValue().toString();
}
@Override
public void toString(UnitPrinter up) {
up.literal(Jimple.NEG + " ");
opBox.toString(up);
}
@Override
public Type getType() {
final Type type = opBox.getValue().getType();
final IntType tyInt = IntType.v();
final ByteType tyByte = ByteType.v();
final ShortType tyShort = ShortType.v();
final CharType tyChar = CharType.v();
final BooleanType tyBool = BooleanType.v();
if (tyInt.equals(type) || tyByte.equals(type) || tyShort.equals(type) || tyChar.equals(type) || tyBool.equals(type)) {
return tyInt;
}
final LongType tyLong = LongType.v();
if (tyLong.equals(type)) {
return tyLong;
}
final DoubleType tyDouble = DoubleType.v();
if (tyDouble.equals(type)) {
return tyDouble;
}
final FloatType tyFloat = FloatType.v();
if (tyFloat.equals(type)) {
return tyFloat;
}
return UnknownType.v();
}
@Override
public void apply(Switch sw) {
((ExprSwitch) sw).caseNegExpr(this);
}
}
| 2,964
| 26.71028
| 122
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/AbstractNewArrayExpr.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.ArrayList;
import java.util.List;
import soot.ArrayType;
import soot.Type;
import soot.Unit;
import soot.UnitPrinter;
import soot.Value;
import soot.ValueBox;
import soot.baf.Baf;
import soot.jimple.ConvertToBaf;
import soot.jimple.ExprSwitch;
import soot.jimple.Jimple;
import soot.jimple.JimpleToBafContext;
import soot.jimple.NewArrayExpr;
import soot.util.Switch;
@SuppressWarnings("serial")
public abstract class AbstractNewArrayExpr implements NewArrayExpr, ConvertToBaf {
protected Type baseType;
protected final ValueBox sizeBox;
protected AbstractNewArrayExpr(Type type, ValueBox sizeBox) {
this.baseType = type;
this.sizeBox = sizeBox;
}
@Override
public abstract Object clone();
@Override
public boolean equivTo(Object o) {
if (o instanceof AbstractNewArrayExpr) {
AbstractNewArrayExpr ae = (AbstractNewArrayExpr) o;
return this.sizeBox.getValue().equivTo(ae.sizeBox.getValue()) && this.baseType.equals(ae.baseType);
}
return false;
}
/** Returns a hash code for this object, consistent with structural equality. */
@Override
public int equivHashCode() {
return sizeBox.getValue().equivHashCode() * 101 + baseType.hashCode() * 17;
}
@Override
public String toString() {
StringBuilder buf = new StringBuilder(Jimple.NEWARRAY + " (");
buf.append(getBaseTypeString()).append(")[").append(sizeBox.getValue().toString()).append(']');
return buf.toString();
}
@Override
public void toString(UnitPrinter up) {
up.literal(Jimple.NEWARRAY + " (");
up.type(baseType);
up.literal(")[");
sizeBox.toString(up);
up.literal("]");
}
private String getBaseTypeString() {
return baseType.toString();
}
@Override
public Type getBaseType() {
return baseType;
}
@Override
public void setBaseType(Type type) {
baseType = type;
}
@Override
public ValueBox getSizeBox() {
return sizeBox;
}
@Override
public Value getSize() {
return sizeBox.getValue();
}
@Override
public void setSize(Value size) {
sizeBox.setValue(size);
}
@Override
public final List<ValueBox> getUseBoxes() {
List<ValueBox> useBoxes = new ArrayList<ValueBox>(sizeBox.getValue().getUseBoxes());
useBoxes.add(sizeBox);
return useBoxes;
}
@Override
public Type getType() {
if (baseType instanceof ArrayType) {
ArrayType base = (ArrayType) baseType;
return ArrayType.v(base.baseType, base.numDimensions + 1);
} else {
return ArrayType.v(baseType, 1);
}
}
@Override
public void apply(Switch sw) {
((ExprSwitch) sw).caseNewArrayExpr(this);
}
@Override
public void convertToBaf(JimpleToBafContext context, List<Unit> out) {
((ConvertToBaf) getSize()).convertToBaf(context, out);
Unit u = Baf.v().newNewArrayInst(getBaseType());
out.add(u);
u.addAllTagsOf(context.getCurrentUnit());
}
}
| 3,749
| 24.510204
| 105
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/AbstractNewExpr.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.Collections;
import java.util.List;
import soot.RefType;
import soot.Type;
import soot.UnitPrinter;
import soot.ValueBox;
import soot.jimple.ExprSwitch;
import soot.jimple.Jimple;
import soot.jimple.NewExpr;
import soot.util.Switch;
@SuppressWarnings("serial")
public abstract class AbstractNewExpr implements NewExpr {
protected RefType type;
@Override
public abstract Object clone();
@Override
public boolean equivTo(Object o) {
if (o instanceof AbstractNewExpr) {
AbstractNewExpr ae = (AbstractNewExpr) o;
return type.equals(ae.type);
}
return false;
}
/** Returns a hash code for this object, consistent with structural equality. */
@Override
public int equivHashCode() {
return type.hashCode();
}
@Override
public String toString() {
return Jimple.NEW + " " + type.toString();
}
@Override
public void toString(UnitPrinter up) {
up.literal(Jimple.NEW + " ");
up.type(type);
}
@Override
public RefType getBaseType() {
return type;
}
@Override
public void setBaseType(RefType type) {
this.type = type;
}
@Override
public Type getType() {
return type;
}
@Override
public List<ValueBox> getUseBoxes() {
return Collections.emptyList();
}
@Override
public void apply(Switch sw) {
((ExprSwitch) sw).caseNewExpr(this);
}
}
| 2,198
| 21.90625
| 82
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/AbstractNewMultiArrayExpr.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import soot.ArrayType;
import soot.Type;
import soot.Unit;
import soot.UnitPrinter;
import soot.Value;
import soot.ValueBox;
import soot.baf.Baf;
import soot.jimple.ConvertToBaf;
import soot.jimple.ExprSwitch;
import soot.jimple.Jimple;
import soot.jimple.JimpleToBafContext;
import soot.jimple.NewMultiArrayExpr;
import soot.util.Switch;
@SuppressWarnings("serial")
public abstract class AbstractNewMultiArrayExpr implements NewMultiArrayExpr, ConvertToBaf {
protected ArrayType baseType;
protected final ValueBox[] sizeBoxes;
protected AbstractNewMultiArrayExpr(ArrayType type, ValueBox[] sizeBoxes) {
this.baseType = type;
this.sizeBoxes = sizeBoxes;
}
@Override
public abstract Object clone();
@Override
public boolean equivTo(Object o) {
if (o instanceof AbstractNewMultiArrayExpr) {
AbstractNewMultiArrayExpr ae = (AbstractNewMultiArrayExpr) o;
return baseType.equals(ae.baseType) && (this.sizeBoxes.length == ae.sizeBoxes.length);
}
return false;
}
/** Returns a hash code for this object, consistent with structural equality. */
@Override
public int equivHashCode() {
return baseType.hashCode();
}
@Override
public String toString() {
StringBuilder buf = new StringBuilder(Jimple.NEWMULTIARRAY + " (");
buf.append(baseType.baseType.toString()).append(')');
for (ValueBox element : sizeBoxes) {
buf.append('[').append(element.getValue().toString()).append(']');
}
for (int i = 0, e = baseType.numDimensions - sizeBoxes.length; i < e; i++) {
buf.append("[]");
}
return buf.toString();
}
@Override
public void toString(UnitPrinter up) {
up.literal(Jimple.NEWMULTIARRAY + " (");
up.type(baseType.baseType);
up.literal(")");
for (ValueBox element : sizeBoxes) {
up.literal("[");
element.toString(up);
up.literal("]");
}
for (int i = 0, e = baseType.numDimensions - sizeBoxes.length; i < e; i++) {
up.literal("[]");
}
}
@Override
public ArrayType getBaseType() {
return baseType;
}
@Override
public void setBaseType(ArrayType baseType) {
this.baseType = baseType;
}
@Override
public ValueBox getSizeBox(int index) {
return sizeBoxes[index];
}
@Override
public int getSizeCount() {
return sizeBoxes.length;
}
@Override
public Value getSize(int index) {
return sizeBoxes[index].getValue();
}
@Override
public List<Value> getSizes() {
final ValueBox[] boxes = sizeBoxes;
List<Value> toReturn = new ArrayList<Value>(boxes.length);
for (ValueBox element : boxes) {
toReturn.add(element.getValue());
}
return toReturn;
}
@Override
public void setSize(int index, Value size) {
sizeBoxes[index].setValue(size);
}
@Override
public final List<ValueBox> getUseBoxes() {
List<ValueBox> list = new ArrayList<ValueBox>();
Collections.addAll(list, sizeBoxes);
for (ValueBox element : sizeBoxes) {
list.addAll(element.getValue().getUseBoxes());
}
return list;
}
@Override
public Type getType() {
return baseType;
}
@Override
public void apply(Switch sw) {
((ExprSwitch) sw).caseNewMultiArrayExpr(this);
}
@Override
public void convertToBaf(JimpleToBafContext context, List<Unit> out) {
final List<Value> sizes = getSizes();
for (Value s : sizes) {
((ConvertToBaf) s).convertToBaf(context, out);
}
Unit u = Baf.v().newNewMultiArrayInst(getBaseType(), sizes.size());
out.add(u);
u.addAllTagsOf(context.getCurrentUnit());
}
}
| 4,487
| 24.645714
| 92
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/AbstractOpStmt.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1997 - 2018 Raja Vallée-Rai and others
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.ArrayList;
import java.util.List;
import soot.Value;
import soot.ValueBox;
@SuppressWarnings("serial")
public abstract class AbstractOpStmt extends AbstractStmt {
protected final ValueBox opBox;
protected AbstractOpStmt(ValueBox opBox) {
this.opBox = opBox;
}
final public Value getOp() {
return opBox.getValue();
}
final public void setOp(Value op) {
opBox.setValue(op);
}
final public ValueBox getOpBox() {
return opBox;
}
@Override
final public List<ValueBox> getUseBoxes() {
List<ValueBox> list = new ArrayList<ValueBox>(opBox.getValue().getUseBoxes());
list.add(opBox);
return list;
}
}
| 1,518
| 24.745763
| 82
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/AbstractSpecialInvokeExpr.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* Copyright (C) 2004 Ondrej Lhotak
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.List;
import soot.SootMethodRef;
import soot.Unit;
import soot.UnitPrinter;
import soot.ValueBox;
import soot.baf.Baf;
import soot.jimple.ConvertToBaf;
import soot.jimple.ExprSwitch;
import soot.jimple.Jimple;
import soot.jimple.JimpleToBafContext;
import soot.jimple.SpecialInvokeExpr;
import soot.util.Switch;
@SuppressWarnings("serial")
public abstract class AbstractSpecialInvokeExpr extends AbstractInstanceInvokeExpr
implements SpecialInvokeExpr, ConvertToBaf {
protected AbstractSpecialInvokeExpr(ValueBox baseBox, SootMethodRef methodRef, ValueBox[] argBoxes) {
super(methodRef, baseBox, argBoxes);
if (methodRef.isStatic()) {
throw new RuntimeException("wrong static-ness");
}
}
@Override
public boolean equivTo(Object o) {
if (o instanceof AbstractSpecialInvokeExpr) {
AbstractSpecialInvokeExpr ie = (AbstractSpecialInvokeExpr) o;
if ((this.argBoxes == null ? 0 : this.argBoxes.length) != (ie.argBoxes == null ? 0 : ie.argBoxes.length)
|| !this.getMethod().equals(ie.getMethod()) || !this.baseBox.getValue().equivTo(ie.baseBox.getValue())) {
return false;
}
if (this.argBoxes != null) {
for (int i = 0, e = this.argBoxes.length; i < e; i++) {
if (!this.argBoxes[i].getValue().equivTo(ie.argBoxes[i].getValue())) {
return false;
}
}
}
return true;
}
return false;
}
/**
* Returns a hash code for this object, consistent with structural equality.
*/
@Override
public int equivHashCode() {
return baseBox.getValue().equivHashCode() * 101 + getMethod().equivHashCode() * 17;
}
@Override
public String toString() {
StringBuilder buf = new StringBuilder(Jimple.SPECIALINVOKE + " ");
buf.append(baseBox.getValue().toString()).append('.').append(methodRef.getSignature()).append('(');
if (argBoxes != null) {
for (int i = 0, e = argBoxes.length; i < e; i++) {
if (i != 0) {
buf.append(", ");
}
buf.append(argBoxes[i].getValue().toString());
}
}
buf.append(')');
return buf.toString();
}
@Override
public void toString(UnitPrinter up) {
up.literal(Jimple.SPECIALINVOKE + " ");
baseBox.toString(up);
up.literal(".");
up.methodRef(methodRef);
up.literal("(");
if (argBoxes != null) {
for (int i = 0, e = argBoxes.length; i < e; i++) {
if (i != 0) {
up.literal(", ");
}
argBoxes[i].toString(up);
}
}
up.literal(")");
}
@Override
public void apply(Switch sw) {
((ExprSwitch) sw).caseSpecialInvokeExpr(this);
}
@Override
public void convertToBaf(JimpleToBafContext context, List<Unit> out) {
((ConvertToBaf) (getBase())).convertToBaf(context, out);
if (argBoxes != null) {
for (ValueBox element : argBoxes) {
((ConvertToBaf) (element.getValue())).convertToBaf(context, out);
}
}
Unit u = Baf.v().newSpecialInvokeInst(methodRef);
out.add(u);
u.addAllTagsOf(context.getCurrentUnit());
}
}
| 3,960
| 28.340741
| 115
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/AbstractStaticInvokeExpr.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* Copyright (C) 2004 Ondrej Lhotak
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.List;
import java.util.ListIterator;
import soot.SootMethodRef;
import soot.Unit;
import soot.UnitPrinter;
import soot.Value;
import soot.ValueBox;
import soot.baf.Baf;
import soot.jimple.ConvertToBaf;
import soot.jimple.ExprSwitch;
import soot.jimple.Jimple;
import soot.jimple.JimpleToBafContext;
import soot.jimple.StaticInvokeExpr;
import soot.util.Switch;
@SuppressWarnings("serial")
public abstract class AbstractStaticInvokeExpr extends AbstractInvokeExpr implements StaticInvokeExpr, ConvertToBaf {
AbstractStaticInvokeExpr(SootMethodRef methodRef, List<Value> args) {
this(methodRef, new ValueBox[args.size()]);
final Jimple jimp = Jimple.v();
for (ListIterator<Value> it = args.listIterator(); it.hasNext();) {
Value v = it.next();
this.argBoxes[it.previousIndex()] = jimp.newImmediateBox(v);
}
}
protected AbstractStaticInvokeExpr(SootMethodRef methodRef, ValueBox[] argBoxes) {
super(methodRef, argBoxes);
if (!methodRef.isStatic()) {
throw new RuntimeException("wrong static-ness");
}
}
@Override
public boolean equivTo(Object o) {
if (o instanceof AbstractStaticInvokeExpr) {
AbstractStaticInvokeExpr ie = (AbstractStaticInvokeExpr) o;
if ((this.argBoxes == null ? 0 : this.argBoxes.length) != (ie.argBoxes == null ? 0 : ie.argBoxes.length)
|| !this.getMethod().equals(ie.getMethod())) {
return false;
}
if (this.argBoxes != null) {
for (int i = 0, e = this.argBoxes.length; i < e; i++) {
if (!this.argBoxes[i].getValue().equivTo(ie.argBoxes[i].getValue())) {
return false;
}
}
}
return true;
}
return false;
}
/**
* Returns a hash code for this object, consistent with structural equality.
*/
@Override
public int equivHashCode() {
return getMethod().equivHashCode();
}
@Override
public String toString() {
StringBuilder buf = new StringBuilder(Jimple.STATICINVOKE + " ");
buf.append(methodRef.getSignature()).append('(');
if (argBoxes != null) {
for (int i = 0, e = argBoxes.length; i < e; i++) {
if (i != 0) {
buf.append(", ");
}
buf.append(argBoxes[i].getValue().toString());
}
}
buf.append(')');
return buf.toString();
}
@Override
public void toString(UnitPrinter up) {
up.literal(Jimple.STATICINVOKE + " ");
up.methodRef(methodRef);
up.literal("(");
if (argBoxes != null) {
for (int i = 0, e = argBoxes.length; i < e; i++) {
if (i != 0) {
up.literal(", ");
}
argBoxes[i].toString(up);
}
}
up.literal(")");
}
@Override
public void apply(Switch sw) {
((ExprSwitch) sw).caseStaticInvokeExpr(this);
}
@Override
public void convertToBaf(JimpleToBafContext context, List<Unit> out) {
if (argBoxes != null) {
for (ValueBox element : argBoxes) {
((ConvertToBaf) (element.getValue())).convertToBaf(context, out);
}
}
Unit u = Baf.v().newStaticInvokeInst(methodRef);
out.add(u);
u.addAllTagsOf(context.getCurrentUnit());
}
}
| 4,029
| 27.380282
| 117
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/AbstractStmt.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.List;
import soot.AbstractUnit;
import soot.Unit;
import soot.ValueBox;
import soot.baf.Baf;
import soot.jimple.ArrayRef;
import soot.jimple.ConvertToBaf;
import soot.jimple.FieldRef;
import soot.jimple.InvokeExpr;
import soot.jimple.JimpleToBafContext;
import soot.jimple.Stmt;
@SuppressWarnings("serial")
public abstract class AbstractStmt extends AbstractUnit implements Stmt, ConvertToBaf {
@Override
public void convertToBaf(JimpleToBafContext context, List<Unit> out) {
Unit u = Baf.v().newNopInst();
out.add(u);
u.addAllTagsOf(this);
}
@Override
public boolean containsInvokeExpr() {
return false;
}
@Override
public InvokeExpr getInvokeExpr() {
throw new RuntimeException("getInvokeExpr() called with no invokeExpr present!");
}
@Override
public ValueBox getInvokeExprBox() {
throw new RuntimeException("getInvokeExprBox() called with no invokeExpr present!");
}
@Override
public boolean containsArrayRef() {
return false;
}
@Override
public ArrayRef getArrayRef() {
throw new RuntimeException("getArrayRef() called with no ArrayRef present!");
}
@Override
public ValueBox getArrayRefBox() {
throw new RuntimeException("getArrayRefBox() called with no ArrayRef present!");
}
@Override
public boolean containsFieldRef() {
return false;
}
@Override
public FieldRef getFieldRef() {
throw new RuntimeException("getFieldRef() called with no FieldRef present!");
}
@Override
public ValueBox getFieldRefBox() {
throw new RuntimeException("getFieldRefBox() called with no FieldRef present!");
}
}
| 2,461
| 25.473118
| 88
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/AbstractSwitchStmt.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1997 - 2018 Raja Vallée-Rai and others
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.ListIterator;
import java.util.function.Function;
import soot.Unit;
import soot.UnitBox;
import soot.Value;
import soot.ValueBox;
import soot.jimple.SwitchStmt;
@SuppressWarnings("serial")
public abstract class AbstractSwitchStmt extends AbstractStmt implements SwitchStmt {
protected final ValueBox keyBox;
protected final UnitBox defaultTargetBox;
protected final UnitBox[] targetBoxes;
protected final List<UnitBox> stmtBoxes;
protected AbstractSwitchStmt(ValueBox keyBox, UnitBox defaultTargetBox, UnitBox... targetBoxes) {
this.keyBox = keyBox;
this.defaultTargetBox = defaultTargetBox;
this.targetBoxes = targetBoxes;
// Build up stmtBoxes
List<UnitBox> list = new ArrayList<UnitBox>();
Collections.addAll(list, targetBoxes);
list.add(defaultTargetBox);
this.stmtBoxes = Collections.unmodifiableList(list);
}
// This method is necessary to deal with constructor-must-be-first-ism.
protected static UnitBox[] getTargetBoxesArray(List<? extends Unit> targets, Function<Unit, UnitBox> stmtBoxWrap) {
UnitBox[] targetBoxes = new UnitBox[targets.size()];
for (ListIterator<? extends Unit> it = targets.listIterator(); it.hasNext();) {
Unit u = it.next();
targetBoxes[it.previousIndex()] = stmtBoxWrap.apply(u);
}
return targetBoxes;
}
@Override
final public Unit getDefaultTarget() {
return defaultTargetBox.getUnit();
}
@Override
final public void setDefaultTarget(Unit defaultTarget) {
defaultTargetBox.setUnit(defaultTarget);
}
@Override
final public UnitBox getDefaultTargetBox() {
return defaultTargetBox;
}
@Override
final public Value getKey() {
return keyBox.getValue();
}
@Override
final public void setKey(Value key) {
keyBox.setValue(key);
}
@Override
final public ValueBox getKeyBox() {
return keyBox;
}
@Override
final public List<ValueBox> getUseBoxes() {
List<ValueBox> list = new ArrayList<ValueBox>(keyBox.getValue().getUseBoxes());
list.add(keyBox);
return list;
}
final public int getTargetCount() {
return targetBoxes.length;
}
@Override
final public Unit getTarget(int index) {
return targetBoxes[index].getUnit();
}
@Override
final public UnitBox getTargetBox(int index) {
return targetBoxes[index];
}
@Override
final public void setTarget(int index, Unit target) {
targetBoxes[index].setUnit(target);
}
@Override
final public List<Unit> getTargets() {
final UnitBox[] boxes = this.targetBoxes;
List<Unit> targets = new ArrayList<Unit>(boxes.length);
for (UnitBox element : boxes) {
targets.add(element.getUnit());
}
return targets;
}
final public void setTargets(List<? extends Unit> targets) {
for (ListIterator<? extends Unit> it = targets.listIterator(); it.hasNext();) {
Unit u = it.next();
targetBoxes[it.previousIndex()].setUnit(u);
}
}
final public void setTargets(Unit[] targets) {
for (int i = 0, e = targets.length; i < e; i++) {
targetBoxes[i].setUnit(targets[i]);
}
}
@Override
final public List<UnitBox> getUnitBoxes() {
return stmtBoxes;
}
@Override
public final boolean fallsThrough() {
return false;
}
@Override
public final boolean branches() {
return true;
}
}
| 4,271
| 25.534161
| 117
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/AbstractUnopExpr.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.ArrayList;
import java.util.List;
import soot.Value;
import soot.ValueBox;
import soot.jimple.UnopExpr;
@SuppressWarnings("serial")
public abstract class AbstractUnopExpr implements UnopExpr {
protected final ValueBox opBox;
protected AbstractUnopExpr(ValueBox opBox) {
this.opBox = opBox;
}
@Override
public abstract Object clone();
@Override
public Value getOp() {
return opBox.getValue();
}
@Override
public void setOp(Value op) {
opBox.setValue(op);
}
@Override
public ValueBox getOpBox() {
return opBox;
}
@Override
public final List<ValueBox> getUseBoxes() {
List<ValueBox> list = new ArrayList<ValueBox>(opBox.getValue().getUseBoxes());
list.add(opBox);
return list;
}
}
| 1,593
| 23.151515
| 82
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/AbstractVirtualInvokeExpr.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* Copyright (C) 2004 Ondrej Lhotak
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.List;
import soot.SootMethodRef;
import soot.Unit;
import soot.UnitPrinter;
import soot.ValueBox;
import soot.baf.Baf;
import soot.jimple.ConvertToBaf;
import soot.jimple.ExprSwitch;
import soot.jimple.Jimple;
import soot.jimple.JimpleToBafContext;
import soot.jimple.VirtualInvokeExpr;
import soot.util.Switch;
@SuppressWarnings("serial")
public abstract class AbstractVirtualInvokeExpr extends AbstractInstanceInvokeExpr
implements VirtualInvokeExpr, ConvertToBaf {
protected AbstractVirtualInvokeExpr(ValueBox baseBox, SootMethodRef methodRef, ValueBox[] argBoxes) {
super(methodRef, baseBox, argBoxes);
if (methodRef.isStatic()) {
throw new RuntimeException("wrong static-ness");
}
}
@Override
public boolean equivTo(Object o) {
if (o instanceof AbstractVirtualInvokeExpr) {
AbstractVirtualInvokeExpr ie = (AbstractVirtualInvokeExpr) o;
if ((this.argBoxes == null ? 0 : this.argBoxes.length) != (ie.argBoxes == null ? 0 : ie.argBoxes.length)
|| !this.getMethod().equals(ie.getMethod()) || !this.baseBox.getValue().equivTo(ie.baseBox.getValue())) {
return false;
}
if (this.argBoxes != null) {
for (int i = 0, e = this.argBoxes.length; i < e; i++) {
if (!this.argBoxes[i].getValue().equivTo(ie.argBoxes[i].getValue())) {
return false;
}
}
}
return true;
}
return false;
}
/**
* Returns a hash code for this object, consistent with structural equality.
*/
@Override
public int equivHashCode() {
return baseBox.getValue().equivHashCode() * 101 + getMethod().equivHashCode() * 17;
}
@Override
public void apply(Switch sw) {
((ExprSwitch) sw).caseVirtualInvokeExpr(this);
}
@Override
public String toString() {
StringBuilder buf = new StringBuilder(Jimple.VIRTUALINVOKE + " ");
buf.append(baseBox.getValue().toString()).append('.').append(methodRef.getSignature()).append('(');
if (argBoxes != null) {
for (int i = 0, e = argBoxes.length; i < e; i++) {
if (i != 0) {
buf.append(", ");
}
buf.append(argBoxes[i].getValue().toString());
}
}
buf.append(')');
return buf.toString();
}
@Override
public void toString(UnitPrinter up) {
up.literal(Jimple.VIRTUALINVOKE + " ");
baseBox.toString(up);
up.literal(".");
up.methodRef(methodRef);
up.literal("(");
if (argBoxes != null) {
for (int i = 0, e = argBoxes.length; i < e; i++) {
if (i != 0) {
up.literal(", ");
}
argBoxes[i].toString(up);
}
}
up.literal(")");
}
@Override
public void convertToBaf(JimpleToBafContext context, List<Unit> out) {
((ConvertToBaf) (getBase())).convertToBaf(context, out);
if (argBoxes != null) {
for (ValueBox element : argBoxes) {
((ConvertToBaf) (element.getValue())).convertToBaf(context, out);
}
}
Unit u = Baf.v().newVirtualInvokeInst(methodRef);
out.add(u);
u.addAllTagsOf(context.getCurrentUnit());
}
}
| 3,960
| 28.340741
| 115
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/ConditionExprBox.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import soot.AbstractValueBox;
import soot.Value;
import soot.jimple.ConditionExpr;
public class ConditionExprBox extends AbstractValueBox {
public ConditionExprBox(Value value) {
setValue(value);
}
@Override
public boolean canContainValue(Value value) {
return value instanceof ConditionExpr;
}
}
| 1,145
| 27.65
| 71
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/IdentityRefBox.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import soot.AbstractValueBox;
import soot.Value;
import soot.jimple.IdentityRef;
public class IdentityRefBox extends AbstractValueBox {
public IdentityRefBox(Value value) {
setValue(value);
}
@Override
public boolean canContainValue(Value value) {
return value instanceof IdentityRef;
}
}
| 1,137
| 27.45
| 71
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/ImmediateBox.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import soot.AbstractValueBox;
import soot.Immediate;
import soot.Value;
public class ImmediateBox extends AbstractValueBox {
public ImmediateBox(Value value) {
setValue(value);
}
@Override
public boolean canContainValue(Value value) {
return value instanceof Immediate;
}
}
| 1,122
| 27.075
| 71
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/InvokeExprBox.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import soot.AbstractValueBox;
import soot.Value;
import soot.jimple.InvokeExpr;
public class InvokeExprBox extends AbstractValueBox {
public InvokeExprBox(Value value) {
setValue(value);
}
@Override
public boolean canContainValue(Value value) {
return value instanceof InvokeExpr;
}
}
| 1,133
| 27.35
| 71
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/JAddExpr.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import soot.Type;
import soot.Unit;
import soot.Value;
import soot.baf.Baf;
import soot.jimple.AddExpr;
import soot.jimple.ExprSwitch;
import soot.jimple.Jimple;
import soot.util.Switch;
public class JAddExpr extends AbstractJimpleFloatBinopExpr implements AddExpr {
public JAddExpr(Value op1, Value op2) {
super(op1, op2);
}
@Override
public final String getSymbol() {
return " + ";
}
@Override
public void apply(Switch sw) {
((ExprSwitch) sw).caseAddExpr(this);
}
@Override
protected Unit makeBafInst(Type opType) {
return Baf.v().newAddInst(this.getOp1().getType());
}
@Override
public Object clone() {
return new JAddExpr(Jimple.cloneIfNecessary(getOp1()), Jimple.cloneIfNecessary(getOp2()));
}
}
| 1,582
| 25.383333
| 94
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/JAndExpr.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import soot.Type;
import soot.Unit;
import soot.Value;
import soot.baf.Baf;
import soot.jimple.AndExpr;
import soot.jimple.ExprSwitch;
import soot.jimple.Jimple;
import soot.util.Switch;
public class JAndExpr extends AbstractJimpleIntLongBinopExpr implements AndExpr {
public JAndExpr(Value op1, Value op2) {
super(op1, op2);
}
@Override
public final String getSymbol() {
return " & ";
}
@Override
public void apply(Switch sw) {
((ExprSwitch) sw).caseAndExpr(this);
}
@Override
protected Unit makeBafInst(Type opType) {
return Baf.v().newAndInst(this.getOp1().getType());
}
@Override
public Object clone() {
return new JAndExpr(Jimple.cloneIfNecessary(getOp1()), Jimple.cloneIfNecessary(getOp2()));
}
}
| 1,584
| 25.416667
| 94
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/JArrayRef.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.ArrayList;
import java.util.List;
import soot.ArrayType;
import soot.Local;
import soot.NullType;
import soot.Type;
import soot.Unit;
import soot.UnitPrinter;
import soot.UnknownType;
import soot.Value;
import soot.ValueBox;
import soot.baf.Baf;
import soot.jimple.ArrayRef;
import soot.jimple.ConvertToBaf;
import soot.jimple.Jimple;
import soot.jimple.JimpleToBafContext;
import soot.jimple.RefSwitch;
import soot.tagkit.Tag;
import soot.util.Switch;
public class JArrayRef implements ArrayRef, ConvertToBaf {
protected final ValueBox baseBox;
protected final ValueBox indexBox;
public JArrayRef(Value base, Value index) {
this(Jimple.v().newLocalBox(base), Jimple.v().newImmediateBox(index));
}
protected JArrayRef(ValueBox baseBox, ValueBox indexBox) {
this.baseBox = baseBox;
this.indexBox = indexBox;
}
@Override
public Object clone() {
return new JArrayRef(Jimple.cloneIfNecessary(getBase()), Jimple.cloneIfNecessary(getIndex()));
}
@Override
public boolean equivTo(Object o) {
if (o instanceof ArrayRef) {
ArrayRef oArrayRef = (ArrayRef) o;
return this.getBase().equivTo(oArrayRef.getBase()) && this.getIndex().equivTo(oArrayRef.getIndex());
}
return false;
}
/** Returns a hash code for this object, consistent with structural equality. */
@Override
public int equivHashCode() {
return getBase().equivHashCode() * 101 + getIndex().equivHashCode() + 17;
}
@Override
public String toString() {
return baseBox.getValue().toString() + "[" + indexBox.getValue().toString() + "]";
}
@Override
public void toString(UnitPrinter up) {
baseBox.toString(up);
up.literal("[");
indexBox.toString(up);
up.literal("]");
}
@Override
public Value getBase() {
return baseBox.getValue();
}
@Override
public void setBase(Local base) {
baseBox.setValue(base);
}
@Override
public ValueBox getBaseBox() {
return baseBox;
}
@Override
public Value getIndex() {
return indexBox.getValue();
}
@Override
public void setIndex(Value index) {
indexBox.setValue(index);
}
@Override
public ValueBox getIndexBox() {
return indexBox;
}
@Override
public List<ValueBox> getUseBoxes() {
List<ValueBox> useBoxes = new ArrayList<ValueBox>();
useBoxes.addAll(baseBox.getValue().getUseBoxes());
useBoxes.add(baseBox);
useBoxes.addAll(indexBox.getValue().getUseBoxes());
useBoxes.add(indexBox);
return useBoxes;
}
@Override
public Type getType() {
Type type = baseBox.getValue().getType();
if (UnknownType.v().equals(type)) {
return UnknownType.v();
} else if (NullType.v().equals(type)) {
return NullType.v();
} else {
// use makeArrayType on non-array type references when they propagate to this point.
// kludge, most likely not correct.
// may stop spark from complaining when it gets passed phantoms.
// ideally I'd want to find out just how they manage to get this far.
ArrayType arrayType = (type instanceof ArrayType) ? (ArrayType) type : (ArrayType) type.makeArrayType();
if (arrayType.numDimensions == 1) {
return arrayType.baseType;
} else {
return ArrayType.v(arrayType.baseType, arrayType.numDimensions - 1);
}
}
}
@Override
public void apply(Switch sw) {
((RefSwitch) sw).caseArrayRef(this);
}
@Override
public void convertToBaf(JimpleToBafContext context, List<Unit> out) {
((ConvertToBaf) getBase()).convertToBaf(context, out);
((ConvertToBaf) getIndex()).convertToBaf(context, out);
Unit x = Baf.v().newArrayReadInst(getType());
out.add(x);
for (Tag next : context.getCurrentUnit().getTags()) {
x.addTag(next);
}
}
}
| 4,615
| 25.377143
| 110
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/JAssignStmt.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.List;
import soot.Immediate;
import soot.IntType;
import soot.Local;
import soot.Unit;
import soot.UnitBox;
import soot.UnitBoxOwner;
import soot.UnitPrinter;
import soot.Value;
import soot.ValueBox;
import soot.baf.Baf;
import soot.jimple.AbstractJimpleValueSwitch;
import soot.jimple.AddExpr;
import soot.jimple.ArrayRef;
import soot.jimple.AssignStmt;
import soot.jimple.BinopExpr;
import soot.jimple.ConvertToBaf;
import soot.jimple.FieldRef;
import soot.jimple.InstanceFieldRef;
import soot.jimple.IntConstant;
import soot.jimple.InvokeExpr;
import soot.jimple.Jimple;
import soot.jimple.JimpleToBafContext;
import soot.jimple.StaticFieldRef;
import soot.jimple.StmtSwitch;
import soot.jimple.SubExpr;
import soot.util.Switch;
public class JAssignStmt extends AbstractDefinitionStmt implements AssignStmt {
@SuppressWarnings("serial")
public static class LinkedVariableBox extends VariableBox {
ValueBox otherBox = null;
public LinkedVariableBox(Value v) {
super(v);
}
public void setOtherBox(ValueBox otherBox) {
this.otherBox = otherBox;
}
@Override
public boolean canContainValue(Value v) {
if (super.canContainValue(v)) {
return (otherBox == null) || (v instanceof Immediate) || (otherBox.getValue() instanceof Immediate);
}
return false;
}
}
@SuppressWarnings("serial")
public static class LinkedRValueBox extends RValueBox {
ValueBox otherBox = null;
public LinkedRValueBox(Value v) {
super(v);
}
public void setOtherBox(ValueBox otherBox) {
this.otherBox = otherBox;
}
@Override
public boolean canContainValue(Value v) {
if (super.canContainValue(v)) {
return (otherBox == null) || (v instanceof Immediate) || (otherBox.getValue() instanceof Immediate);
}
return false;
}
}
public JAssignStmt(Value variable, Value rvalue) {
this(new LinkedVariableBox(variable), new LinkedRValueBox(rvalue));
((LinkedVariableBox) leftBox).setOtherBox(rightBox);
((LinkedRValueBox) rightBox).setOtherBox(leftBox);
if (!leftBox.canContainValue(variable) || !rightBox.canContainValue(rvalue)) {
throw new RuntimeException(
"Illegal assignment statement. Make sure that either left side or right hand side has a local or constant.");
}
}
protected JAssignStmt(ValueBox variableBox, ValueBox rvalueBox) {
super(variableBox, rvalueBox);
if (leftBox instanceof LinkedVariableBox) {
((LinkedVariableBox) leftBox).setOtherBox(rightBox);
}
if (rightBox instanceof LinkedRValueBox) {
((LinkedRValueBox) rightBox).setOtherBox(leftBox);
}
}
@Override
public boolean containsInvokeExpr() {
return getRightOp() instanceof InvokeExpr;
}
@Override
public InvokeExpr getInvokeExpr() {
return (InvokeExpr) getInvokeExprBox().getValue();
}
@Override
public ValueBox getInvokeExprBox() {
if (!containsInvokeExpr()) {
throw new RuntimeException("getInvokeExprBox() called with no invokeExpr present!");
}
return rightBox;
}
/* added by Feng */
@Override
public boolean containsArrayRef() {
return ((getLeftOp() instanceof ArrayRef) || (getRightOp() instanceof ArrayRef));
}
@Override
public ArrayRef getArrayRef() {
return (ArrayRef) getArrayRefBox().getValue();
}
@Override
public ValueBox getArrayRefBox() {
if (!containsArrayRef()) {
throw new RuntimeException("getArrayRefBox() called with no ArrayRef present!");
}
return (leftBox.getValue() instanceof ArrayRef) ? leftBox : rightBox;
}
@Override
public boolean containsFieldRef() {
return ((getLeftOp() instanceof FieldRef) || (getRightOp() instanceof FieldRef));
}
@Override
public FieldRef getFieldRef() {
return (FieldRef) getFieldRefBox().getValue();
}
@Override
public ValueBox getFieldRefBox() {
if (!containsFieldRef()) {
throw new RuntimeException("getFieldRefBox() called with no FieldRef present!");
}
return (leftBox.getValue() instanceof FieldRef) ? leftBox : rightBox;
}
@Override
public List<UnitBox> getUnitBoxes() {
// handle possible PhiExpr's
Value rValue = rightBox.getValue();
if (rValue instanceof UnitBoxOwner) {
return ((UnitBoxOwner) rValue).getUnitBoxes();
} else {
return super.getUnitBoxes();
}
}
@Override
public String toString() {
return leftBox.getValue().toString() + " = " + rightBox.getValue().toString();
}
@Override
public void toString(UnitPrinter up) {
leftBox.toString(up);
up.literal(" = ");
rightBox.toString(up);
}
@Override
public Object clone() {
return new JAssignStmt(Jimple.cloneIfNecessary(getLeftOp()), Jimple.cloneIfNecessary(getRightOp()));
}
@Override
public void setLeftOp(Value variable) {
getLeftOpBox().setValue(variable);
}
@Override
public void setRightOp(Value rvalue) {
getRightOpBox().setValue(rvalue);
}
@Override
public void apply(Switch sw) {
((StmtSwitch) sw).caseAssignStmt(this);
}
@Override
public void convertToBaf(final JimpleToBafContext context, final List<Unit> out) {
final Value lvalue = this.getLeftOp();
final Value rvalue = this.getRightOp();
// Handle simple subcase where you can use the efficient iinc bytecode
if (lvalue instanceof Local && (rvalue instanceof AddExpr || rvalue instanceof SubExpr)) {
Local l = (Local) lvalue;
BinopExpr expr = (BinopExpr) rvalue;
Value op1 = expr.getOp1();
Value op2 = expr.getOp2();
if (IntType.v().equals(l.getType())) {
boolean isValidCase = false;
int x = 0;
if (op1 == l && op2 instanceof IntConstant) {
x = ((IntConstant) op2).value;
isValidCase = true;
} else if (expr instanceof AddExpr && op2 == l && op1 instanceof IntConstant) {
// Note expr can't be a SubExpr because that would be x = 3 - x
x = ((IntConstant) op1).value;
isValidCase = true;
}
if (isValidCase && x >= Short.MIN_VALUE && x <= Short.MAX_VALUE) {
final Baf baf = Baf.v();
Unit u = baf.newIncInst(context.getBafLocalOfJimpleLocal(l), IntConstant.v((expr instanceof AddExpr) ? x : -x));
u.addAllTagsOf(this);
out.add(u);
return;
}
}
}
context.setCurrentUnit(this);
lvalue.apply(new AbstractJimpleValueSwitch() {
@Override
public void caseArrayRef(ArrayRef v) {
((ConvertToBaf) (v.getBase())).convertToBaf(context, out);
((ConvertToBaf) (v.getIndex())).convertToBaf(context, out);
((ConvertToBaf) rvalue).convertToBaf(context, out);
Unit u = Baf.v().newArrayWriteInst(v.getType());
u.addAllTagsOf(JAssignStmt.this);
out.add(u);
}
@Override
public void caseInstanceFieldRef(InstanceFieldRef v) {
((ConvertToBaf) (v.getBase())).convertToBaf(context, out);
((ConvertToBaf) rvalue).convertToBaf(context, out);
Unit u = Baf.v().newFieldPutInst(v.getFieldRef());
u.addAllTagsOf(JAssignStmt.this);
out.add(u);
}
@Override
public void caseLocal(final Local v) {
((ConvertToBaf) rvalue).convertToBaf(context, out);
/*
* Add the tags to the statement that COMPUTES the value, NOT to the statement that stores it.
*/
/*
* No: the convertToBaf on the rvalue already adds them, so no need to add them here. However, with the current
* semantics, we should add them to every statement and let the aggregator sort them out.
*/
Unit u = Baf.v().newStoreInst(v.getType(), context.getBafLocalOfJimpleLocal(v));
u.addAllTagsOf(JAssignStmt.this);
out.add(u);
}
@Override
public void caseStaticFieldRef(StaticFieldRef v) {
((ConvertToBaf) rvalue).convertToBaf(context, out);
Unit u = Baf.v().newStaticPutInst(v.getFieldRef());
u.addAllTagsOf(JAssignStmt.this);
out.add(u);
}
});
}
}
| 8,956
| 28.175896
| 122
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/JBreakpointStmt.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import soot.UnitPrinter;
import soot.jimple.BreakpointStmt;
import soot.jimple.Jimple;
import soot.jimple.StmtSwitch;
import soot.util.Switch;
public class JBreakpointStmt extends AbstractStmt implements BreakpointStmt {
public JBreakpointStmt() {
}
@Override
public String toString() {
return Jimple.BREAKPOINT;
}
@Override
public void toString(UnitPrinter up) {
up.literal(Jimple.BREAKPOINT);
}
@Override
public void apply(Switch sw) {
((StmtSwitch) sw).caseBreakpointStmt(this);
}
@Override
public Object clone() {
return new JBreakpointStmt();
}
@Override
public boolean fallsThrough() {
return true;
}
@Override
public boolean branches() {
return false;
}
}
| 1,562
| 22.681818
| 77
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/JCastExpr.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import soot.Type;
import soot.Value;
import soot.ValueBox;
import soot.jimple.Jimple;
public class JCastExpr extends AbstractCastExpr {
public JCastExpr(Value op, Type type) {
super(Jimple.v().newImmediateBox(op), type);
}
public JCastExpr(ValueBox op, Type type) {
super(op, type);
}
@Override
public Object clone() {
return new JCastExpr(Jimple.cloneIfNecessary(getOp()), type);
}
}
| 1,242
| 26.622222
| 71
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/JCaughtExceptionRef.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.Collections;
import java.util.List;
import soot.RefType;
import soot.Type;
import soot.UnitPrinter;
import soot.ValueBox;
import soot.jimple.CaughtExceptionRef;
import soot.jimple.RefSwitch;
import soot.util.Switch;
public class JCaughtExceptionRef implements CaughtExceptionRef {
public JCaughtExceptionRef() {
}
@Override
public boolean equivTo(Object c) {
return c instanceof CaughtExceptionRef;
}
/** Returns a hash code for this object, consistent with structural equality. */
@Override
public int equivHashCode() {
return 1729;
}
@Override
public Object clone() {
return new JCaughtExceptionRef();
}
@Override
public String toString() {
return "@caughtexception";
}
@Override
public void toString(UnitPrinter up) {
up.identityRef(this);
}
@Override
public final List<ValueBox> getUseBoxes() {
return Collections.emptyList();
}
@Override
public Type getType() {
return RefType.v("java.lang.Throwable");
}
@Override
public void apply(Switch sw) {
((RefSwitch) sw).caseCaughtExceptionRef(this);
}
}
| 1,943
| 22.707317
| 82
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/JCmpExpr.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import soot.Type;
import soot.Unit;
import soot.Value;
import soot.baf.Baf;
import soot.jimple.CmpExpr;
import soot.jimple.ExprSwitch;
import soot.jimple.Jimple;
import soot.util.Switch;
public class JCmpExpr extends AbstractJimpleIntBinopExpr implements CmpExpr {
public JCmpExpr(Value op1, Value op2) {
super(op1, op2);
}
@Override
public final String getSymbol() {
return " " + Jimple.CMP + " ";
}
@Override
public void apply(Switch sw) {
((ExprSwitch) sw).caseCmpExpr(this);
}
@Override
protected Unit makeBafInst(Type opType) {
return Baf.v().newCmpInst(this.getOp1().getType());
}
@Override
public Object clone() {
return new JCmpExpr(Jimple.cloneIfNecessary(getOp1()), Jimple.cloneIfNecessary(getOp2()));
}
}
| 1,597
| 25.633333
| 94
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/JCmpgExpr.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import soot.Type;
import soot.Unit;
import soot.Value;
import soot.baf.Baf;
import soot.jimple.CmpgExpr;
import soot.jimple.ExprSwitch;
import soot.jimple.Jimple;
import soot.util.Switch;
public class JCmpgExpr extends AbstractJimpleIntBinopExpr implements CmpgExpr {
public JCmpgExpr(Value op1, Value op2) {
super(op1, op2);
}
@Override
public final String getSymbol() {
return " " + Jimple.CMPG + " ";
}
@Override
public void apply(Switch sw) {
((ExprSwitch) sw).caseCmpgExpr(this);
}
@Override
protected Unit makeBafInst(Type opType) {
return Baf.v().newCmpgInst(this.getOp1().getType());
}
@Override
public Object clone() {
return new JCmpgExpr(Jimple.cloneIfNecessary(getOp1()), Jimple.cloneIfNecessary(getOp2()));
}
}
| 1,605
| 25.766667
| 95
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/JCmplExpr.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import soot.Type;
import soot.Unit;
import soot.Value;
import soot.baf.Baf;
import soot.jimple.CmplExpr;
import soot.jimple.ExprSwitch;
import soot.jimple.Jimple;
import soot.util.Switch;
public class JCmplExpr extends AbstractJimpleIntBinopExpr implements CmplExpr {
public JCmplExpr(Value op1, Value op2) {
super(op1, op2);
}
@Override
public final String getSymbol() {
return " " + Jimple.CMPL + " ";
}
@Override
public void apply(Switch sw) {
((ExprSwitch) sw).caseCmplExpr(this);
}
@Override
protected Unit makeBafInst(Type opType) {
return Baf.v().newCmplInst(this.getOp1().getType());
}
@Override
public Object clone() {
return new JCmplExpr(Jimple.cloneIfNecessary(getOp1()), Jimple.cloneIfNecessary(getOp2()));
}
}
| 1,605
| 25.766667
| 95
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/JDivExpr.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import soot.Type;
import soot.Unit;
import soot.Value;
import soot.ValueBox;
import soot.baf.Baf;
import soot.jimple.DivExpr;
import soot.jimple.ExprSwitch;
import soot.jimple.Jimple;
import soot.util.Switch;
public class JDivExpr extends AbstractJimpleFloatBinopExpr implements DivExpr {
public JDivExpr(Value op1, Value op2) {
super(op1, op2);
}
public JDivExpr(ValueBox op1, ValueBox op2) {
super(op1, op2);
}
@Override
public final String getSymbol() {
return " / ";
}
@Override
public void apply(Switch sw) {
((ExprSwitch) sw).caseDivExpr(this);
}
@Override
protected Unit makeBafInst(Type opType) {
return Baf.v().newDivInst(this.getOp1().getType());
}
@Override
public Object clone() {
return new JDivExpr(Jimple.cloneIfNecessary(getOp1()), Jimple.cloneIfNecessary(getOp2()));
}
}
| 1,678
| 24.830769
| 94
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/JDynamicInvokeExpr.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* Copyright (C) 2004 Ondrej Lhotak
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;
import soot.SootClass;
import soot.SootMethod;
import soot.SootMethodRef;
import soot.Unit;
import soot.UnitPrinter;
import soot.Value;
import soot.ValueBox;
import soot.baf.Baf;
import soot.jimple.Constant;
import soot.jimple.ConvertToBaf;
import soot.jimple.DynamicInvokeExpr;
import soot.jimple.ExprSwitch;
import soot.jimple.Jimple;
import soot.jimple.JimpleToBafContext;
import soot.jimple.MethodHandle;
import soot.util.Switch;
@SuppressWarnings("serial")
public class JDynamicInvokeExpr extends AbstractInvokeExpr implements DynamicInvokeExpr, ConvertToBaf {
protected final SootMethodRef bsmRef;
protected final ValueBox[] bsmArgBoxes;
protected final int tag;
public JDynamicInvokeExpr(SootMethodRef bootstrapMethodRef, List<? extends Value> bootstrapArgs, SootMethodRef methodRef,
int tag, List<? extends Value> methodArgs) {
super(methodRef, new ValueBox[methodArgs.size()]);
if (!methodRef.getSignature().startsWith("<" + SootClass.INVOKEDYNAMIC_DUMMY_CLASS_NAME + ": ")) {
throw new IllegalArgumentException(
"Receiver type of JDynamicInvokeExpr must be " + SootClass.INVOKEDYNAMIC_DUMMY_CLASS_NAME + "!");
}
this.bsmRef = bootstrapMethodRef;
this.bsmArgBoxes = new ValueBox[bootstrapArgs.size()];
this.tag = tag;
final Jimple jimp = Jimple.v();
for (ListIterator<? extends Value> it = bootstrapArgs.listIterator(); it.hasNext();) {
Value v = it.next();
if (!(v instanceof Constant)) {
throw new IllegalArgumentException("Bootstrap arg must be a Constant: " + v);
}
this.bsmArgBoxes[it.previousIndex()] = jimp.newImmediateBox(v);
}
for (ListIterator<? extends Value> it = methodArgs.listIterator(); it.hasNext();) {
Value v = it.next();
this.argBoxes[it.previousIndex()] = jimp.newImmediateBox(v);
}
}
public JDynamicInvokeExpr(SootMethodRef bootstrapMethodRef, List<? extends Value> bootstrapArgs, SootMethodRef methodRef,
List<? extends Value> methodArgs) {
/*
* Here the static-handle is chosen as default value, because this works for Java.
*/
this(bootstrapMethodRef, bootstrapArgs, methodRef, MethodHandle.Kind.REF_INVOKE_STATIC.getValue(), methodArgs);
}
@Override
public Object clone() {
List<Value> clonedBsmArgs = new ArrayList<Value>(bsmArgBoxes.length);
for (ValueBox box : bsmArgBoxes) {
clonedBsmArgs.add(box.getValue());
}
final int count = getArgCount();
List<Value> clonedArgs = new ArrayList<Value>(count);
for (int i = 0; i < count; i++) {
clonedArgs.add(Jimple.cloneIfNecessary(getArg(i)));
}
return new JDynamicInvokeExpr(bsmRef, clonedBsmArgs, methodRef, tag, clonedArgs);
}
@Override
public int getBootstrapArgCount() {
return bsmArgBoxes.length;
}
@Override
public Value getBootstrapArg(int index) {
return bsmArgBoxes[index].getValue();
}
@Override
public List<Value> getBootstrapArgs() {
List<Value> l = new ArrayList<Value>();
for (ValueBox element : bsmArgBoxes) {
l.add(element.getValue());
}
return l;
}
@Override
public SootMethodRef getBootstrapMethodRef() {
return bsmRef;
}
public SootMethod getBootstrapMethod() {
return bsmRef.resolve();
}
@Override
public int getHandleTag() {
return tag;
}
@Override
public void apply(Switch sw) {
((ExprSwitch) sw).caseDynamicInvokeExpr(this);
}
@Override
public boolean equivTo(Object o) {
if (o instanceof JDynamicInvokeExpr) {
JDynamicInvokeExpr ie = (JDynamicInvokeExpr) o;
if ((this.argBoxes == null ? 0 : this.argBoxes.length) != (ie.argBoxes == null ? 0 : ie.argBoxes.length)
|| this.bsmArgBoxes.length != ie.bsmArgBoxes.length || !this.getMethod().equals(ie.getMethod())
|| !this.methodRef.equals(ie.methodRef) || !this.bsmRef.equals(ie.bsmRef)) {
return false;
}
int i = 0;
for (ValueBox element : this.bsmArgBoxes) {
if (!element.getValue().equivTo(ie.getBootstrapArg(i))) {
return false;
}
i++;
}
if (this.argBoxes != null) {
i = 0;
for (ValueBox element : this.argBoxes) {
if (!element.getValue().equivTo(ie.getArg(i))) {
return false;
}
i++;
}
}
return true;
}
return false;
}
/**
* Returns a hash code for this object, consistent with structural equality.
*/
@Override
public int equivHashCode() {
return getBootstrapMethod().equivHashCode() * getMethod().equivHashCode() * 17;
}
@Override
public String toString() {
StringBuilder buf = new StringBuilder(Jimple.DYNAMICINVOKE + " \"");
buf.append(methodRef.name()); // quoted method name (can be any UTF8 string)
buf.append("\" <");
buf.append(SootMethod.getSubSignature(""/* no method name here */, methodRef.parameterTypes(), methodRef.returnType()));
buf.append(">(");
if (argBoxes != null) {
for (int i = 0, e = argBoxes.length; i < e; i++) {
if (i != 0) {
buf.append(", ");
}
buf.append(argBoxes[i].getValue().toString());
}
}
buf.append(") ");
buf.append(bsmRef.getSignature());
buf.append('(');
for (int i = 0, e = bsmArgBoxes.length; i < e; i++) {
if (i != 0) {
buf.append(", ");
}
buf.append(bsmArgBoxes[i].getValue().toString());
}
buf.append(')');
return buf.toString();
}
@Override
public void toString(UnitPrinter up) {
up.literal(Jimple.DYNAMICINVOKE + " \"" + methodRef.name() + "\" <"
+ SootMethod.getSubSignature(""/* no method name here */, methodRef.parameterTypes(), methodRef.returnType())
+ ">(");
if (argBoxes != null) {
for (int i = 0, e = argBoxes.length; i < e; i++) {
if (i != 0) {
up.literal(", ");
}
argBoxes[i].toString(up);
}
}
up.literal(") ");
up.methodRef(bsmRef);
up.literal("(");
for (int i = 0, e = bsmArgBoxes.length; i < e; i++) {
if (i != 0) {
up.literal(", ");
}
bsmArgBoxes[i].toString(up);
}
up.literal(")");
}
@Override
public void convertToBaf(JimpleToBafContext context, List<Unit> out) {
if (argBoxes != null) {
for (ValueBox element : argBoxes) {
((ConvertToBaf) (element.getValue())).convertToBaf(context, out);
}
}
List<Value> bsmArgs = new ArrayList<Value>();
for (ValueBox argBox : bsmArgBoxes) {
bsmArgs.add(argBox.getValue());
}
Unit u = Baf.v().newDynamicInvokeInst(bsmRef, bsmArgs, methodRef, tag);
u.addAllTagsOf(context.getCurrentUnit());
out.add(u);
}
}
| 7,668
| 28.724806
| 124
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/JEnterMonitorStmt.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.List;
import soot.Unit;
import soot.UnitPrinter;
import soot.Value;
import soot.ValueBox;
import soot.baf.Baf;
import soot.jimple.ConvertToBaf;
import soot.jimple.EnterMonitorStmt;
import soot.jimple.Jimple;
import soot.jimple.JimpleToBafContext;
import soot.jimple.StmtSwitch;
import soot.util.Switch;
public class JEnterMonitorStmt extends AbstractOpStmt implements EnterMonitorStmt {
public JEnterMonitorStmt(Value op) {
this(Jimple.v().newImmediateBox(op));
}
protected JEnterMonitorStmt(ValueBox opBox) {
super(opBox);
}
@Override
public Object clone() {
return new JEnterMonitorStmt(Jimple.cloneIfNecessary(getOp()));
}
@Override
public String toString() {
return Jimple.ENTERMONITOR + " " + opBox.getValue().toString();
}
@Override
public void toString(UnitPrinter up) {
up.literal(Jimple.ENTERMONITOR + " ");
opBox.toString(up);
}
@Override
public void apply(Switch sw) {
((StmtSwitch) sw).caseEnterMonitorStmt(this);
}
@Override
public void convertToBaf(JimpleToBafContext context, List<Unit> out) {
((ConvertToBaf) (getOp())).convertToBaf(context, out);
Unit u = Baf.v().newEnterMonitorInst();
u.addAllTagsOf(this);
out.add(u);
}
@Override
public boolean fallsThrough() {
return true;
}
@Override
public boolean branches() {
return false;
}
}
| 2,210
| 24.125
| 83
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/JEqExpr.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import soot.Type;
import soot.Unit;
import soot.Value;
import soot.jimple.EqExpr;
import soot.jimple.ExprSwitch;
import soot.jimple.Jimple;
import soot.util.Switch;
public class JEqExpr extends AbstractJimpleIntBinopExpr implements EqExpr {
public JEqExpr(Value op1, Value op2) {
super(op1, op2);
}
@Override
public final String getSymbol() {
return " == ";
}
@Override
public void apply(Switch sw) {
((ExprSwitch) sw).caseEqExpr(this);
}
@Override
protected Unit makeBafInst(Type opType) {
throw new RuntimeException("unsupported conversion: " + this);
// return Baf.v().newEqInst(this.getOp1().getType()); }
}
@Override
public Object clone() {
return new JEqExpr(Jimple.cloneIfNecessary(getOp1()), Jimple.cloneIfNecessary(getOp2()));
}
}
| 1,625
| 26.1
| 93
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/JExitMonitorStmt.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.List;
import soot.Unit;
import soot.UnitPrinter;
import soot.Value;
import soot.ValueBox;
import soot.baf.Baf;
import soot.jimple.ConvertToBaf;
import soot.jimple.ExitMonitorStmt;
import soot.jimple.Jimple;
import soot.jimple.JimpleToBafContext;
import soot.jimple.StmtSwitch;
import soot.util.Switch;
public class JExitMonitorStmt extends AbstractOpStmt implements ExitMonitorStmt {
public JExitMonitorStmt(Value op) {
this(Jimple.v().newImmediateBox(op));
}
protected JExitMonitorStmt(ValueBox opBox) {
super(opBox);
}
@Override
public Object clone() {
return new JExitMonitorStmt(Jimple.cloneIfNecessary(getOp()));
}
@Override
public String toString() {
return Jimple.EXITMONITOR + " " + opBox.getValue().toString();
}
@Override
public void toString(UnitPrinter up) {
up.literal(Jimple.EXITMONITOR + " ");
opBox.toString(up);
}
@Override
public void apply(Switch sw) {
((StmtSwitch) sw).caseExitMonitorStmt(this);
}
@Override
public void convertToBaf(JimpleToBafContext context, List<Unit> out) {
((ConvertToBaf) (getOp())).convertToBaf(context, out);
Unit u = Baf.v().newExitMonitorInst();
u.addAllTagsOf(this);
out.add(u);
}
@Override
public boolean fallsThrough() {
return true;
}
@Override
public boolean branches() {
return false;
}
}
| 2,202
| 23.477778
| 81
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/JGeExpr.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import soot.Type;
import soot.Unit;
import soot.Value;
import soot.jimple.ExprSwitch;
import soot.jimple.GeExpr;
import soot.jimple.Jimple;
import soot.util.Switch;
public class JGeExpr extends AbstractJimpleIntBinopExpr implements GeExpr {
public JGeExpr(Value op1, Value op2) {
super(op1, op2);
}
@Override
public final String getSymbol() {
return " >= ";
}
@Override
public void apply(Switch sw) {
((ExprSwitch) sw).caseGeExpr(this);
}
@Override
protected Unit makeBafInst(Type opType) {
throw new RuntimeException("unsupported conversion: " + this);
// return Baf.v().newGeInst(this.getOp1().getType());
}
@Override
public Object clone() {
return new JGeExpr(Jimple.cloneIfNecessary(getOp1()), Jimple.cloneIfNecessary(getOp2()));
}
}
| 1,623
| 26.066667
| 93
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/JGotoStmt.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.Collections;
import java.util.List;
import soot.Unit;
import soot.UnitBox;
import soot.UnitPrinter;
import soot.baf.Baf;
import soot.jimple.GotoStmt;
import soot.jimple.Jimple;
import soot.jimple.JimpleToBafContext;
import soot.jimple.StmtSwitch;
import soot.util.Switch;
public class JGotoStmt extends AbstractStmt implements GotoStmt {
protected final UnitBox targetBox;
protected final List<UnitBox> targetBoxes;
public JGotoStmt(Unit target) {
this(Jimple.v().newStmtBox(target));
}
public JGotoStmt(UnitBox box) {
this.targetBox = box;
this.targetBoxes = Collections.singletonList(box);
}
@Override
public Object clone() {
return new JGotoStmt(getTarget());
}
@Override
public String toString() {
Unit t = getTarget();
String target = t.branches() ? "(branch)" : t.toString();
return Jimple.GOTO + " [?= " + target + "]";
}
@Override
public void toString(UnitPrinter up) {
up.literal(Jimple.GOTO + " ");
targetBox.toString(up);
}
@Override
public Unit getTarget() {
return targetBox.getUnit();
}
@Override
public void setTarget(Unit target) {
targetBox.setUnit(target);
}
@Override
public UnitBox getTargetBox() {
return targetBox;
}
@Override
public List<UnitBox> getUnitBoxes() {
return targetBoxes;
}
@Override
public void apply(Switch sw) {
((StmtSwitch) sw).caseGotoStmt(this);
}
@Override
public void convertToBaf(JimpleToBafContext context, List<Unit> out) {
final Baf vaf = Baf.v();
Unit u = vaf.newGotoInst(vaf.newPlaceholderInst(getTarget()));
u.addAllTagsOf(this);
out.add(u);
}
@Override
public boolean fallsThrough() {
return false;
}
@Override
public boolean branches() {
return true;
}
}
| 2,626
| 22.247788
| 72
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/JGtExpr.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import soot.Type;
import soot.Unit;
import soot.Value;
import soot.jimple.ExprSwitch;
import soot.jimple.GtExpr;
import soot.jimple.Jimple;
import soot.util.Switch;
public class JGtExpr extends AbstractJimpleIntBinopExpr implements GtExpr {
public JGtExpr(Value op1, Value op2) {
super(op1, op2);
}
@Override
public final String getSymbol() {
return " > ";
}
@Override
public void apply(Switch sw) {
((ExprSwitch) sw).caseGtExpr(this);
}
@Override
protected Unit makeBafInst(Type opType) {
throw new RuntimeException("unsupported conversion: " + this);
// return Baf.v().newGtInst(this.getOp1().getType());
}
@Override
public Object clone() {
return new JGtExpr(Jimple.cloneIfNecessary(getOp1()), Jimple.cloneIfNecessary(getOp2()));
}
}
| 1,622
| 26.05
| 93
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/JIdentityStmt.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.List;
import soot.Local;
import soot.RefType;
import soot.Unit;
import soot.UnitPrinter;
import soot.Value;
import soot.ValueBox;
import soot.baf.Baf;
import soot.jimple.CaughtExceptionRef;
import soot.jimple.IdentityStmt;
import soot.jimple.Jimple;
import soot.jimple.JimpleToBafContext;
import soot.jimple.ParameterRef;
import soot.jimple.StmtSwitch;
import soot.jimple.ThisRef;
import soot.util.Switch;
public class JIdentityStmt extends AbstractDefinitionStmt implements IdentityStmt {
public JIdentityStmt(Value local, Value identityValue) {
this(Jimple.v().newLocalBox(local), Jimple.v().newIdentityRefBox(identityValue));
}
protected JIdentityStmt(ValueBox localBox, ValueBox identityValueBox) {
super(localBox, identityValueBox);
}
@Override
public Object clone() {
return new JIdentityStmt(Jimple.cloneIfNecessary(getLeftOp()), Jimple.cloneIfNecessary(getRightOp()));
}
@Override
public String toString() {
return leftBox.getValue().toString() + " := " + rightBox.getValue().toString();
}
@Override
public void toString(UnitPrinter up) {
leftBox.toString(up);
up.literal(" := ");
rightBox.toString(up);
}
@Override
public void setLeftOp(Value local) {
leftBox.setValue(local);
}
@Override
public void setRightOp(Value identityRef) {
rightBox.setValue(identityRef);
}
@Override
public void apply(Switch sw) {
((StmtSwitch) sw).caseIdentityStmt(this);
}
@Override
public void convertToBaf(JimpleToBafContext context, List<Unit> out) {
Value newRhs;
Value currentRhs = getRightOp();
if (currentRhs instanceof ThisRef) {
newRhs = Baf.v().newThisRef((RefType) ((ThisRef) currentRhs).getType());
} else if (currentRhs instanceof ParameterRef) {
ParameterRef rhsPRef = (ParameterRef) currentRhs;
newRhs = Baf.v().newParameterRef(rhsPRef.getType(), rhsPRef.getIndex());
} else if (currentRhs instanceof CaughtExceptionRef) {
Unit u = Baf.v().newStoreInst(RefType.v(), context.getBafLocalOfJimpleLocal((Local) getLeftOp()));
u.addAllTagsOf(this);
out.add(u);
return;
} else {
throw new RuntimeException("Don't know how to convert unknown rhs");
}
Unit u = Baf.v().newIdentityInst(context.getBafLocalOfJimpleLocal((Local) getLeftOp()), newRhs);
u.addAllTagsOf(this);
out.add(u);
}
}
| 3,216
| 28.787037
| 106
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/JIfStmt.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import soot.Unit;
import soot.UnitBox;
import soot.UnitPrinter;
import soot.Value;
import soot.ValueBox;
import soot.baf.Baf;
import soot.jimple.AbstractJimpleValueSwitch;
import soot.jimple.BinopExpr;
import soot.jimple.ConvertToBaf;
import soot.jimple.EqExpr;
import soot.jimple.GeExpr;
import soot.jimple.GtExpr;
import soot.jimple.IfStmt;
import soot.jimple.IntConstant;
import soot.jimple.Jimple;
import soot.jimple.JimpleToBafContext;
import soot.jimple.LeExpr;
import soot.jimple.LtExpr;
import soot.jimple.NeExpr;
import soot.jimple.NullConstant;
import soot.jimple.Stmt;
import soot.jimple.StmtSwitch;
import soot.util.Switch;
public class JIfStmt extends AbstractStmt implements IfStmt {
protected final ValueBox conditionBox;
protected final UnitBox targetBox;
protected final List<UnitBox> targetBoxes;
public JIfStmt(Value condition, Unit target) {
this(condition, Jimple.v().newStmtBox(target));
}
public JIfStmt(Value condition, UnitBox target) {
this(Jimple.v().newConditionExprBox(condition), target);
}
protected JIfStmt(ValueBox conditionBox, UnitBox targetBox) {
this.conditionBox = conditionBox;
this.targetBox = targetBox;
this.targetBoxes = Collections.singletonList(targetBox);
}
@Override
public Object clone() {
return new JIfStmt(Jimple.cloneIfNecessary(getCondition()), getTarget());
}
@Override
public String toString() {
Unit t = getTarget();
String target = t.branches() ? "(branch)" : t.toString();
return Jimple.IF + " " + getCondition().toString() + " " + Jimple.GOTO + " " + target;
}
@Override
public void toString(UnitPrinter up) {
up.literal(Jimple.IF + " ");
conditionBox.toString(up);
up.literal(" " + Jimple.GOTO + " ");
targetBox.toString(up);
}
@Override
public Value getCondition() {
return conditionBox.getValue();
}
@Override
public void setCondition(Value condition) {
conditionBox.setValue(condition);
}
@Override
public ValueBox getConditionBox() {
return conditionBox;
}
@Override
public Stmt getTarget() {
return (Stmt) targetBox.getUnit();
}
@Override
public void setTarget(Unit target) {
targetBox.setUnit(target);
}
@Override
public UnitBox getTargetBox() {
return targetBox;
}
@Override
public List<ValueBox> getUseBoxes() {
List<ValueBox> useBoxes = new ArrayList<ValueBox>(conditionBox.getValue().getUseBoxes());
useBoxes.add(conditionBox);
return useBoxes;
}
@Override
public final List<UnitBox> getUnitBoxes() {
return targetBoxes;
}
@Override
public void apply(Switch sw) {
((StmtSwitch) sw).caseIfStmt(this);
}
@Override
public void convertToBaf(final JimpleToBafContext context, final List<Unit> out) {
final BinopExpr cond = (BinopExpr) getCondition();
final Value op1 = cond.getOp1();
final Value op2 = cond.getOp2();
context.setCurrentUnit(this);
// Handle simple subcase where op1 is null
if (op2 instanceof NullConstant || op1 instanceof NullConstant) {
if (op2 instanceof NullConstant) {
((ConvertToBaf) op1).convertToBaf(context, out);
} else {
((ConvertToBaf) op2).convertToBaf(context, out);
}
Unit u;
if (cond instanceof EqExpr) {
u = Baf.v().newIfNullInst(Baf.v().newPlaceholderInst(getTarget()));
} else if (cond instanceof NeExpr) {
u = Baf.v().newIfNonNullInst(Baf.v().newPlaceholderInst(getTarget()));
} else {
throw new RuntimeException("invalid condition");
}
u.addAllTagsOf(this);
out.add(u);
return;
}
// Handle simple subcase where op2 is 0
if (op2 instanceof IntConstant && ((IntConstant) op2).value == 0) {
((ConvertToBaf) op1).convertToBaf(context, out);
cond.apply(new AbstractJimpleValueSwitch() {
private void add(Unit u) {
u.addAllTagsOf(JIfStmt.this);
out.add(u);
}
@Override
public void caseEqExpr(EqExpr expr) {
add(Baf.v().newIfEqInst(Baf.v().newPlaceholderInst(getTarget())));
}
@Override
public void caseNeExpr(NeExpr expr) {
add(Baf.v().newIfNeInst(Baf.v().newPlaceholderInst(getTarget())));
}
@Override
public void caseLtExpr(LtExpr expr) {
add(Baf.v().newIfLtInst(Baf.v().newPlaceholderInst(getTarget())));
}
@Override
public void caseLeExpr(LeExpr expr) {
add(Baf.v().newIfLeInst(Baf.v().newPlaceholderInst(getTarget())));
}
@Override
public void caseGtExpr(GtExpr expr) {
add(Baf.v().newIfGtInst(Baf.v().newPlaceholderInst(getTarget())));
}
@Override
public void caseGeExpr(GeExpr expr) {
add(Baf.v().newIfGeInst(Baf.v().newPlaceholderInst(getTarget())));
}
});
return;
}
// Handle simple subcase where op1 is 0 (flip directions)
if (op1 instanceof IntConstant && ((IntConstant) op1).value == 0) {
((ConvertToBaf) op2).convertToBaf(context, out);
cond.apply(new AbstractJimpleValueSwitch() {
private void add(Unit u) {
u.addAllTagsOf(JIfStmt.this);
out.add(u);
}
@Override
public void caseEqExpr(EqExpr expr) {
add(Baf.v().newIfEqInst(Baf.v().newPlaceholderInst(getTarget())));
}
@Override
public void caseNeExpr(NeExpr expr) {
add(Baf.v().newIfNeInst(Baf.v().newPlaceholderInst(getTarget())));
}
@Override
public void caseLtExpr(LtExpr expr) {
add(Baf.v().newIfGtInst(Baf.v().newPlaceholderInst(getTarget())));
}
@Override
public void caseLeExpr(LeExpr expr) {
add(Baf.v().newIfGeInst(Baf.v().newPlaceholderInst(getTarget())));
}
@Override
public void caseGtExpr(GtExpr expr) {
add(Baf.v().newIfLtInst(Baf.v().newPlaceholderInst(getTarget())));
}
@Override
public void caseGeExpr(GeExpr expr) {
add(Baf.v().newIfLeInst(Baf.v().newPlaceholderInst(getTarget())));
}
});
return;
}
// Handle the normal case
{
((ConvertToBaf) op1).convertToBaf(context, out);
((ConvertToBaf) op2).convertToBaf(context, out);
cond.apply(new AbstractJimpleValueSwitch() {
private void add(Unit u) {
u.addAllTagsOf(JIfStmt.this);
out.add(u);
}
@Override
public void caseEqExpr(EqExpr expr) {
add(Baf.v().newIfCmpEqInst(op1.getType(), Baf.v().newPlaceholderInst(getTarget())));
}
@Override
public void caseNeExpr(NeExpr expr) {
add(Baf.v().newIfCmpNeInst(op1.getType(), Baf.v().newPlaceholderInst(getTarget())));
}
@Override
public void caseLtExpr(LtExpr expr) {
add(Baf.v().newIfCmpLtInst(op1.getType(), Baf.v().newPlaceholderInst(getTarget())));
}
@Override
public void caseLeExpr(LeExpr expr) {
add(Baf.v().newIfCmpLeInst(op1.getType(), Baf.v().newPlaceholderInst(getTarget())));
}
@Override
public void caseGtExpr(GtExpr expr) {
add(Baf.v().newIfCmpGtInst(op1.getType(), Baf.v().newPlaceholderInst(getTarget())));
}
@Override
public void caseGeExpr(GeExpr expr) {
add(Baf.v().newIfCmpGeInst(op1.getType(), Baf.v().newPlaceholderInst(getTarget())));
}
});
}
}
@Override
public boolean fallsThrough() {
return true;
}
@Override
public boolean branches() {
return true;
}
}
| 8,581
| 26.773463
| 94
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/JInstanceFieldRef.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* Copyright (C) 2004 Ondrej Lhotak
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import soot.SootFieldRef;
import soot.Value;
import soot.jimple.Jimple;
public class JInstanceFieldRef extends AbstractInstanceFieldRef {
public JInstanceFieldRef(Value base, SootFieldRef fieldRef) {
super(Jimple.v().newLocalBox(base), fieldRef);
}
public Object clone() {
return new JInstanceFieldRef(Jimple.cloneIfNecessary(getBase()), fieldRef);
}
}
| 1,234
| 30.666667
| 79
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/JInstanceOfExpr.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.List;
import soot.Type;
import soot.Unit;
import soot.Value;
import soot.baf.Baf;
import soot.jimple.ConvertToBaf;
import soot.jimple.Jimple;
import soot.jimple.JimpleToBafContext;
public class JInstanceOfExpr extends AbstractInstanceOfExpr implements ConvertToBaf {
public JInstanceOfExpr(Value op, Type checkType) {
super(Jimple.v().newImmediateBox(op), checkType);
}
@Override
public void convertToBaf(JimpleToBafContext context, List<Unit> out) {
((ConvertToBaf) (getOp())).convertToBaf(context, out);
Unit u = Baf.v().newInstanceOfInst(getCheckType());
u.addAllTagsOf(context.getCurrentUnit());
out.add(u);
}
@Override
public Object clone() {
return new JInstanceOfExpr(Jimple.cloneIfNecessary(getOp()), checkType);
}
}
| 1,614
| 28.907407
| 85
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/JInterfaceInvokeExpr.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* Copyright (C) 2004 Ondrej Lhotak
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;
import soot.SootClass;
import soot.SootMethodRef;
import soot.Value;
import soot.ValueBox;
import soot.jimple.Jimple;
public class JInterfaceInvokeExpr extends AbstractInterfaceInvokeExpr {
public JInterfaceInvokeExpr(Value base, SootMethodRef methodRef, List<? extends Value> args) {
super(Jimple.v().newLocalBox(base), methodRef, new ValueBox[args.size()]);
// Check that the method's class is resolved enough
final SootClass declaringClass = methodRef.declaringClass();
// CheckLevel returns without doing anything because we can be not 'done' resolving
declaringClass.checkLevelIgnoreResolving(SootClass.HIERARCHY);
// now check if the class is valid
if (!declaringClass.isInterface() && !declaringClass.isPhantom()) {
throw new RuntimeException("Trying to create interface invoke expression for non-interface type: " + declaringClass
+ " Use JVirtualInvokeExpr or JSpecialInvokeExpr instead!");
}
final Jimple jimp = Jimple.v();
for (ListIterator<? extends Value> it = args.listIterator(); it.hasNext();) {
Value v = it.next();
this.argBoxes[it.previousIndex()] = jimp.newImmediateBox(v);
}
}
@Override
public Object clone() {
final int count = getArgCount();
List<Value> clonedArgs = new ArrayList<Value>(count);
for (int i = 0; i < count; i++) {
clonedArgs.add(Jimple.cloneIfNecessary(getArg(i)));
}
return new JInterfaceInvokeExpr(Jimple.cloneIfNecessary(getBase()), methodRef, clonedArgs);
}
}
| 2,462
| 35.220588
| 121
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/JInvokeStmt.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.ArrayList;
import java.util.List;
import soot.Type;
import soot.Unit;
import soot.UnitPrinter;
import soot.Value;
import soot.ValueBox;
import soot.VoidType;
import soot.baf.Baf;
import soot.jimple.ConvertToBaf;
import soot.jimple.InvokeExpr;
import soot.jimple.InvokeStmt;
import soot.jimple.Jimple;
import soot.jimple.JimpleToBafContext;
import soot.jimple.StmtSwitch;
import soot.util.Switch;
public class JInvokeStmt extends AbstractStmt implements InvokeStmt {
protected final ValueBox invokeExprBox;
public JInvokeStmt(Value c) {
this(Jimple.v().newInvokeExprBox(c));
}
protected JInvokeStmt(ValueBox invokeExprBox) {
this.invokeExprBox = invokeExprBox;
}
@Override
public Object clone() {
return new JInvokeStmt(Jimple.cloneIfNecessary(getInvokeExpr()));
}
@Override
public boolean containsInvokeExpr() {
return true;
}
@Override
public String toString() {
return invokeExprBox.getValue().toString();
}
@Override
public void toString(UnitPrinter up) {
invokeExprBox.toString(up);
}
@Override
public void setInvokeExpr(Value invokeExpr) {
invokeExprBox.setValue(invokeExpr);
}
@Override
public InvokeExpr getInvokeExpr() {
return (InvokeExpr) invokeExprBox.getValue();
}
@Override
public ValueBox getInvokeExprBox() {
return invokeExprBox;
}
@Override
public List<ValueBox> getUseBoxes() {
List<ValueBox> list = new ArrayList<ValueBox>(invokeExprBox.getValue().getUseBoxes());
list.add(invokeExprBox);
return list;
}
@Override
public void apply(Switch sw) {
((StmtSwitch) sw).caseInvokeStmt(this);
}
@Override
public void convertToBaf(JimpleToBafContext context, List<Unit> out) {
InvokeExpr ie = getInvokeExpr();
context.setCurrentUnit(this);
((ConvertToBaf) ie).convertToBaf(context, out);
Type returnType = ie.getMethodRef().returnType();
if (!VoidType.v().equals(returnType)) {
Unit u = Baf.v().newPopInst(returnType);
u.addAllTagsOf(this);
out.add(u);
}
}
@Override
public boolean fallsThrough() {
return true;
}
@Override
public boolean branches() {
return false;
}
}
| 3,028
| 22.664063
| 90
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/JLeExpr.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import soot.Type;
import soot.Unit;
import soot.Value;
import soot.jimple.ExprSwitch;
import soot.jimple.Jimple;
import soot.jimple.LeExpr;
import soot.util.Switch;
public class JLeExpr extends AbstractJimpleIntBinopExpr implements LeExpr {
public JLeExpr(Value op1, Value op2) {
super(op1, op2);
}
@Override
public final String getSymbol() {
return " <= ";
}
@Override
public void apply(Switch sw) {
((ExprSwitch) sw).caseLeExpr(this);
}
@Override
protected Unit makeBafInst(Type opType) {
throw new RuntimeException("unsupported conversion: " + this);
// return Baf.v().newLeInst(this.getOp1().getType());
}
@Override
public Object clone() {
return new JLeExpr(Jimple.cloneIfNecessary(getOp1()), Jimple.cloneIfNecessary(getOp2()));
}
}
| 1,623
| 26.066667
| 93
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/JLengthExpr.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.List;
import soot.Unit;
import soot.Value;
import soot.baf.Baf;
import soot.jimple.ConvertToBaf;
import soot.jimple.Jimple;
import soot.jimple.JimpleToBafContext;
public class JLengthExpr extends AbstractLengthExpr implements ConvertToBaf {
public JLengthExpr(Value op) {
super(Jimple.v().newImmediateBox(op));
}
@Override
public void convertToBaf(JimpleToBafContext context, List<Unit> out) {
((ConvertToBaf) (getOp())).convertToBaf(context, out);
Unit u = Baf.v().newArrayLengthInst();
u.addAllTagsOf(context.getCurrentUnit());
out.add(u);
}
@Override
public Object clone() {
return new JLengthExpr(Jimple.cloneIfNecessary(getOp()));
}
}
| 1,530
| 27.351852
| 77
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/JLookupSwitchStmt.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.ListIterator;
import soot.Unit;
import soot.UnitBox;
import soot.UnitPrinter;
import soot.Value;
import soot.ValueBox;
import soot.baf.Baf;
import soot.baf.PlaceholderInst;
import soot.jimple.ConvertToBaf;
import soot.jimple.IntConstant;
import soot.jimple.Jimple;
import soot.jimple.JimpleToBafContext;
import soot.jimple.LookupSwitchStmt;
import soot.jimple.StmtSwitch;
import soot.util.Switch;
public class JLookupSwitchStmt extends AbstractSwitchStmt implements LookupSwitchStmt {
/**
* List of lookup values from the corresponding bytecode instruction, represented as IntConstants.
*/
protected List<IntConstant> lookupValues;
/** Constructs a new JLookupSwitchStmt. lookupValues should be a list of IntConst s. */
public JLookupSwitchStmt(Value key, List<IntConstant> lookupValues, List<? extends Unit> targets, Unit defaultTarget) {
this(Jimple.v().newImmediateBox(key), lookupValues, getTargetBoxesArray(targets, Jimple.v()::newStmtBox),
Jimple.v().newStmtBox(defaultTarget));
}
/** Constructs a new JLookupSwitchStmt. lookupValues should be a list of IntConst s. */
public JLookupSwitchStmt(Value key, List<IntConstant> lookupValues, List<? extends UnitBox> targets,
UnitBox defaultTarget) {
this(Jimple.v().newImmediateBox(key), lookupValues, targets.toArray(new UnitBox[targets.size()]), defaultTarget);
}
protected JLookupSwitchStmt(ValueBox keyBox, List<IntConstant> lookupValues, UnitBox[] targetBoxes,
UnitBox defaultTargetBox) {
super(keyBox, defaultTargetBox, targetBoxes);
setLookupValues(lookupValues);
}
@Override
public Object clone() {
List<IntConstant> clonedLookupValues = new ArrayList<IntConstant>(lookupValues.size());
for (IntConstant c : lookupValues) {
clonedLookupValues.add(IntConstant.v(c.value));
}
return new JLookupSwitchStmt(getKey(), clonedLookupValues, getTargets(), getDefaultTarget());
}
@Override
public String toString() {
final char endOfLine = ' ';
StringBuilder buf = new StringBuilder(Jimple.LOOKUPSWITCH + "(");
buf.append(keyBox.getValue().toString()).append(')').append(endOfLine);
buf.append('{').append(endOfLine);
for (ListIterator<IntConstant> it = lookupValues.listIterator(); it.hasNext();) {
IntConstant c = it.next();
buf.append(" " + Jimple.CASE + " ").append(c).append(": " + Jimple.GOTO + " ");
Unit target = getTarget(it.previousIndex());
buf.append(target == this ? "self" : target).append(';').append(endOfLine);
}
{
buf.append(" " + Jimple.DEFAULT + ": " + Jimple.GOTO + " ");
Unit target = getDefaultTarget();
buf.append(target == this ? "self" : target).append(';').append(endOfLine);
}
buf.append('}');
return buf.toString();
}
@Override
public void toString(UnitPrinter up) {
up.literal(Jimple.LOOKUPSWITCH + "(");
keyBox.toString(up);
up.literal(")");
up.newline();
up.literal("{");
up.newline();
for (ListIterator<IntConstant> it = lookupValues.listIterator(); it.hasNext();) {
IntConstant c = it.next();
up.literal(" " + Jimple.CASE + " ");
up.constant(c);
up.literal(": " + Jimple.GOTO + " ");
targetBoxes[it.previousIndex()].toString(up);
up.literal(";");
up.newline();
}
up.literal(" " + Jimple.DEFAULT + ": " + Jimple.GOTO + " ");
defaultTargetBox.toString(up);
up.literal(";");
up.newline();
up.literal("}");
}
@Override
public void setLookupValues(List<IntConstant> lookupValues) {
this.lookupValues = new ArrayList<IntConstant>(lookupValues);
}
@Override
public void setLookupValue(int index, int value) {
lookupValues.set(index, IntConstant.v(value));
}
@Override
public int getLookupValue(int index) {
return lookupValues.get(index).value;
}
@Override
public List<IntConstant> getLookupValues() {
return Collections.unmodifiableList(lookupValues);
}
@Override
public void apply(Switch sw) {
((StmtSwitch) sw).caseLookupSwitchStmt(this);
}
@Override
public void convertToBaf(JimpleToBafContext context, List<Unit> out) {
((ConvertToBaf) getKey()).convertToBaf(context, out);
final Baf baf = Baf.v();
final List<Unit> targets = getTargets();
List<PlaceholderInst> targetPlaceholders = new ArrayList<PlaceholderInst>(targets.size());
for (Unit target : targets) {
targetPlaceholders.add(baf.newPlaceholderInst(target));
}
Unit u = baf.newLookupSwitchInst(baf.newPlaceholderInst(getDefaultTarget()), getLookupValues(), targetPlaceholders);
u.addAllTagsOf(this);
out.add(u);
}
}
| 5,588
| 32.267857
| 121
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/JLtExpr.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import soot.Type;
import soot.Unit;
import soot.Value;
import soot.jimple.ExprSwitch;
import soot.jimple.Jimple;
import soot.jimple.LtExpr;
import soot.util.Switch;
public class JLtExpr extends AbstractJimpleIntBinopExpr implements LtExpr {
public JLtExpr(Value op1, Value op2) {
super(op1, op2);
}
@Override
public final String getSymbol() {
return " < ";
}
@Override
public void apply(Switch sw) {
((ExprSwitch) sw).caseLtExpr(this);
}
@Override
protected Unit makeBafInst(Type opType) {
throw new RuntimeException("unsupported conversion: " + this);
// return Baf.v().newLtInst(this.getOp1().getType());
}
@Override
public Object clone() {
return new JLtExpr(Jimple.cloneIfNecessary(getOp1()), Jimple.cloneIfNecessary(getOp2()));
}
}
| 1,622
| 26.05
| 93
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/JMulExpr.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import soot.Type;
import soot.Unit;
import soot.Value;
import soot.baf.Baf;
import soot.jimple.ExprSwitch;
import soot.jimple.Jimple;
import soot.jimple.MulExpr;
import soot.util.Switch;
public class JMulExpr extends AbstractJimpleFloatBinopExpr implements MulExpr {
public JMulExpr(Value op1, Value op2) {
super(op1, op2);
}
@Override
public final String getSymbol() {
return " * ";
}
@Override
public void apply(Switch sw) {
((ExprSwitch) sw).caseMulExpr(this);
}
@Override
protected Unit makeBafInst(Type opType) {
return Baf.v().newMulInst(this.getOp1().getType());
}
@Override
public Object clone() {
return new JMulExpr(Jimple.cloneIfNecessary(getOp1()), Jimple.cloneIfNecessary(getOp2()));
}
}
| 1,582
| 25.383333
| 94
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/JNeExpr.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import soot.Type;
import soot.Unit;
import soot.Value;
import soot.jimple.ExprSwitch;
import soot.jimple.Jimple;
import soot.jimple.NeExpr;
import soot.util.Switch;
public class JNeExpr extends AbstractJimpleIntBinopExpr implements NeExpr {
public JNeExpr(Value op1, Value op2) {
super(op1, op2);
}
@Override
public final String getSymbol() {
return " != ";
}
@Override
public void apply(Switch sw) {
((ExprSwitch) sw).caseNeExpr(this);
}
@Override
protected Unit makeBafInst(Type opType) {
throw new RuntimeException("unsupported conversion: " + this);
// return Baf.v().newNeInst(this.getOp1().getType());
}
@Override
public Object clone() {
return new JNeExpr(Jimple.cloneIfNecessary(getOp1()), Jimple.cloneIfNecessary(getOp2()));
}
}
| 1,623
| 26.066667
| 93
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/JNegExpr.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.List;
import soot.Unit;
import soot.Value;
import soot.baf.Baf;
import soot.jimple.ConvertToBaf;
import soot.jimple.Jimple;
import soot.jimple.JimpleToBafContext;
public class JNegExpr extends AbstractNegExpr implements ConvertToBaf {
public JNegExpr(Value op) {
super(Jimple.v().newImmediateBox(op));
}
@Override
public void convertToBaf(JimpleToBafContext context, List<Unit> out) {
((ConvertToBaf) (getOp())).convertToBaf(context, out);
Unit u = Baf.v().newNegInst(getType());
u.addAllTagsOf(context.getCurrentUnit());
out.add(u);
}
@Override
public Object clone() {
return new JNegExpr(Jimple.cloneIfNecessary(getOp()));
}
}
| 1,518
| 27.660377
| 72
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/JNewArrayExpr.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import soot.Type;
import soot.Value;
import soot.ValueBox;
import soot.jimple.Jimple;
public class JNewArrayExpr extends AbstractNewArrayExpr {
public JNewArrayExpr(Type type, Value size) {
super(type, Jimple.v().newImmediateBox(size));
}
public JNewArrayExpr(Type type, ValueBox box) {
super(type, box);
}
@Override
public Object clone() {
return new JNewArrayExpr(getBaseType(), Jimple.cloneIfNecessary(getSize()));
}
}
| 1,279
| 27.444444
| 80
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/JNewExpr.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.List;
import soot.RefType;
import soot.Unit;
import soot.baf.Baf;
import soot.jimple.ConvertToBaf;
import soot.jimple.JimpleToBafContext;
public class JNewExpr extends AbstractNewExpr implements ConvertToBaf {
public JNewExpr(RefType type) {
this.type = type;
}
@Override
public void convertToBaf(JimpleToBafContext context, List<Unit> out) {
Unit u = Baf.v().newNewInst(getBaseType());
u.addAllTagsOf(context.getCurrentUnit());
out.add(u);
}
@Override
public Object clone() {
return new JNewExpr(type);
}
}
| 1,393
| 26.333333
| 72
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/JNewMultiArrayExpr.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;
import soot.ArrayType;
import soot.Value;
import soot.ValueBox;
import soot.jimple.Jimple;
public class JNewMultiArrayExpr extends AbstractNewMultiArrayExpr {
public JNewMultiArrayExpr(ArrayType type, List<? extends Value> sizes) {
super(type, new ValueBox[sizes.size()]);
final Jimple jimp = Jimple.v();
for (ListIterator<? extends Value> it = sizes.listIterator(); it.hasNext();) {
Value v = it.next();
sizeBoxes[it.previousIndex()] = jimp.newImmediateBox(v);
}
}
public JNewMultiArrayExpr(ArrayType type, ValueBox[] sizes) {
super(type, sizes);
for (int i = 0; i < sizes.length; i++) {
ValueBox v = sizes[i];
sizeBoxes[i] = v;
}
}
@Override
public Object clone() {
final ValueBox[] boxes = this.sizeBoxes;
List<Value> clonedSizes = new ArrayList<Value>(boxes.length);
for (ValueBox vb : boxes) {
clonedSizes.add(Jimple.cloneIfNecessary(vb.getValue()));
}
return new JNewMultiArrayExpr(baseType, clonedSizes);
}
}
| 1,924
| 28.615385
| 82
|
java
|
soot
|
soot-master/src/main/java/soot/jimple/internal/JNopStmt.java
|
package soot.jimple.internal;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1999 Patrick Lam
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.List;
import soot.Unit;
import soot.UnitPrinter;
import soot.baf.Baf;
import soot.jimple.Jimple;
import soot.jimple.JimpleToBafContext;
import soot.jimple.NopStmt;
import soot.jimple.StmtSwitch;
import soot.util.Switch;
public class JNopStmt extends AbstractStmt implements NopStmt {
public JNopStmt() {
}
@Override
public Object clone() {
return new JNopStmt();
}
@Override
public String toString() {
return Jimple.NOP;
}
@Override
public void toString(UnitPrinter up) {
up.literal(Jimple.NOP);
}
@Override
public void apply(Switch sw) {
((StmtSwitch) sw).caseNopStmt(this);
}
@Override
public void convertToBaf(JimpleToBafContext context, List<Unit> out) {
Unit u = Baf.v().newNopInst();
u.addAllTagsOf(this);
out.add(u);
}
@Override
public boolean fallsThrough() {
return true;
}
@Override
public boolean branches() {
return false;
}
}
| 1,775
| 21.769231
| 72
|
java
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.