Compare commits

...

4 Commits

Author SHA1 Message Date
alexet
81ea60e5f3 Fix java perf 1 2021-02-04 18:01:38 +00:00
alexet
3cb67db7cd Add nomagic for performance. 2021-02-04 16:10:58 +00:00
alexet
96d7601c30 Fix another issue 2021-01-29 15:15:59 +00:00
alexet
4a416533a8 Alway inline large predicate. 2021-01-28 14:54:00 +00:00
4 changed files with 9 additions and 7 deletions

View File

@@ -50,6 +50,7 @@ private predicate whitelist(string name) { name = "visit" }
* Method `m` has name `name`, number of parameters `numParams`
* and is declared in `t` or inherited from a supertype of `t`.
*/
pragma[nomagic]
private predicate candidateMethod(RefType t, Method m, string name, int numParam) {
exists(Method n | n.getSourceDeclaration() = m | t.inherits(n)) and
m.getName() = name and

View File

@@ -18,12 +18,11 @@ private predicate arrayIndexInLoop(IndexExpr arr, Variable base, Expr idx, ForSt
* operators, increments, decrements, type assertions, parentheses, sequence expressions,
* and assignments.
*/
private Expr unwrap(Expr e) {
result = e or
result = unwrap(e.(UpdateExpr).getOperand()) or
result = unwrap(e.(UnaryExpr).getOperand()) or
result = unwrap(e.(BinaryExpr).getAnOperand()) or
result = unwrap(e.getUnderlyingValue())
private Expr unwrap1Step(Expr e) {
result = e.(UpdateExpr).getOperand() or
result = e.(UnaryExpr).getOperand() or
result = e.(BinaryExpr).getAnOperand() or
result = e.getUnderlyingValue()
}
/**
@@ -33,7 +32,7 @@ private Expr unwrap(Expr e) {
*/
predicate unusedIndexVariable(RelationalComparison rel, Variable idx, Variable v) {
exists(ForStmt fs | fs.getTest() = rel |
unwrap(rel.getLesserOperand()) = idx.getAnAccess() and
unwrap1Step*(rel.getLesserOperand()) = idx.getAnAccess() and
rel.getGreaterOperand().(PropAccess).accesses(v.getAnAccess(), "length") and
forex(IndexExpr arr, Expr e | arrayIndexInLoop(arr, v, e, fs) | exists(e.getIntValue()))
)

View File

@@ -311,6 +311,7 @@ class ReachableBasicBlock extends BasicBlock {
*
* This predicate is reflexive: each reachable basic block dominates itself.
*/
pragma[inline]
predicate dominates(ReachableBasicBlock bb) {
bb = this or
strictlyDominates(bb)

View File

@@ -440,6 +440,7 @@ module AccessPath {
*
* Only has a result if there exists both a read and write of the access-path within `bb`.
*/
pragma[nomagic]
private ControlFlowNode rankedAccessPath(
ReachableBasicBlock bb, Root root, string path, int ranking, AccessPathKind type
) {