modeltypes: move small typedefs to own header
authorBrian Norris <banorris@uci.edu>
Wed, 3 Oct 2012 20:17:47 +0000 (13:17 -0700)
committerBrian Norris <banorris@uci.edu>
Wed, 3 Oct 2012 20:53:02 +0000 (13:53 -0700)
To prevent some unnecessary inter-header dependencies, we can move some
simple typedefs to a modeltypes.h header.

17 files changed:
action.cc
action.h
clockvector.cc
clockvector.h
cmodelint.cc
datarace.cc
datarace.h
impatomic.cc
librace.cc
model.cc
model.h
modeltypes.h [new file with mode: 0644]
mutex.cc
mutex.h
nodestack.cc
nodestack.h
threads.h

index f80de7b322aa4dd288a2c6f8959240028ea9e3a8..c5912ff2ef51d5ac5dd0371f96caf7519a5dd2a0 100644 (file)
--- a/action.cc
+++ b/action.cc
@@ -7,6 +7,7 @@
 #include "action.h"
 #include "clockvector.h"
 #include "common.h"
 #include "action.h"
 #include "clockvector.h"
 #include "common.h"
+#include "threads.h"
 
 #define ACTION_INITIAL_CLOCK 0
 
 
 #define ACTION_INITIAL_CLOCK 0
 
index f6fb06236fe0230eb942c38dcc177c081db341bd..8dc88430f2b093969c00ed9f4cff18163072d776 100644 (file)
--- a/action.h
+++ b/action.h
@@ -7,11 +7,13 @@
 
 #include <list>
 #include <cstddef>
 
 #include <list>
 #include <cstddef>
+#include <inttypes.h>
 
 
-#include "threads.h"
 #include "mymemory.h"
 #include "mymemory.h"
-#include "clockvector.h"
 #include "memoryorder.h"
 #include "memoryorder.h"
+#include "modeltypes.h"
+
+class ClockVector;
 
 using std::memory_order;
 using std::memory_order_relaxed;
 
 using std::memory_order;
 using std::memory_order_relaxed;
index c5bf07709b718f775f0337f6b360f273081c3e08..2b6a4cc6822c6f202decc866c0d25956908dff85 100644 (file)
@@ -6,6 +6,7 @@
 #include "action.h"
 #include "clockvector.h"
 #include "common.h"
 #include "action.h"
 #include "clockvector.h"
 #include "common.h"
+#include "threads.h"
 
 /**
  * Constructs a new ClockVector, given a parent ClockVector and a first
 
 /**
  * Constructs a new ClockVector, given a parent ClockVector and a first
index 739a336e1adc6c81178686c10da60d411cd903b8..6a902c5215342bae0313d56b3e6cfa8267bd79cf 100644 (file)
@@ -5,10 +5,9 @@
 #ifndef __CLOCKVECTOR_H__
 #define __CLOCKVECTOR_H__
 
 #ifndef __CLOCKVECTOR_H__
 #define __CLOCKVECTOR_H__
 
-#include "threads.h"
 #include "mymemory.h"
 #include "mymemory.h"
+#include "modeltypes.h"
 
 
-typedef unsigned int modelclock_t;
 /* Forward declaration */
 class ModelAction;
 
 /* Forward declaration */
 class ModelAction;
 
index 228c40f9ec8d02b1a7b9c599a6cf69fc1c4ebf78..6b20c2cc9c800378de4b2255fc94e7a7646516d7 100644 (file)
@@ -1,5 +1,6 @@
 #include "model.h"
 #include "cmodelint.h"
 #include "model.h"
 #include "cmodelint.h"
