Commit db346db7 authored by Ralf Jung's avatar Ralf Jung

Merge branch 'master' into 'master'

generalized rdcss to arbitrary (unboxed) values

See merge request iris/examples!23
parents 9cbc4c7f 787af146
Pipeline #18177 passed with stage
in 6 minutes and 12 seconds
This diff is collapsed.
...@@ -15,28 +15,30 @@ Record atomic_rdcss {Σ} `{!heapG Σ, !gcG Σ} := AtomicRdcss { ...@@ -15,28 +15,30 @@ Record atomic_rdcss {Σ} `{!heapG Σ, !gcG Σ} := AtomicRdcss {
name_eqdec : EqDecision name; name_eqdec : EqDecision name;
name_countable : Countable name; name_countable : Countable name;
(* -- predicates -- *) (* -- predicates -- *)
is_rdcss (N : namespace) (γ : name) (v : val) : iProp Σ; is_rdcss (N : namespace) (γ : name) (l_n : loc) : iProp Σ;
rdcss_content (γ : name) (n : Z) : iProp Σ; rdcss_content (γ : name) (n : val) : iProp Σ;
(* -- predicate properties -- *) (* -- predicate properties -- *)
is_rdcss_persistent N γ v : Persistent (is_rdcss N γ v); is_rdcss_persistent N γ l_n : Persistent (is_rdcss N γ l_n);
rdcss_content_timeless γ n : Timeless (rdcss_content γ n); rdcss_content_timeless γ n : Timeless (rdcss_content γ n);
rdcss_content_exclusive γ n1 n2 : rdcss_content γ n1 - rdcss_content γ n2 - False; rdcss_content_exclusive γ n1 n2 : rdcss_content γ n1 - rdcss_content γ n2 - False;
(* -- operation specs -- *) (* -- operation specs -- *)
new_rdcss_spec N : new_rdcss_spec N (n : val):
N ## gcN gc_inv - N ## gcN gc_inv -
{{{ True }}} {{{ True }}}
new_rdcss #() new_rdcss n
{{{ lln γ, RET lln ; is_rdcss N γ lln rdcss_content γ 0 }}}; {{{ l_n γ, RET #l_n ; is_rdcss N γ l_n rdcss_content γ n }}};
rdcss_spec N γ v (lm : loc) (m1 n1 n2 : Z): rdcss_spec N γ (l_n l_m : loc) (m1 n1 n2 : val):
is_rdcss N γ v - val_is_unboxed m1
<<< (m n: Z), gc_mapsto lm #m rdcss_content γ n >>> val_is_unboxed (InjLV n1)
rdcss #lm v #m1 #n1 #n2 @((⊤∖↑N)∖↑gcN) is_rdcss N γ l_n -
<<< gc_mapsto lm #m rdcss_content γ (if decide (m = m1 n = n1) then n2 else n), RET #n >>>; <<< (m n: val), gc_mapsto l_m m rdcss_content γ n >>>
get_spec N γ v: rdcss #l_m #l_n m1 n1 n2 @((⊤∖↑N)∖↑gcN)
is_rdcss N γ v - <<< gc_mapsto l_m m rdcss_content γ (if decide (m = m1 n = n1) then n2 else n), RET n >>>;
<<< (n : Z), rdcss_content γ n >>> get_spec N γ (l_n : loc):
get v @(⊤∖↑N) is_rdcss N γ l_n -
<<< rdcss_content γ n, RET #n >>>; <<< (n : val), rdcss_content γ n >>>
get #l_n @(⊤∖↑N)
<<< rdcss_content γ n, RET n >>>;
}. }.
Arguments atomic_rdcss _ {_} {_}. Arguments atomic_rdcss _ {_} {_}.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment