Skip to content

Commit b58b89c

Browse files
committed
Merge branch 'master' into interactive
2 parents d56e9c8 + c55c2a9 commit b58b89c

File tree

10 files changed

+68
-22
lines changed

10 files changed

+68
-22
lines changed

.github/workflows/docker.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,18 @@ jobs:
3838
uses: actions/checkout@v3
3939

4040
- name: Set up Docker Buildx
41-
uses: docker/setup-buildx-action@v1 # needed for GitHub Actions Cache in build-push-action
41+
uses: docker/setup-buildx-action@v2 # needed for GitHub Actions Cache in build-push-action
4242

4343
- name: Log in to the Container registry
44-
uses: docker/login-action@v1
44+
uses: docker/login-action@v2
4545
with:
4646
registry: ${{ env.REGISTRY }}
4747
username: ${{ github.actor }}
4848
password: ${{ secrets.GITHUB_TOKEN }}
4949

5050
- name: Extract metadata (tags, labels) for Docker
5151
id: meta
52-
uses: docker/metadata-action@v3
52+
uses: docker/metadata-action@v4
5353
with:
5454
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
5555
tags: |
@@ -59,7 +59,7 @@ jobs:
5959
6060
- name: Build Docker image
6161
id: build
62-
uses: docker/build-push-action@v2
62+
uses: docker/build-push-action@v3
6363
with:
6464
context: .
6565
load: true # load into docker instead of immediately pushing
@@ -72,7 +72,7 @@ jobs:
7272
run: docker run --rm -v $(pwd):/data ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }} /data/tests/regression/04-mutex/01-simple_rc.c # run image by version in case multiple tags
7373

7474
- name: Push Docker image
75-
uses: docker/build-push-action@v2
75+
uses: docker/build-push-action@v3
7676
with:
7777
context: .
7878
push: true

.github/workflows/unlocked.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,11 @@ jobs:
169169
uses: actions/checkout@v3
170170

171171
- name: Set up Docker Buildx
172-
uses: docker/setup-buildx-action@v1 # needed for GitHub Actions Cache in build-push-action
172+
uses: docker/setup-buildx-action@v2 # needed for GitHub Actions Cache in build-push-action
173173

174174
- name: Build dev Docker image
175175
id: build
176-
uses: docker/build-push-action@v2
176+
uses: docker/build-push-action@v3
177177
with:
178178
context: .
179179
target: dev

src/framework/analyses.ml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,8 @@ type analyzed_data = {
451451
}
452452

