Remove rc_base. Closes #603.

This commit is contained in:
Michael Sullivan 2011-08-18 15:49:58 -07:00
parent 28fbc591fd
commit eb368d1b34
4 changed files with 10 additions and 26 deletions

View file

@ -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);

View file

@ -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),

View file

@ -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;

View file

@ -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)