Skip to content

Commit f106225

Browse files
Merge branch 'interactive' into interactive_postsolver_pruning
2 parents 50fed60 + db84ba3 commit f106225

10 files changed

+176
-4
lines changed

src/solvers/td3.ml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,9 @@ module WP =
548548

549549
start_event ();
550550

551+
(* reluctantly unchanged return nodes to additionally query for postsolving to get warnings, etc. *)
552+
let reluctant_vs: S.Var.t list ref = ref [] in
553+
551554
if GobConfig.get_bool "incremental.load" then (
552555
let c = S.increment.changes in
553556
List.(Printf.printf "change_info = { unchanged = %d; changed = %d; added = %d; removed = %d }\n" (length c.unchanged) (length c.changed) (length c.added) (length c.removed));
@@ -745,7 +748,7 @@ module WP =
745748
print_endline "Removing data for changed and removed functions...";
746749
let delete_marked s = HM.iter (fun k _ -> HM.remove s k) marked_for_deletion in
747750
delete_marked rho;
748-
delete_marked infl;
751+
delete_marked infl; (* TODO: delete from inner sets? *)
749752
delete_marked wpoint;
750753
delete_marked dep;
751754

@@ -835,8 +838,15 @@ module WP =
835838
);
836839

837840
delete_marked stable;
838-
delete_marked side_dep;
839-
delete_marked side_infl;
841+
delete_marked side_dep; (* TODO: delete from inner sets? *)
842+
delete_marked side_infl; (* TODO: delete from inner sets? *)
843+
844+
(* delete from incremental postsolving/warning structures to remove spurious warnings *)
845+
delete_marked superstable;
846+
delete_marked var_messages;
847+
delete_marked rho_write;
848+
HM.iter (fun x w -> delete_marked w) rho_write;
849+
840850
print_data data "Data after clean-up";
841851

842852
(* TODO: reluctant doesn't call destabilize on removed functions or old copies of modified functions (e.g. after removing write), so those globals don't get restarted *)
@@ -854,6 +864,10 @@ module WP =
854864
destabilize x;
855865
HM.replace stable x ()
856866
)
867+
else (
868+
print_endline "Destabilization not required...";
869+
reluctant_vs := x :: !reluctant_vs
870+
)
857871
) old_ret;
858872

859873
print_endline "Final solve..."
@@ -1124,7 +1138,7 @@ module WP =
11241138

11251139
let module Post = PostSolver.MakeIncrList (MakeIncrListArg) in
11261140

1127-
Post.post st vs rho;
1141+
Post.post st (!reluctant_vs @ vs) rho;
11281142