453453
type increment_data = {
454+
server: bool;
455+
454456
old_data: analyzed_data option;
455457
new_file: Cil.file;
456458
changes: CompareCIL.change_info;
@@ -460,7 +462,8 @@ type increment_data = {
460462
restarting: VarQuery.t list;
461463
}
462464

463-
let empty_increment_data file = {
465+
let empty_increment_data ?(server=false) file = {
466+
server;
464467
old_data = None;
465468
new_file = file;
466469
changes = CompareCIL.empty_change_info ();

src/framework/control.ml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ open GobConfig
88
open Constraints
99

1010
module type S2S = functor (X : Spec) -> Spec
11-
(* gets Spec for current options *)
12-
let get_spec () : (module Spec) =
11+
12+
(* spec is lazy, so HConsed table in Hashcons lifters is preserved between analyses in server mode *)
13+
let spec_module: (module Spec) Lazy.t = lazy (
14+
GobConfig.building_spec := true;
1315
let open Batteries in
1416
(* apply functor F on module X if opt is true *)
1517
let lift opt (module F : S2S) (module X : Spec) = (module (val if opt then (module F (X)) else (module X) : Spec) : Spec) in
@@ -28,7 +30,14 @@ let get_spec () : (module Spec) =
2830
|> lift (get_bool "ana.opt.equal" && not (get_bool "ana.opt.hashcons")) (module OptEqual)
2931
|> lift (get_bool "ana.opt.hashcons") (module HashconsLifter)
3032
) in
33+
GobConfig.building_spec := false;
3134
(module S1)
35+
)
36+
37+
(** gets Spec for current options *)
38+
let get_spec (): (module Spec) =
39+
Lazy.force spec_module
40+
3241

3342
(** Given a [Cfg], a [Spec], and an [Inc], computes the solution to [MCP.Path] *)
3443
module AnalyzeCFG (Cfg:CfgBidir) (Spec:Spec) (Inc:Increment) =

src/maingoblint.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ let diff_and_rename current_file =
563563
| Some cil_file, Some solver_data -> Some ({cil_file; solver_data}: Analyses.analyzed_data)
564564
| _, _ -> None
565565
in
566-
{Analyses.changes = changes; restarting; old_data; new_file = current_file}
566+
{server = false; Analyses.changes = changes; restarting; old_data; new_file = current_file}
567567
in change_info
568568

569569
let () = (* signal for printing backtrace; other signals in Generic.SolverStats and Timeout *)

src/solvers/td3.ml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1185,7 +1185,19 @@ module WP =
11851185
* - If we destabilized a node with a call, we will also destabilize all vars of the called function. However, if we end up with the same state at the caller node, without hashcons we would only need to go over all vars in the function once to restabilize them since we have
11861186
* the old values, whereas with hashcons, we would get a context with a different tag, could not find the old value for that var, and have to recompute all vars in the function (without access to old values).
11871187
*)
1188-
if loaded && GobConfig.get_bool "ana.opt.hashcons" then (
1188+
if loaded && S.increment.server then (
1189+
data.rho <- HM.copy data.rho;
1190+
data.stable <- HM.copy data.stable;
1191+
data.wpoint <- HM.copy data.wpoint;
1192+
data.infl <- HM.copy data.infl;
1193+
data.side_infl <- HM.copy data.side_infl;
1194+
data.side_dep <- HM.copy data.side_dep;
1195+
(* data.st is immutable, no need to copy *)
1196+
data.var_messages <- HM.copy data.var_messages;
1197+
data.rho_write <- HM.map (fun x w -> HM.copy w) data.rho_write; (* map copies outer HM *)
1198+
data.dep <- HM.copy data.dep;
1199+
)
1200+
else if loaded && GobConfig.get_bool "ana.opt.hashcons" then (
11891201
let rho' = HM.create (HM.length data.rho) in
11901202
HM.iter (fun k v ->
11911203
(* call hashcons on contexts and abstract values; results in new tags *)

src/util/gobConfig.ml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ exception ConfigError of string
2828
(* Phase of the analysis (moved from GoblintUtil b/c of circular build...) *)
2929
let phase = ref 0
3030

31+
let building_spec = ref false
32+
3133

3234
module Validator = JsonSchema.Validator (struct let schema = Options.schema end)
3335
module ValidatorRequireAll = JsonSchema.Validator (struct let schema = Options.require_all end)
@@ -303,10 +305,16 @@ struct
303305
in
304306
drop memo_int; drop memo_bool; drop memo_string; drop memo_list
305307

306-
let get_int = memo_int.get
307-
let get_bool = memo_bool.get
308-
let get_string = memo_string.get
309-
let get_list = memo_list.get
308+
let wrap_get f x =
309+
(* self-observe options, which Spec construction depends on *)
310+
if !building_spec && Tracing.tracing then Tracing.trace "config" "get during building_spec: %s\n" x;
311+
(* TODO: blacklist such building_spec option from server mode modification since it will have no effect (spec is already built) *)
312+
f x
313+
314+
let get_int = wrap_get memo_int.get
315+
let get_bool = wrap_get memo_bool.get
316+
let get_string = wrap_get memo_string.get
317+
let get_list = wrap_get memo_list.get
310318
let get_string_list = List.map Yojson.Safe.Util.to_string % get_list
311319

312320
(** Helper functions for writing values. *)

src/util/server.ml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,13 @@ let increment_data (s: t) file reparsed = match !Serialize.server_solver_data wi
147147
let old_data = Some { Analyses.cil_file = s_file; solver_data } in
148148
s.max_ids <- UpdateCil.update_ids s_file s.max_ids file changes;
149149
(* TODO: get globals for restarting from config *)
150-
{ Analyses.changes; old_data; new_file = file; restarting = [] }, false
150+
{ server = true; Analyses.changes; old_data; new_file = file; restarting = [] }, false
151151
| Some solver_data ->
152152
let changes = virtual_changes file in
153153
let old_data = Some { Analyses.cil_file = file; solver_data } in
154154
(* TODO: get globals for restarting from config *)
155-
{ Analyses.changes; old_data; new_file = file; restarting = [] }, false
156-
| _ -> Analyses.empty_increment_data file, true
155+
{ server = true; Analyses.changes; old_data; new_file = file; restarting = [] }, false
156+
| _ -> Analyses.empty_increment_data ~server:true file, true
157157

158158
let analyze ?(reset=false) (s: t) =
159159
Messages.Table.(MH.clear messages_table);
@@ -194,7 +194,6 @@ let () =
194194
analyze serve ~reset;
195195
{status = if !Goblintutil.verified = Some false then VerifyError else Success}
196196
with Sys.Break ->
197-
assert (GobConfig.get_bool "ana.opt.hashcons"); (* TODO: TD3 doesn't copy input solver data, so will modify it in place and screw up Serialize.server_solver_data accidentally *)
198197
{status = Aborted}
199198
end);
200199

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// SKIP: Low Priority -- this compiles with warnings, but goblint crashes.
2+
#include <pthread.h>
3+
4+
int data[10];
5+
6+
void *t_fun(int i) {
7+
int *x = &data[i];
8+
return NULL;
9+
}
10+
11+
int main() {
12+
pthread_t id;
13+
int n = 0;
14+
pthread_create(&id, NULL, t_fun, (int*) n);
15+
return 0;
16+
}

tests/regression/05-lval_ls/18-website.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SKIP PARAM: --set ana.activated[+] symb_locks --set ana.activated[+] region --set ana.activated[+] var_eq --enable exp.region-offsets
1+
// PARAM: --set ana.activated[+] symb_locks
22
#include <pthread.h>
33

44
int data[10];
@@ -31,4 +31,3 @@ int main() {
3131

3232
return 0;
3333
}
34-

0 commit comments

Comments
 (0)