-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge commit 'f30eccd8b983809d71ec76609f6009fe5489b409' into #29
Conflicts: src/test/java/test/core/selfrunning/AbstractBoomerangTest.java
- Loading branch information
Showing
18 changed files
with
265 additions
and
398 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,7 @@ | |
ant.settings | ||
/target/ | ||
/testBin/ | ||
*.DS_Store | ||
*.DS_Store | ||
.classpath | ||
.project | ||
.settings/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
src/main/java/boomerang/allocationsitehandler/PrimitiveTypeAndReferenceType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
package boomerang.allocationsitehandler; | ||
|
||
import com.google.common.base.Optional; | ||
|
||
import boomerang.AliasFinder; | ||
import boomerang.accessgraph.AccessGraph; | ||
import boomerang.pointsofindirection.Alloc; | ||
import boomerang.pointsofindirection.AllocationSiteHandler; | ||
import boomerang.pointsofindirection.AllocationSiteHandlers; | ||
import soot.Value; | ||
import soot.jimple.AssignStmt; | ||
import soot.jimple.Constant; | ||
import soot.jimple.InstanceFieldRef; | ||
import soot.jimple.NewArrayExpr; | ||
import soot.jimple.NewExpr; | ||
import soot.jimple.NewMultiArrayExpr; | ||
import soot.jimple.NullConstant; | ||
|
||
public class PrimitiveTypeAndReferenceType implements AllocationSiteHandlers { | ||
|
||
private boolean isAllocationValue(Value val) { | ||
return (val instanceof NewExpr || val instanceof NewArrayExpr || val instanceof NewMultiArrayExpr | ||
|| val instanceof Constant); | ||
} | ||
|
||
@Override | ||
public Optional<AllocationSiteHandler> assignStatement(final AssignStmt stmt, final Value rightOp, | ||
final AccessGraph source) { | ||
if (!isAllocationValue(rightOp)) | ||
return Optional.absent(); | ||
|
||
if (source.getFieldCount() > 0 && !source.firstFieldMustMatch(AliasFinder.ARRAY_FIELD)) { | ||
return Optional.absent(); | ||
} | ||
if (source.getFieldCount() > 1 && source.firstFieldMustMatch(AliasFinder.ARRAY_FIELD)) | ||
return Optional.absent(); | ||
return Optional.<AllocationSiteHandler>of(new AllocationSiteHandler() { | ||
@Override | ||
public Alloc alloc() { | ||
return new Alloc(source, stmt, rightOp instanceof NullConstant); | ||
} | ||
}); | ||
} | ||
|
||
@Override | ||
public Optional<AllocationSiteHandler> arrayStoreStatement(final AssignStmt stmt, Value rightOp, | ||
final AccessGraph source) { | ||
if (!isAllocationValue(rightOp)) | ||
return Optional.absent(); | ||
return Optional.<AllocationSiteHandler>of(new AllocationSiteHandler() { | ||
@Override | ||
public Alloc alloc() { | ||
return new Alloc(source, stmt, false); | ||
} | ||
}); | ||
} | ||
|
||
@Override | ||
public Optional<AllocationSiteHandler> returnStmtViaCall(final AssignStmt assignedCallSite, | ||
final AccessGraph source, Value retOp) { | ||
if (!(retOp instanceof NullConstant)) | ||
return Optional.absent(); | ||
return Optional.<AllocationSiteHandler>of(new AllocationSiteHandler() { | ||
@Override | ||
public Alloc alloc() { | ||
return new Alloc(source, assignedCallSite, true); | ||
} | ||
}); | ||
} | ||
|
||
@Override | ||
public Optional<AllocationSiteHandler> fieldStoreStatement(final AssignStmt stmt, InstanceFieldRef fieldRef, | ||
Value rightOp, final AccessGraph source) { | ||
if (!(rightOp instanceof NullConstant)) | ||
return Optional.absent(); | ||
if (source.getFieldCount() != 1) { | ||
return Optional.absent(); | ||
} | ||
return Optional.<AllocationSiteHandler>of(new AllocationSiteHandler() { | ||
@Override | ||
public Alloc alloc() { | ||
return new Alloc(source, stmt, true); | ||
} | ||
}); | ||
} | ||
} |
85 changes: 85 additions & 0 deletions
85
src/main/java/boomerang/allocationsitehandler/ReferenceType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
package boomerang.allocationsitehandler; | ||
|
||
import com.google.common.base.Optional; | ||
|
||
import boomerang.AliasFinder; | ||
import boomerang.accessgraph.AccessGraph; | ||
import boomerang.pointsofindirection.Alloc; | ||
import boomerang.pointsofindirection.AllocationSiteHandler; | ||
import boomerang.pointsofindirection.AllocationSiteHandlers; | ||
import soot.Value; | ||
import soot.jimple.AssignStmt; | ||
import soot.jimple.InstanceFieldRef; | ||
import soot.jimple.NewArrayExpr; | ||
import soot.jimple.NewExpr; | ||
import soot.jimple.NewMultiArrayExpr; | ||
import soot.jimple.NullConstant; | ||
|
||
public class ReferenceType implements AllocationSiteHandlers { | ||
|
||
private boolean isAllocationValue(Value val) { | ||
return (val instanceof NewExpr || val instanceof NewArrayExpr || val instanceof NewMultiArrayExpr | ||
|| val instanceof NullConstant); | ||
} | ||
|
||
@Override | ||
public Optional<AllocationSiteHandler> assignStatement(final AssignStmt stmt, final Value rightOp, | ||
final AccessGraph source) { | ||
if (!isAllocationValue(rightOp)) | ||
return Optional.absent(); | ||
|
||
if (source.getFieldCount() > 0 && !source.firstFieldMustMatch(AliasFinder.ARRAY_FIELD)) { | ||
return Optional.absent(); | ||
} | ||
if (source.getFieldCount() > 1 && source.firstFieldMustMatch(AliasFinder.ARRAY_FIELD)) | ||
return Optional.absent(); | ||
return Optional.<AllocationSiteHandler>of(new AllocationSiteHandler() { | ||
@Override | ||
public Alloc alloc() { | ||
return new Alloc(source, stmt, rightOp instanceof NullConstant); | ||
} | ||
}); | ||
} | ||
|
||
@Override | ||
public Optional<AllocationSiteHandler> arrayStoreStatement(final AssignStmt stmt, Value rightOp, | ||
final AccessGraph source) { | ||
if (!isAllocationValue(rightOp)) | ||
return Optional.absent(); | ||
return Optional.<AllocationSiteHandler>of(new AllocationSiteHandler() { | ||
@Override | ||
public Alloc alloc() { | ||
return new Alloc(source, stmt, false); | ||
} | ||
}); | ||
} | ||
|
||
@Override | ||
public Optional<AllocationSiteHandler> returnStmtViaCall(final AssignStmt assignedCallSite, | ||
final AccessGraph source, Value retOp) { | ||
if (!(retOp instanceof NullConstant)) | ||
return Optional.absent(); | ||
return Optional.<AllocationSiteHandler>of(new AllocationSiteHandler() { | ||
@Override | ||
public Alloc alloc() { | ||
return new Alloc(source, assignedCallSite, true); | ||
} | ||
}); | ||
} | ||
|
||
@Override | ||
public Optional<AllocationSiteHandler> fieldStoreStatement(final AssignStmt stmt, InstanceFieldRef fieldRef, | ||
Value rightOp, final AccessGraph source) { | ||
if (!(rightOp instanceof NullConstant)) | ||
return Optional.absent(); | ||
if (source.getFieldCount() != 1) { | ||
return Optional.absent(); | ||
} | ||
return Optional.<AllocationSiteHandler>of(new AllocationSiteHandler() { | ||
@Override | ||
public Alloc alloc() { | ||
return new Alloc(source, stmt, true); | ||
} | ||
}); | ||
} | ||
} |
Oops, something went wrong.