11291143
print_data data "Data after postsolve";
11301144

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#include <pthread.h>
2+
#include <stdio.h>
3+
4+
int myglobal;
5+
pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER;
6+
pthread_mutex_t mutex2 = PTHREAD_MUTEX_INITIALIZER;
7+
8+
void *t_fun(void *arg) {
9+
pthread_mutex_lock(&mutex1);
10+
myglobal=myglobal+1; // RACE!
11+
pthread_mutex_unlock(&mutex1);
12+
return NULL;
13+
}
14+
15+
int main(void) {
16+
pthread_t id;
17+
pthread_create(&id, NULL, t_fun, NULL);
18+
pthread_mutex_lock(&mutex2);
19+
myglobal=myglobal+1; // RACE!
20+
pthread_mutex_unlock(&mutex2);
21+
pthread_join (id, NULL);
22+
return 0;
23+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"incremental": {
3+
"restart": {
4+
"sided": {
5+
"enabled": false
6+
}
7+
},
8+
"reluctant": {
9+
"on": true
10+
}
11+
}
12+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
--- tests/incremental/13-restart-write/06-mutex-simple-reluctant.c
2+
+++ tests/incremental/13-restart-write/06-mutex-simple-reluctant.c
3+
@@ -7,7 +7,7 @@ pthread_mutex_t mutex2 = PTHREAD_MUTEX_INITIALIZER;
4+
5+
void *t_fun(void *arg) {
6+
pthread_mutex_lock(&mutex1);
7+
- myglobal=myglobal+1; // RACE!
8+
+ myglobal=myglobal+1; // NORACE
9+
pthread_mutex_unlock(&mutex1);
10+
return NULL;
11+
}
12+
@@ -15,9 +15,9 @@ void *t_fun(void *arg) {
13+
int main(void) {
14+
pthread_t id;
15+
pthread_create(&id, NULL, t_fun, NULL);
16+
- pthread_mutex_lock(&mutex2);
17+
- myglobal=myglobal+1; // RACE!
18+
- pthread_mutex_unlock(&mutex2);
19+
+ pthread_mutex_lock(&mutex1);
20+
+ myglobal=myglobal+1; // NORACE
21+
+ pthread_mutex_unlock(&mutex1);
22+
pthread_join (id, NULL);
23+
return 0;
24+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#include <pthread.h>
2+
#include <stdio.h>
3+
4+
int myglobal;
5+
pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER;
6+
pthread_mutex_t mutex2 = PTHREAD_MUTEX_INITIALIZER;
7+
8+
void *t_fun(void *arg) {
9+
pthread_mutex_lock(&mutex1);
10+
myglobal=myglobal+1; // RACE!
11+
pthread_mutex_unlock(&mutex1);
12+
return NULL;
13+
}
14+
15+
int main(void) {
16+
pthread_t id;
17+
pthread_create(&id, NULL, t_fun, NULL);
18+
pthread_mutex_lock(&mutex2);
19+
myglobal=myglobal+1; // RACE!
20+
pthread_mutex_unlock(&mutex2);
21+
pthread_join (id, NULL);
22+
return 0;
23+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"incremental": {
3+
"restart": {
4+
"sided": {
5+
"enabled": false
6+
}
7+
},
8+
"reluctant": {
9+
"on": true
10+
}
11+
}
12+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- tests/incremental/13-restart-write/07-mutex-simple-reluctant2.c
2+
+++ tests/incremental/13-restart-write/07-mutex-simple-reluctant2.c
3+
@@ -7,7 +7,7 @@ pthread_mutex_t mutex2 = PTHREAD_MUTEX_INITIALIZER;
4+
5+
void *t_fun(void *arg) {
6+
pthread_mutex_lock(&mutex1);
7+
- myglobal=myglobal+1; // RACE!
8+
+ myglobal=myglobal+2; // RACE!
9+
pthread_mutex_unlock(&mutex1);
10+
return NULL;
11+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#include <pthread.h>
2+
#include <stdio.h>
3+
4+
int myglobal;
5+
pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER;
6+
pthread_mutex_t mutex2 = PTHREAD_MUTEX_INITIALIZER;
7+
8+
void *t_fun(void *arg) {
9+
pthread_mutex_lock(&mutex1);
10+
pthread_mutex_unlock(&mutex1);
11+
return NULL;
12+
}
13+
14+
int main(void) {
15+
pthread_t id;
16+
pthread_create(&id, NULL, t_fun, NULL);
17+
pthread_mutex_lock(&mutex2);
18+
myglobal=myglobal+1; // NORACE
19+
pthread_mutex_unlock(&mutex2);
20+
pthread_join (id, NULL);
21+
return 0;
22+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"incremental": {
3+
"restart": {
4+
"sided": {
5+
"enabled": false
6+
}
7+
},
8+
"reluctant": {
9+
"on": true
10+
}
11+
}
12+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--- tests/incremental/13-restart-write/08-mutex-simple-reluctant3.c
2+
+++ tests/incremental/13-restart-write/08-mutex-simple-reluctant3.c
3+
@@ -7,6 +7,7 @@ pthread_mutex_t mutex2 = PTHREAD_MUTEX_INITIALIZER;
4+
5+
void *t_fun(void *arg) {
6+
pthread_mutex_lock(&mutex1);
7+
+ myglobal=myglobal+1; // RACE!
8+
pthread_mutex_unlock(&mutex1);
9+
return NULL;
10+
}
11+
@@ -15,7 +16,7 @@ int main(void) {
12+
pthread_t id;
13+
pthread_create(&id, NULL, t_fun, NULL);
14+
pthread_mutex_lock(&mutex2);
15+
- myglobal=myglobal+1; // NORACE
16+
+ myglobal=myglobal+1; // RACE!
17+
pthread_mutex_unlock(&mutex2);
18+
pthread_join (id, NULL);
19+
return 0;

0 commit comments

Comments
 (0)