+#include "threads.h"
 
 /** Performs a read action.*/
 uint64_t model_read_action(void * obj, memory_order ord) {
 
 /** Performs a read action.*/
 uint64_t model_read_action(void * obj, memory_order ord) {
index 293743052858c8029fb685ff246ac071f38b821e..d6e0875c1a5562315b26367a3582452d5c41b07d 100644 (file)
@@ -4,6 +4,7 @@
 #include <stdio.h>
 #include <cstring>
 #include "mymemory.h"
 #include <stdio.h>
 #include <cstring>
 #include "mymemory.h"
+#include "clockvector.h"
 
 struct ShadowTable *root;
 std::vector<struct DataRace *> unrealizedraces;
 
 struct ShadowTable *root;
 std::vector<struct DataRace *> unrealizedraces;
index 5bfcb8ad48cc98d007612805c2cc48567dedf984..627b8cc88c7016b27cc2660bdebdf4693e674c40 100644 (file)
@@ -5,8 +5,12 @@
 #ifndef DATARACE_H
 #include "config.h"
 #include <stdint.h>
 #ifndef DATARACE_H
 #include "config.h"
 #include <stdint.h>
-#include "clockvector.h"
 #include <vector>
 #include <vector>
+#include "modeltypes.h"
+
+/* Forward declaration */
+class ClockVector;
+class ModelAction;
 
 struct ShadowTable {
        void * array[65536];
 
 struct ShadowTable {
        void * array[65536];
index df11202d8ade74f9e677bd8ebb46b2fc1bf062cd..0a35b4b65d0513da09bdc47d81614c7d14f7ab88 100644 (file)
@@ -1,6 +1,7 @@
 #include "impatomic.h"
 #include "common.h"
 #include "model.h"
 #include "impatomic.h"
 #include "common.h"
 #include "model.h"
+#include "threads.h"
 
 namespace std {
 
 
 namespace std {
 
index 38434de70f44d4694ed2a268094e19370a2f87d1..bdd6093a6b6d4ea1f8c9665219a660dc23d1a813 100644 (file)
@@ -5,6 +5,7 @@
 #include "common.h"
 #include "datarace.h"
 #include "model.h"
 #include "common.h"
 #include "datarace.h"
 #include "model.h"
+#include "threads.h"
 
 void store_8(void *addr, uint8_t val)
 {
 
 void store_8(void *addr, uint8_t val)
 {
index b5843ed6b7c5ebf6ba091e05afac6ac70593e1ae..73d212d0166d2ac3d2fc7368f25afac0333ac491 100644 (file)
--- a/model.cc
+++ b/model.cc
@@ -12,6 +12,7 @@
 #include "promise.h"
 #include "datarace.h"
 #include "mutex.h"
 #include "promise.h"
 #include "datarace.h"
 #include "mutex.h"
+#include "threads.h"
 
 #define INITIAL_THREAD_ID      0
 
 
 #define INITIAL_THREAD_ID      0
 
diff --git a/model.h b/model.h
index 23c42ebb199a6ce30b5859b80ca8d5537038d0a3..62c762711bcb8300765483ee075ec9747d412d5f 100644 (file)
--- a/model.h
+++ b/model.h
 #include <ucontext.h>
 
 #include "mymemory.h"
 #include <ucontext.h>
 
 #include "mymemory.h"
-#include "libthreads.h"
-#include "threads.h"
 #include "action.h"
 #include "action.h"
-#include "clockvector.h"
 #include "hashtable.h"
 #include "workqueue.h"
 #include "config.h"
 #include "hashtable.h"
 #include "workqueue.h"
 #include "config.h"
+#include "modeltypes.h"
 
 /* Forward declaration */
 class NodeStack;
 class CycleGraph;
 class Promise;
 class Scheduler;
 
 /* Forward declaration */
 class NodeStack;
 class CycleGraph;
 class Promise;
 class Scheduler;
+class Thread;
 
 /** @brief Shorthand for a list of release sequence heads */
 typedef std::vector< const ModelAction *, ModelAlloc<const ModelAction *> > rel_heads_list_t;
 
 /** @brief Shorthand for a list of release sequence heads */
 typedef std::vector< const ModelAction *, ModelAlloc<const ModelAction *> > rel_heads_list_t;
diff --git a/modeltypes.h b/modeltypes.h
new file mode 100644 (file)
index 0000000..22221cb
--- /dev/null
@@ -0,0 +1,10 @@
+#ifndef __MODELTYPES_H__
+#define __MODELTYPES_H__
+
+typedef int thread_id_t;
+
+#define THREAD_ID_T_NONE       -1
+
+typedef unsigned int modelclock_t;
+
+#endif /* __MODELTYPES_H__ */
index 51315d94bbf3081959c4c59d1d4c6af727f4a7ea..6ef297a594d6b897110e7663c1f3753f859e0c3a 100644 (file)
--- a/mutex.cc
+++ b/mutex.cc
@@ -1,5 +1,7 @@
 #include "mutex.h"
 #include "model.h"
 #include "mutex.h"
 #include "model.h"
+#include "threads.h"
+#include "clockvector.h"
 
 namespace std {
 mutex::mutex() {
 
 namespace std {
 mutex::mutex() {
diff --git a/mutex.h b/mutex.h
index 828aae53f9e1d273900b776ab657907c87e3cd08..53fccb2b89a8974fb26ed8d60f4f1262d3c23396 100644 (file)
--- a/mutex.h
+++ b/mutex.h
@@ -1,7 +1,7 @@
 #ifndef MUTEX_H
 #define MUTEX_H
 #ifndef MUTEX_H
 #define MUTEX_H
-#include "threads.h"
-#include "clockvector.h"
+
+#include "modeltypes.h"
 
 namespace std {
        struct mutex_state {
 
 namespace std {
        struct mutex_state {
index c6ca076d734aa2460ed9efa1aa25cbe1aca04afa..a73765320dac47e97428390fe37bc3b06ba10483 100644 (file)
@@ -4,6 +4,7 @@
 #include "action.h"
 #include "common.h"
 #include "model.h"
 #include "action.h"
 #include "common.h"
 #include "model.h"
+#include "threads.h"
 
 /**
  * @brief Node constructor
 
 /**
  * @brief Node constructor
index 421890f4f998c57d3ce4364263c0adaa631ad36c..fca063e7a4f86c2462f75a01f006d9c911487a26 100644 (file)
@@ -8,11 +8,13 @@
 #include <list>
 #include <vector>
 #include <cstddef>
 #include <list>
 #include <vector>
 #include <cstddef>
-#include "threads.h"
+#include <inttypes.h>
+
 #include "mymemory.h"
 #include "mymemory.h"
-#include "clockvector.h"
+#include "modeltypes.h"
 
 class ModelAction;
 
 class ModelAction;
+class Thread;
 
 /**
  * A flag used for the promise counting/combination problem within a node,
 
 /**
  * A flag used for the promise counting/combination problem within a node,
index 9456a22f2fe4942b1004a87794fa3474eaeab26b..b69f4265618d1dd2eb4ef18c66aef2b4442a0496 100644 (file)
--- a/threads.h
+++ b/threads.h
 
 #include "mymemory.h"
 #include "libthreads.h"
 
 #include "mymemory.h"
 #include "libthreads.h"
-
-typedef int thread_id_t;
-
-#define THREAD_ID_T_NONE       -1
+#include "modeltypes.h"
 
 /** @brief Represents the state of a user Thread */
 typedef enum thread_state {
 
 /** @brief Represents the state of a user Thread */
 typedef enum thread_state {