spin model : inline reader
authorcompudj <compudj@compumobile.(none)>
Thu, 19 Mar 2009 18:05:02 +0000 (14:05 -0400)
committercompudj <compudj@compumobile.(none)>
Thu, 19 Mar 2009 18:05:02 +0000 (14:05 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
formal-model/urcu/urcu.spin

index 2282407ce5aa6c16a4891748df3923d4b492cc57..570da40231773d139e2c80166b584b0585136da3 100644 (file)
@@ -240,6 +240,53 @@ inline wait_for_quiescent_state(tmp, i, j)
 
 /* Model the RCU read-side critical section. */
 
+inline urcu_one_read(i, nest_i, tmp, tmp2)
+{
+       nest_i = 0;
+       do
+       :: nest_i < READER_NEST_LEVEL ->
+               ooo_mem(i);
+               tmp = READ_CACHED_VAR(urcu_active_readers_one);
+               ooo_mem(i);
+               if
+               :: (!(tmp & RCU_GP_CTR_NEST_MASK))
+                       ->
+                       tmp2 = READ_CACHED_VAR(urcu_gp_ctr);
+                       ooo_mem(i);
+                       WRITE_CACHED_VAR(urcu_active_readers_one, tmp2);
+               :: else ->
+                       WRITE_CACHED_VAR(urcu_active_readers_one,
+                                        tmp + 1);
+               fi;
+               ooo_mem(i);
+               smp_mb(i);
+               nest_i++;
+       :: nest_i >= READER_NEST_LEVEL -> break;
+       od;
+
+       ooo_mem(i);
+       read_generation = READ_CACHED_VAR(generation_ptr);
+       ooo_mem(i);
+       data_access = 1;
+       ooo_mem(i);
+       data_access = 0;
+
+       nest_i = 0;
+       do
+       :: nest_i < READER_NEST_LEVEL ->
+               ooo_mem(i);
+               smp_mb(i);
+               ooo_mem(i);
+               tmp2 = READ_CACHED_VAR(urcu_active_readers_one);
+               ooo_mem(i);
+               WRITE_CACHED_VAR(urcu_active_readers_one, tmp2 - 1);
+               nest_i++;
+       :: nest_i >= READER_NEST_LEVEL -> break;
+       od;
+       ooo_mem(i);
+       //smp_mc(i);    /* added */
+}
+
 active [NR_READERS] proctype urcu_reader()
 {
        byte i, nest_i;
@@ -260,53 +307,10 @@ end_reader:
 #ifdef READER_PROGRESS
 progress_reader:
 #endif
-               nest_i = 0;
-               do
-               :: nest_i < READER_NEST_LEVEL ->
-                       ooo_mem(i);
-                       tmp = READ_CACHED_VAR(urcu_active_readers_one);
-                       ooo_mem(i);
-                       if
-                       :: (!(tmp & RCU_GP_CTR_NEST_MASK))
-                               ->
-                               tmp2 = READ_CACHED_VAR(urcu_gp_ctr);
-                               ooo_mem(i);
-                               WRITE_CACHED_VAR(urcu_active_readers_one, tmp2);
-                       :: else ->
-                               WRITE_CACHED_VAR(urcu_active_readers_one,
-                                                tmp + 1);
-                       fi;
-                       ooo_mem(i);
-                       smp_mb(i);
-                       nest_i++;
-               :: nest_i >= READER_NEST_LEVEL -> break;
-               od;
-
-               ooo_mem(i);
-               read_generation = READ_CACHED_VAR(generation_ptr);
-               ooo_mem(i);
-               data_access = 1;
-               ooo_mem(i);
-               data_access = 0;
-
-               nest_i = 0;
-               do
-               :: nest_i < READER_NEST_LEVEL ->
-                       ooo_mem(i);
-                       smp_mb(i);
-                       ooo_mem(i);
-                       tmp2 = READ_CACHED_VAR(urcu_active_readers_one);
-                       ooo_mem(i);
-                       WRITE_CACHED_VAR(urcu_active_readers_one, tmp2 - 1);
-                       nest_i++;
-               :: nest_i >= READER_NEST_LEVEL -> break;
-               od;
-               ooo_mem(i);
-               //smp_mc(i);    /* added */
+               urcu_one_read(i, nest_i, tmp, tmp2);
        od;
 }
 
-
 /* Model the RCU update process. */
 
 active [NR_WRITERS] proctype urcu_writer()
This page took 0.026658 seconds and 4 git commands to generate.