about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Sullivan <sully@msully.net>2011-08-18 15:49:58 -0700
committerMichael Sullivan <sully@msully.net>2011-08-18 15:49:58 -0700
commiteb368d1b346a0cd6a9db3fc33ce3b563f68a5d84 (patch)
treeb46e9ec78ebfe42a798b91d800909d275fabf01b
parent28fbc591fdfa65494412c37829c063dfcc98d648 (diff)
downloadrust-eb368d1b346a0cd6a9db3fc33ce3b563f68a5d84.tar.gz
rust-eb368d1b346a0cd6a9db3fc33ce3b563f68a5d84.zip
Remove rc_base. Closes #603.
-rw-r--r--src/rt/rust_internal.h12
-rw-r--r--src/rt/rust_scheduler.cpp1
-rw-r--r--src/rt/rust_scheduler.h3
-rw-r--r--src/rt/rust_util.h20
4 files changed, 10 insertions, 26 deletions
diff --git a/src/rt/rust_internal.h b/src/rt/rust_internal.h
index aa9f387a9f9..486e985f614 100644
--- a/src/rt/rust_internal.h
+++ b/src/rt/rust_internal.h
@@ -106,9 +106,8 @@ static intptr_t const CONST_REFCOUNT = 0x7badface;
 
 static size_t const BUF_BYTES = 2048;
 
-// Every reference counted object should derive from this base class.
-// Or use this macro. The macro is preferred as the base class will be
-// disappearing.
+// Every reference counted object should use this macro and initialize
+// ref_count.
 
 #define RUST_REFCOUNTED(T) \
   RUST_REFCOUNTED_WITH_DTOR(T, delete (T*)this)
@@ -127,13 +126,6 @@ public:                                                                 \
  }                                                                      \
  void deref() { if(0 == sync::decrement(ref_count)) { delete this; } }
 
-template <typename T> struct rc_base {
-    RUST_REFCOUNTED(T)
-
-    rc_base();
-    ~rc_base();
-};
-
 template <typename T> struct task_owned {
     inline void *operator new(size_t size, rust_task *task, const char *tag);
 
diff --git a/src/rt/rust_scheduler.cpp b/src/rt/rust_scheduler.cpp
index 913f489c382..5595ca51a55 100644
--- a/src/rt/rust_scheduler.cpp
+++ b/src/rt/rust_scheduler.cpp
@@ -6,6 +6,7 @@
 rust_scheduler::rust_scheduler(rust_kernel *kernel,
                                rust_srv *srv,
                                int id) :
+    ref_count(1),
     interrupt_flag(0),
     _log(srv, this),
     log_lvl(log_note),
diff --git a/src/rt/rust_scheduler.h b/src/rt/rust_scheduler.h
index b4a70e51f68..6969034f725 100644
--- a/src/rt/rust_scheduler.h
+++ b/src/rt/rust_scheduler.h
@@ -27,9 +27,10 @@ public:
 };
 
 struct rust_scheduler : public kernel_owned<rust_scheduler>,
-                        rc_base<rust_scheduler>,
                         rust_thread
 {
+    RUST_REFCOUNTED(rust_scheduler)
+
     // Fields known to the compiler:
     uintptr_t interrupt_flag;
 
diff --git a/src/rt/rust_util.h b/src/rt/rust_util.h
index 64b7d35623c..aab3e15e464 100644
--- a/src/rt/rust_util.h
+++ b/src/rt/rust_util.h
@@ -4,19 +4,6 @@
 #include "rust_task.h"
 #include <limits.h>
 
-// Reference counted objects
-
-template <typename T>
-rc_base<T>::rc_base() :
-    ref_count(1)
-{
-}
-
-template <typename T>
-rc_base<T>::~rc_base()
-{
-}
-
 // Utility type: pointer-vector.
 
 template <typename T>
@@ -181,15 +168,18 @@ isaac_init(sched_or_kernel *sched, randctx *rctx)
 // Vectors (rust-user-code level).
 
 struct
-rust_evec : public rc_base<rust_evec>
+rust_evec
 {
+    RUST_REFCOUNTED(rust_evec)
+
     size_t alloc;
     size_t fill;
     size_t pad; // Pad to align data[0] to 16 bytes.
     uint8_t data[];
     rust_evec(size_t alloc, size_t fill,
              uint8_t const *d)
-        : alloc(alloc),
+        : ref_count(1),
+          alloc(alloc),
           fill(fill)
     {
         if (d)