Commit 85953ff4 authored by Gaurav Parthasarathy's avatar Gaurav Parthasarathy

generalized rdcss to arbitrary (unboxed) values

For the expected value at the A location we require that it is unboxed and for the expected value n1 at the B location we require that [InjLV n1] is unboxed.
parent 9ef37d07
This diff is collapsed.
...@@ -16,27 +16,27 @@ Record atomic_rdcss {Σ} `{!heapG Σ, !gcG Σ} := AtomicRdcss { ...@@ -16,27 +16,27 @@ Record atomic_rdcss {Σ} `{!heapG Σ, !gcG Σ} := AtomicRdcss {
name_countable : Countable name; name_countable : Countable name;
(* -- predicates -- *) (* -- predicates -- *)
is_rdcss (N : namespace) (γ : name) (v : val) : iProp Σ; is_rdcss (N : namespace) (γ : name) (v : val) : 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 γ v : Persistent (is_rdcss N γ v);
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 (init_v : val):
N ## gcN gc_inv - N ## gcN gc_inv -
{{{ True }}} {{{ True }}}
new_rdcss #() new_rdcss init_v
{{{ lln γ, RET lln ; is_rdcss N γ lln rdcss_content γ 0 }}}; {{{ ln γ, RET ln ; is_rdcss N γ ln rdcss_content γ init_v }}};
rdcss_spec N γ v (lm : loc) (m1 n1 n2 : Z): rdcss_spec N γ v (lm : loc) (m1 n1 n2 : val):
is_rdcss N γ v - val_is_unboxed m1 val_is_unboxed (InjLV n1) is_rdcss N γ v -
<<< (m n: Z), gc_mapsto lm #m rdcss_content γ n >>> <<< (m n: val), gc_mapsto lm m rdcss_content γ n >>>
rdcss #lm v #m1 #n1 #n2 @((⊤∖↑N)∖↑gcN) rdcss #lm v m1 n1 n2 @((⊤∖↑N)∖↑gcN)
<<< gc_mapsto lm #m rdcss_content γ (if decide (m = m1 n = n1) then n2 else n), RET #n >>>; <<< gc_mapsto lm m rdcss_content γ (if decide (m = m1 n = n1) then n2 else n), RET n >>>;
get_spec N γ v: get_spec N γ v:
is_rdcss N γ v - is_rdcss N γ v -
<<< (n : Z), rdcss_content γ n >>> <<< (n : val), rdcss_content γ n >>>
get v @(⊤∖↑N) get v @(⊤∖↑N)
<<< rdcss_content γ n, RET #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