Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 14378ee

Browse files
committed
Java/C++/C#: Remove some unbind() calls from shared data flow implementation
1 parent a0c834c commit 14378ee

18 files changed

Lines changed: 252 additions & 234 deletions

File tree

cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl.qll

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ private predicate nodeCandFwd1(Node node, boolean stored, Configuration config)
259259
// read
260260
exists(Content f |
261261
nodeCandFwd1Read(f, node, config) and
262-
storeCandFwd1(f, unbind(config)) and
262+
storeCandFwd1(f, config) and
263263
(stored = false or stored = true) and
264264
not inBarrier(node, config)
265265
)
@@ -286,7 +286,7 @@ private predicate nodeCandFwd1(Node node, boolean stored, Configuration config)
286286
)
287287
}
288288

289-
pragma[noinline]
289+
pragma[nomagic]
290290
private predicate nodeCandFwd1Read(Content f, Node node, Configuration config) {
291291
exists(Node mid |
292292
nodeCandFwd1(mid, true, config) and
@@ -347,7 +347,7 @@ private predicate nodeCand1(Node node, boolean stored, Configuration config) {
347347
// store
348348
exists(Content f |
349349
nodeCand1Store(f, node, config) and
350-
readCand1(f, unbind(config)) and
350+
readCand1(f, config) and
351351
(stored = false or stored = true)
352352
)
353353
or
@@ -395,7 +395,7 @@ private predicate readCand1(Content f, Configuration config) {
395395
)
396396
}
397397

398-
pragma[noinline]
398+
pragma[nomagic]
399399
private predicate nodeCand1Store(Content f, Node node, Configuration config) {
400400
exists(Node mid |
401401
nodeCand1(mid, true, config) and
@@ -667,7 +667,7 @@ private predicate nodeCandFwd2(Node node, boolean fromArg, boolean stored, Confi
667667
// read
668668
exists(Content f |
669669
nodeCandFwd2Read(f, node, fromArg, config) and
670-
storeCandFwd2(f, unbind(config)) and
670+
storeCandFwd2(f, config) and
671671
(stored = false or stored = true)
672672
)
673673
or
@@ -701,7 +701,7 @@ private predicate storeCandFwd2(Content f, Configuration config) {
701701
)
702702
}
703703

704-
pragma[noinline]
704+
pragma[nomagic]
705705
private predicate nodeCandFwd2Read(Content f, Node node, boolean fromArg, Configuration config) {
706706
exists(Node mid |
707707
nodeCandFwd2(mid, fromArg, true, config) and
@@ -749,7 +749,7 @@ private predicate nodeCand2(Node node, boolean toReturn, boolean stored, Configu
749749
// store
750750
exists(Content f |
751751
nodeCand2Store(f, node, toReturn, config) and
752-
readCand2(f, unbind(config)) and
752+
readCand2(f, config) and
753753
(stored = false or stored = true)
754754
)
755755
or
@@ -803,7 +803,7 @@ pragma[nomagic]
803803
private predicate storeCand(Content f, Configuration conf) {
804804
exists(Node node |
805805
nodeCand2Store(f, node, _, conf) and
806-
nodeCand2(node, _, _, unbind(conf))
806+
nodeCand2(node, _, _, conf)
807807
)
808808
}
809809

@@ -1041,9 +1041,9 @@ private predicate flowCandFwd0(Node node, boolean fromArg, AccessPathFront apf,
10411041
)
10421042
or
10431043
exists(Content f, AccessPathFront apf0 |
1044-
flowCandFwdRead(f, node, apf0, fromArg, config) and
1044+
flowCandFwdRead(f, node, fromArg, apf0, config) and
10451045
apf0.headUsesContent(f) and
1046-
consCandFwd(f, apf, unbind(config))
1046+
consCandFwd(f, apf, config)
10471047
)
10481048
}
10491049

@@ -1058,9 +1058,9 @@ private predicate consCandFwd(Content f, AccessPathFront apf, Configuration conf
10581058
)
10591059
}
10601060

1061-
pragma[noinline]
1061+
pragma[nomagic]
10621062
private predicate flowCandFwdRead(
1063-
Content f, Node node, AccessPathFront apf, boolean fromArg, Configuration config
1063+
Content f, Node node, boolean fromArg, AccessPathFront apf, Configuration config
10641064
) {
10651065
exists(Node mid |
10661066
flowCandFwd(mid, fromArg, apf, config) and
@@ -1159,7 +1159,7 @@ private predicate flowCandRead(
11591159
)
11601160
}
11611161

1162-
pragma[noinline]
1162+
pragma[nomagic]
11631163
private predicate flowCandStore(
11641164
Node node, Content f, boolean toReturn, AccessPathFront apf0, Configuration config
11651165
) {
@@ -1694,6 +1694,7 @@ private predicate pathStep(PathNodeMid mid, Node node, CallContext cc, AccessPat
16941694
valuePathThroughCallable(mid, node, cc) and ap = mid.getAp()
16951695
}
16961696

1697+
pragma[noinline]
16971698
private predicate contentReadStep(PathNodeMid mid, Node node, AccessPath ap) {
16981699
exists(Content f, AccessPath ap0 |
16991700
ap0 = mid.getAp() and

cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl2.qll

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ private predicate nodeCandFwd1(Node node, boolean stored, Configuration config)
259259
// read
260260
exists(Content f |
261261
nodeCandFwd1Read(f, node, config) and
262-
storeCandFwd1(f, unbind(config)) and
262+
storeCandFwd1(f, config) and
263263
(stored = false or stored = true) and
264264
not inBarrier(node, config)
265265
)
@@ -286,7 +286,7 @@ private predicate nodeCandFwd1(Node node, boolean stored, Configuration config)
286286
)
287287
}
288288

289-
pragma[noinline]
289+
pragma[nomagic]
290290
private predicate nodeCandFwd1Read(Content f, Node node, Configuration config) {
291291
exists(Node mid |
292292
nodeCandFwd1(mid, true, config) and
@@ -347,7 +347,7 @@ private predicate nodeCand1(Node node, boolean stored, Configuration config) {
347347
// store
348348
exists(Content f |
349349
nodeCand1Store(f, node, config) and
350-
readCand1(f, unbind(config)) and
350+
readCand1(f, config) and
351351
(stored = false or stored = true)
352352
)
353353
or
@@ -395,7 +395,7 @@ private predicate readCand1(Content f, Configuration config) {
395395
)
396396
}
397397

398-
pragma[noinline]
398+
pragma[nomagic]
399399
private predicate nodeCand1Store(Content f, Node node, Configuration config) {
400400
exists(Node mid |
401401
nodeCand1(mid, true, config) and
@@ -667,7 +667,7 @@ private predicate nodeCandFwd2(Node node, boolean fromArg, boolean stored, Confi
667667
// read
668668
exists(Content f |
669669
nodeCandFwd2Read(f, node, fromArg, config) and
670-
storeCandFwd2(f, unbind(config)) and
670+
storeCandFwd2(f, config) and
671671
(stored = false or stored = true)
672672
)
673673
or
@@ -701,7 +701,7 @@ private predicate storeCandFwd2(Content f, Configuration config) {
701701
)
702702
}
703703

704-
pragma[noinline]
704+
pragma[nomagic]
705705
private predicate nodeCandFwd2Read(Content f, Node node, boolean fromArg, Configuration config) {
706706
exists(Node mid |
707707
nodeCandFwd2(mid, fromArg, true, config) and
@@ -749,7 +749,7 @@ private predicate nodeCand2(Node node, boolean toReturn, boolean stored, Configu
749749
// store
750750
exists(Content f |
751751
nodeCand2Store(f, node, toReturn, config) and
752-
readCand2(f, unbind(config)) and
752+
readCand2(f, config) and
753753
(stored = false or stored = true)
754754
)
755755
or
@@ -803,7 +803,7 @@ pragma[nomagic]
803803
private predicate storeCand(Content f, Configuration conf) {
804804
exists(Node node |
805805
nodeCand2Store(f, node, _, conf) and
806-
nodeCand2(node, _, _, unbind(conf))
806+
nodeCand2(node, _, _, conf)
807807
)
808808
}
809809

@@ -1041,9 +1041,9 @@ private predicate flowCandFwd0(Node node, boolean fromArg, AccessPathFront apf,
10411041
)
10421042
or
10431043
exists(Content f, AccessPathFront apf0 |
1044-
flowCandFwdRead(f, node, apf0, fromArg, config) and
1044+
flowCandFwdRead(f, node, fromArg, apf0, config) and
10451045
apf0.headUsesContent(f) and
1046-
consCandFwd(f, apf, unbind(config))
1046+
consCandFwd(f, apf, config)
10471047
)
10481048
}
10491049

@@ -1058,9 +1058,9 @@ private predicate consCandFwd(Content f, AccessPathFront apf, Configuration conf
10581058
)
10591059
}
10601060

1061-
pragma[noinline]
1061+
pragma[nomagic]
10621062
private predicate flowCandFwdRead(
1063-
Content f, Node node, AccessPathFront apf, boolean fromArg, Configuration config
1063+
Content f, Node node, boolean fromArg, AccessPathFront apf, Configuration config
10641064
) {
10651065
exists(Node mid |
10661066
flowCandFwd(mid, fromArg, apf, config) and
@@ -1159,7 +1159,7 @@ private predicate flowCandRead(
11591159
)
11601160
}
11611161

1162-
pragma[noinline]
1162+
pragma[nomagic]
11631163
private predicate flowCandStore(
11641164
Node node, Content f, boolean toReturn, AccessPathFront apf0, Configuration config
11651165
) {
@@ -1694,6 +1694,7 @@ private predicate pathStep(PathNodeMid mid, Node node, CallContext cc, AccessPat
16941694
valuePathThroughCallable(mid, node, cc) and ap = mid.getAp()
16951695
}
16961696

1697+
pragma[noinline]
16971698
private predicate contentReadStep(PathNodeMid mid, Node node, AccessPath ap) {
16981699
exists(Content f, AccessPath ap0 |
16991700
ap0 = mid.getAp() and

cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl3.qll

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ private predicate nodeCandFwd1(Node node, boolean stored, Configuration config)
259259
// read
260260
exists(Content f |
261261
nodeCandFwd1Read(f, node, config) and
262-
storeCandFwd1(f, unbind(config)) and
262+
storeCandFwd1(f, config) and
263263
(stored = false or stored = true) and
264264
not inBarrier(node, config)
265265
)
@@ -286,7 +286,7 @@ private predicate nodeCandFwd1(Node node, boolean stored, Configuration config)
286286
)
287287
}
288288

289-
pragma[noinline]
289+
pragma[nomagic]
290290
private predicate nodeCandFwd1Read(Content f, Node node, Configuration config) {
291291
exists(Node mid |
292292
nodeCandFwd1(mid, true, config) and
@@ -347,7 +347,7 @@ private predicate nodeCand1(Node node, boolean stored, Configuration config) {
347347
// store
348348
exists(Content f |
349349
nodeCand1Store(f, node, config) and
350-
readCand1(f, unbind(config)) and
350+
readCand1(f, config) and
351351
(stored = false or stored = true)
352352
)
353353
or
@@ -395,7 +395,7 @@ private predicate readCand1(Content f, Configuration config) {
395395
)
396396
}
397397

398-
pragma[noinline]
398+
pragma[nomagic]
399399
private predicate nodeCand1Store(Content f, Node node, Configuration config) {
400400
exists(Node mid |
401401
nodeCand1(mid, true, config) and
@@ -667,7 +667,7 @@ private predicate nodeCandFwd2(Node node, boolean fromArg, boolean stored, Confi
667667
// read
668668
exists(Content f |
669669
nodeCandFwd2Read(f, node, fromArg, config) and
670-
storeCandFwd2(f, unbind(config)) and
670+
storeCandFwd2(f, config) and
671671
(stored = false or stored = true)
672672
)
673673
or
@@ -701,7 +701,7 @@ private predicate storeCandFwd2(Content f, Configuration config) {
701701
)
702702
}
703703

704-
pragma[noinline]
704+
pragma[nomagic]
705705
private predicate nodeCandFwd2Read(Content f, Node node, boolean fromArg, Configuration config) {
706706
exists(Node mid |
707707
nodeCandFwd2(mid, fromArg, true, config) and
@@ -749,7 +749,7 @@ private predicate nodeCand2(Node node, boolean toReturn, boolean stored, Configu
749749
// store
750750
exists(Content f |
751751
nodeCand2Store(f, node, toReturn, config) and
752-
readCand2(f, unbind(config)) and
752+
readCand2(f, config) and
753753
(stored = false or stored = true)
754754
)
755755
or
@@ -803,7 +803,7 @@ pragma[nomagic]
803803
private predicate storeCand(Content f, Configuration conf) {
804804
exists(Node node |
805805
nodeCand2Store(f, node, _, conf) and
806-
nodeCand2(node, _, _, unbind(conf))
806+
nodeCand2(node, _, _, conf)
807807
)
808808
}
809809

@@ -1041,9 +1041,9 @@ private predicate flowCandFwd0(Node node, boolean fromArg, AccessPathFront apf,
10411041
)
10421042
or
10431043
exists(Content f, AccessPathFront apf0 |
1044-
flowCandFwdRead(f, node, apf0, fromArg, config) and
1044+
flowCandFwdRead(f, node, fromArg, apf0, config) and
10451045
apf0.headUsesContent(f) and
1046-
consCandFwd(f, apf, unbind(config))
1046+
consCandFwd(f, apf, config)
10471047
)
10481048
}
10491049

@@ -1058,9 +1058,9 @@ private predicate consCandFwd(Content f, AccessPathFront apf, Configuration conf
10581058
)
10591059
}
10601060

1061-
pragma[noinline]
1061+
pragma[nomagic]
10621062
private predicate flowCandFwdRead(
1063-
Content f, Node node, AccessPathFront apf, boolean fromArg, Configuration config
1063+
Content f, Node node, boolean fromArg, AccessPathFront apf, Configuration config
10641064
) {
10651065
exists(Node mid |
10661066
flowCandFwd(mid, fromArg, apf, config) and
@@ -1159,7 +1159,7 @@ private predicate flowCandRead(
11591159
)
11601160
}
11611161

1162-
pragma[noinline]
1162+
pragma[nomagic]
11631163
private predicate flowCandStore(
11641164
Node node, Content f, boolean toReturn, AccessPathFront apf0, Configuration config
11651165
) {
@@ -1694,6 +1694,7 @@ private predicate pathStep(PathNodeMid mid, Node node, CallContext cc, AccessPat
16941694
valuePathThroughCallable(mid, node, cc) and ap = mid.getAp()
16951695
}
16961696

1697+
pragma[noinline]
16971698
private predicate contentReadStep(PathNodeMid mid, Node node, AccessPath ap) {
16981699
exists(Content f, AccessPath ap0 |
16991700
ap0 = mid.getAp() and

0 commit comments

Comments
 (0)