-
Notifications
You must be signed in to change notification settings - Fork 84
Interactive: improvements for chrony story #724
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 18 commits
0709d82
30c1d7a
11cc869
dd43200
1ba9590
f5c4e89
752d16c
180ed23
653d0bb
a4be262
f753df5
e10102e
4a8aa85
ed6b2e4
c5cf526
2b60af7
ea05ea8
59f7343
577f6f3
76f9b29
84a98bf
b09b1fd
f2b8673
d5a0c27
a4db1a0
e6e33b2
6016835
22d6da8
a482bd1
67211c2
92c7ea4
94fd11f
c491dbb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -315,15 +315,18 @@ struct | |
| | _ -> failwith "Unmatched pattern." | ||
| in | ||
| let r = | ||
| if Queries.LS.is_top bls || Queries.LS.mem (dummyFunDec.svar, `NoOffset) bls | ||
| if Cil.isConstant b then false | ||
| else if Queries.LS.is_top bls || Queries.LS.mem (dummyFunDec.svar, `NoOffset) bls | ||
| then ((*Messages.warn "No PT-set: switching to types ";*) type_may_change_apt a ) | ||
| else Queries.LS.exists (lval_may_change_pt a) bls | ||
| in | ||
| (* if r | ||
| then (Messages.warn ~msg:("Kill " ^sprint 80 (Exp.pretty () a)^" because of "^sprint 80 (Exp.pretty () b)) (); r) | ||
| else (Messages.warn ~msg:("Keep " ^sprint 80 (Exp.pretty () a)^" because of "^sprint 80 (Exp.pretty () b)) (); r) | ||
| Messages.warn ~msg:(sprint 80 (Exp.pretty () b) ^" changed lvalues: "^sprint 80 (Queries.LS.pretty () bls)) (); | ||
| *) r | ||
| *) | ||
| if M.tracing then M.tracel "var_eq" "may_change %a %a = %B\n" CilType.Exp.pretty b CilType.Exp.pretty a r; | ||
| r | ||
|
|
||
| (* Remove elements, that would change if the given lval would change.*) | ||
| let remove_exp ask (e:exp) (st:D.t) : D.t = | ||
|
|
@@ -376,6 +379,12 @@ struct | |
| let st = | ||
| *) let lvt = unrollType @@ Cilfacade.typeOfLval lv in | ||
| (* Messages.warn ~msg:(sprint 80 (d_type () lvt)) (); *) | ||
| if M.tracing then ( | ||
| M.tracel "var_eq" "add_eq is_global_var %a = %B\n" d_plainlval lv (is_global_var ask (Lval lv) = Some false); | ||
| M.tracel "var_eq" "add_eq interesting %a = %B\n" d_plainexp rv (Exp.interesting rv); | ||
| M.tracel "var_eq" "add_eq is_global_var %a = %B\n" d_plainexp rv (is_global_var ask rv = Some false); | ||
| M.tracel "var_eq" "add_eq type %a = %B\n" d_plainlval lv ((isArithmeticType lvt && match lvt with | TFloat _ -> false | _ -> true ) || isPointerType lvt); | ||
| ); | ||
| if is_global_var ask (Lval lv) = Some false | ||
| && Exp.interesting rv | ||
| && is_global_var ask rv = Some false | ||
|
|
@@ -519,7 +528,10 @@ struct | |
| D.B.fold add es (Queries.ES.empty ()) | ||
|
|
||
| let rec eq_set_clos e s = | ||
| match e with | ||
| if M.tracing then M.traceli "var_eq" "eq_set_clos %a\n" d_plainexp e; | ||
| let r = match e with | ||
| | BinOp ((PlusPI | IndexPI), e1, e2, _) -> | ||
| eq_set_clos e1 s (* TODO: what about e2? add to some Index offset to all? *) | ||
|
||
| | SizeOf _ | ||
| | SizeOfE _ | ||
| | SizeOfStr _ | ||
|
|
@@ -541,6 +553,9 @@ struct | |
| Queries.ES.map (fun e -> CastE (t,e)) (eq_set_clos e s) | ||
| | Question _ -> failwith "Logical operations should be compiled away by CIL." | ||
| | _ -> failwith "Unmatched pattern." | ||
| in | ||
| if M.tracing then M.traceu "var_eq" "eq_set_clos %a = %a\n" d_plainexp e Queries.ES.pretty r; | ||
| r | ||
|
|
||
|
|
||
| let query ctx (type a) (x: a Queries.t): a Queries.result = | ||
|
|
@@ -550,6 +565,7 @@ struct | |
| | Queries.EqualSet e -> | ||
| let r = eq_set_clos e ctx.local in | ||
| (* Messages.warn ~msg:("equset of "^(sprint 80 (d_exp () e))^" is "^(Queries.ES.short 80 r)) (); *) | ||
| if M.tracing then M.tracel "var_eq" "equalset %a = %a\n" d_plainexp e Queries.ES.pretty r; | ||
| r | ||
| | _ -> Queries.Result.top x | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| // PARAM: --disable ana.mutex.disjoint_types --set ana.activated[+] "'var_eq'" --set ana.activated[+] "'symb_locks'" | ||
| // copy of 06/02 with additional index accesses | ||
| #include<pthread.h> | ||
| #include<stdio.h> | ||
|
|
||
| struct cache_entry { | ||
| int refs; | ||
| pthread_mutex_t refs_mutex; | ||
| } cache[10]; | ||
|
|
||
| void cache_entry_addref(struct cache_entry *entry) { | ||
| pthread_mutex_lock(&entry->refs_mutex); | ||
| entry->refs++; // NORACE | ||
| (*entry).refs++; // NORACE | ||
| entry[0].refs++; // NORACE | ||
| pthread_mutex_unlock(&entry->refs_mutex); | ||
| } | ||
|
|
||
| void *t_fun(void *arg) { | ||
| int i; | ||
| for(i=0; i<10; i++) | ||
| cache_entry_addref(&cache[i]); // NORACE | ||
| return NULL; | ||
| } | ||
|
|
||
| int main () { | ||
| for (int i = 0; i < 10; i++) | ||
| pthread_mutex_init(&cache[i].refs_mutex, NULL); | ||
|
|
||
| int i; | ||
| pthread_t t1; | ||
| pthread_create(&t1, NULL, t_fun, NULL); | ||
| for(i=0; i<10; i++) | ||
| cache_entry_addref(&cache[i]); // NORACE | ||
| return 0; | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.