java: implement SCC contraction of the call graph

Our monitor analysis would be fooled by cycles in the call graph,
since it required all edges on a path to a conflicting access to be either
 - targetting a method where the access is monitored (recursively) or
 - monitored locally, that is the call is monitored in the calling method
For access to be monitored (first case) all outgoing edges (towards an access) need
to satisfy this property. For a loop, that is too strong, only edges out of the loop
actually need to be protected. This led to FPs.
This commit is contained in:
yoff
2025-05-20 14:12:45 +02:00
parent 5b30153113
commit 096d5f2a56
3 changed files with 107 additions and 12 deletions

View File

@@ -12,7 +12,7 @@ public class LoopyCallGraph {
public void entry() {
if (random.nextBoolean()) {
increase(); // this looks like an unprotected path to a call to dec()
increase(); // this could look like an unprotected path to a call to dec()
} else {
lock.lock();
dec();
@@ -22,9 +22,9 @@ public class LoopyCallGraph {
private void increase() {
lock.lock();
count = 10; //$ SPURIOUS: Alert
count = 10;
lock.unlock();
entry(); // this looks like an unprotected path to a call to dec()
entry(); // this could look like an unprotected path to a call to dec()
}
private void dec() {