edits
[cdsspec-compiler.git] / notes / nondeterm-spec.txt
index 8dca63c150e5efe831f2b5b35d5e175a32aac9f9..5bf44c3597051bb6144a42a50cab981293307229 100644 (file)
@@ -5,35 +5,21 @@ I. Order
 happens-before and SC relation.
 
 II. State
-1. Global state: We allow users to specify a single global state so that when we
-want to execute the sequential replay (execute the sequential order), the whole
-process is similar to executing an sequential program. Such a global state is
-similiar to the internal state of a sequential data structure. We also have this
-in our old version (the rejection of PLDI'16). As an analogy to the cache-memory
-model, the global state we define here is similar to the main memory in the
-sense that there does not exist a real total order to all memory accesses, but
-to some degree (with the non-deterministic specifications) we can have an
-illution that there is some total order.
-
-2. Local State: Beside of having one global state (the one that we have in the
-old approach), we also allow each method call to have a local state.  This local
-state is the accumulative side effects of the subset of method calls that happen
-before the current method call. As an analogy to the cache-memory model, the
-local state we define here is similar to cache, a local state is local to the
-sense that the current method call must have seen those effects. The main goal
-of having this is to support tighter non-deterministic specifications.
-
-To evaluate the local state of each method call, an obvious approach is to
+Previously, we keep a sequential state throughout the process of executing the
+sequential history. In our model, we keep a state local to each method call.
+Conceptually, this state is the accumulative side effects of the subset of
+method calls that happen before the current method call. 
+
+To evaluate the state of each method call, an obvious approach is to
 execute the subset of methods that happen before the current method in the
 sequential order from the initial state. A optimization we can make is that we
 start to evaluate the state from the most recent deviding node which every other
-node in that subset is either hb before or after. Also, since local states are
-not required in specifications all the time, it is only evaluated when needed.
+node in that subset is either hb before or after.
 
 III. Specifications
-Our specification language supports using the following primitives to access
-both global state and local state so that users can use those to write
-specifications with different level of tightness.
+Our specification language supports using the following primitives to access the
+state of method calls so that users can use those to write specifications with
+different level of tightness.
 
 To support tighter specifications, we introduce the concept of concurrent set of
 method calls, meaning that for a specific method call, it can basically see the
@@ -49,23 +35,20 @@ different order, a later store will have different result.
 
 1. CONCURRENT: This primitive extracts all the methods that executes
 "concurrently" with the current method --- neither hb/SC before nor after the
-current method --- and returns as a set. It is worth noting that the concurrent
-method calls cannot be accessed for calculating local state but only for
-assertions.
+current method --- and returns as a set. It is worth noting that in order to
+preserve composability, when evaluating the state, the concurrent method calls'
+information cannot be used. That is to say, the concurrent set of mehtods are
+only used for assertions.
 
 2. PREV: This primitive extracts all the methods that execute right before the
 current method in the execution graph --- most recent method calls that are
 hb/SC before the current method call --- and returns as a set. For each method
-in this set, the current method's specification can access their local state.
+in this set, the current method's specification can access their state.
 
 3. NEXT: This primitive extracts all the methods that execute right after the
 current method in the execution graph, and returns as a set. For each method in
-this set, the current method's specification cannot access their local state.
-
-4. LOCAL: This primitive allows users to access the local state of a method
-call. It is worth noting that in order to calculate the local state of a method
-call, one can only access the set of method calls that happen before the current
-method call.
+this set, the current method's specification CANNOT access their state (for
+preserving composability).
 
 Our specifications allow two ways of calculating the local states, a default way
 and a user-customized way. The default approach is to execute the set of method
@@ -73,44 +56,38 @@ calls that happen before the current method call in the sequential order, and a
 the user-customized approach supports users to calculate the local state by
 using the PREV primitive to access the local state of previous method calls.
 
-5. COPY: This is the function that users provide to deep-copy the state. We
-require users to provide such a primitive function because each local state
-should be have its own copy.
-
-6. FINALLY: This is the function that allows users to specify some final check
-on the state. Initially, this check will only access the global state. However,
-for the concern of expressiveness, we allow users to access the initial state,
-meaning that users can basically access the whole graph and the local state of
-each method call. This will enable to users to use the graph model (the relaxed
+// FIXME: This might break composability!!??!!
+6. FINAL: This is the function that allows users to specify some final check
+on the state. This will enable to users to use the graph model (the relaxed
 atomics can be specified) although the complxity of using that can get quite
 complex.
 
 IV. Examples
 
-// Global specification
-@DeclareState: // Declare the state structure
-@InitState: // How do we initialize the state
-@CopyState: // A function on how to copy an existing state
+/// Global specification
+@State: // Declare the state structure
+@Initial: // How do we initialize the state
 @Commutativity: Method1 <-> Method2 (Guard) // Guard can only access the return
                // value and the arguments of the two method calls
 
-// Interface specification
+/// Interface specification
 @Interface: InterfaceName // Required; a label to represent the interface
-@LocalState: // Optional; to calculate the accumulative local state before this
-                        // method call in a customized fashion. If not specified here, the
-                        // local state would be default, which is the result of the
-                        // execution on the subset of method calls in the sequential order
+@Transition: // Optional; the transitional side effect from the initial state to
+                        // the current method call by executing such effect on method calls
+                        // that are hb/SC before me in sequential order. When this field is
+                        // omitted, the current state seen before checking is the same as
+                        // the initial state.
+@EvaluateState: // Optional; to calculate the state before this
+                               // method call is checked in a customized fashion. This is
+                               // evaluated after "@Transition". If omitted, the state we would
+                               // see is the effect after the "@Transition".
 @PreCondition: // Optional; checking code
-@LocalSideEffect: // Optional; to calculate the side effect this method call
-                                 // have on the local state in a customized fashion. If this
-                                 // field is not stated, it means we don't care about it.
-@SideEffect: // Optional; to calculate the side effect on the global state. When
-               // the "@LocalSideEffect" specification is ommitted, we also impose the
-               // same side effect on the set of method calls that happen before this
-               // method call in the sequential order.
+@SideEffect: // Optional; to calculate the side effect this method call
+                                 // have on the state after the "@PreCondition".
 @PostCondition: // Optional; checking code
 
-// Ordering point specification
+
+/// Ordering point specification
 @OPDefine: condition   // If the specified condition satisfied, the atomic
                                                // operation right before is an ordering point