-int main() {
- struct pair<int> *p;
- p -> x = 2
- + 3 - 3;
- /**
- @Begin
- @Potential_commit_point_define:
- __ATOMIC_RET__ == true
- @Label:
- Enqueue_Success_Point
- @End
- */
- return 0;
-}
+/**
+@Begin
+ @Options:
+ LANG = C;
+ CLASS = cliffc_hashtable;
+ @Global_define:
+ @DeclareVar:
+ spec_hashtable<TypeK, TypeV*> map;
+ spec_hashtable<TypeK, Tag> id_map;
+ Tag tag;
+ @InitVar:
+ map = spec_hashtable<TypeK, TypeV*>();
+ id_map = spec_hashtable<TypeK, TypeV*>();
+ tag = Tag();
+ @DefineFunc:
+ static bool equals_val(TypeV *ptr1, TypeV *ptr2) {
+ // ...
+ }
+
+ # Update the tag for the current key slot if the corresponding tag
+ # is NULL, otherwise just return that tag. It will update the next
+ # available tag too if it requires a new tag for that key slot.
+ static Tag getKeyTag(TypeK &key) {
+ if (id_map.get(key) == NULL) {
+ Tag cur_tag = tag.current();
+ id_map.put(key, cur_tag);
+ tag.next();
+ return cur_tag;
+ } else {
+ return id_map.get(key);
+ }
+ }
+
+ @Interface_cluster:
+ Read_interface = {
+ Get,
+ PutIfAbsent,
+ RemoveAny,
+ RemoveIfMatch,
+ ReplaceAny,
+ ReplaceIfMatch
+ }
+
+ Write_interface = {
+ Put,
+ PutIfAbsent(COND_PutIfAbsentSucc),
+ RemoveAny,
+ RemoveIfMatch(COND_RemoveIfMatchSucc),
+ ReplaceAny,
+ ReplaceIfMatch(COND_ReplaceIfMatchSucc)
+ }
+ @Happens_before:
+ Write_interface -> Read_interface
+ @End
+ */