[scheduler][callgraph] only load defined procs

Summary:
To ease scheduling, it would be best to only load the procnames of procedures that are (a) defined and (b) reachable from the modified files. The frontends play various games with the DB properties:
- In Clang all methods have a CFG even if they are undefined. Also, looking for non-NULL CFG rows in the DB brings up methods unreachable from modified files (?).
- In Java, some procedures have NULL CFGs. In addition, some of those have `attr_kind!=0`.

We only load those procedures that have both non-NULL CFGs and `attr_kind!=0`. That seems to give meaningful numbers, esp. wrt reachable procedures from files.

Reviewed By: jberdine

Differential Revision: D20068376

fbshipit-source-id: 992b65b4a
master
Nikos Gorogiannis 5 years ago committed by Facebook Github Bot
parent 7a0be26596
commit 3f4458361c

@ -19,7 +19,11 @@ let build_from_captured_procs g =
IdMap.add pname_tbl pname pname ; pname IdMap.add pname_tbl pname pname ; pname
in in
let db = ResultsDatabase.get_database () in let db = ResultsDatabase.get_database () in
let stmt = Sqlite3.prepare db "SELECT proc_name, callees FROM procedures" in (* only load procedure info for those we have a CFG *)
let stmt =
Sqlite3.prepare db
"SELECT proc_name, callees FROM procedures WHERE cfg IS NOT NULL and attr_kind != 0"
in
SqliteUtils.result_fold_rows db ~log:"creating call graph" stmt ~init:() ~f:(fun () stmt -> SqliteUtils.result_fold_rows db ~log:"creating call graph" stmt ~init:() ~f:(fun () stmt ->
let proc_name = Sqlite3.column stmt 0 |> Procname.SQLite.deserialize |> hashcons_pname in let proc_name = Sqlite3.column stmt 0 |> Procname.SQLite.deserialize |> hashcons_pname in
let callees = let callees =

Loading…
Cancel
Save