about summary refs log tree commit diff
path: root/src/rt/rust_task.cpp
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2011-08-19 19:17:05 -0700
committerPatrick Walton <pcwalton@mimiga.net>2011-08-19 19:17:05 -0700
commitd0171913aad1b50c0f5d58ca014965b805d16eef (patch)
tree254264371e81334cfd08a855fb84588215bcacba /src/rt/rust_task.cpp
parent8fa86672ab21a3ef437bbf3af17972091fb9e146 (diff)
downloadrust-d0171913aad1b50c0f5d58ca014965b805d16eef.tar.gz
rust-d0171913aad1b50c0f5d58ca014965b805d16eef.zip
rt: Remove rustboot's GC infrastructure
Diffstat (limited to 'src/rt/rust_task.cpp')
-rw-r--r--src/rt/rust_task.cpp91
1 files changed, 3 insertions, 88 deletions
diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp
index 7b8160f3637..bd8fe5c38e8 100644
--- a/src/rt/rust_task.cpp
+++ b/src/rt/rust_task.cpp
@@ -259,14 +259,6 @@ rust_task::fail() {
 }
 
 void
-rust_task::gc()
-{
-    // FIXME: not presently implemented; was broken by rustc.
-    DLOG(sched, task,
-             "task %s @0x%" PRIxPTR " garbage collecting", name, this);
-}
-
-void
 rust_task::unsupervise()
 {
     DLOG(sched, task,
@@ -320,99 +312,22 @@ rust_task::dead()
     return state == &sched->dead_tasks;
 }
 
-void
-rust_task::link_gc(gc_alloc *gcm) {
-    I(sched, gcm->prev == NULL);
-    I(sched, gcm->next == NULL);
-    gcm->prev = NULL;
-    gcm->next = gc_alloc_chain;
-    gc_alloc_chain = gcm;
-    if (gcm->next)
-        gcm->next->prev = gcm;
-}
-
-void
-rust_task::unlink_gc(gc_alloc *gcm) {
-    if (gcm->prev)
-        gcm->prev->next = gcm->next;
-    if (gcm->next)
-        gcm->next->prev = gcm->prev;
-    if (gc_alloc_chain == gcm)
-        gc_alloc_chain = gcm->next;
-    gcm->prev = NULL;
-    gcm->next = NULL;
-}
-
 void *
 rust_task::malloc(size_t sz, const char *tag, type_desc *td)
 {
-    // FIXME: GC is disabled for now.
-    // GC-memory classification is all wrong.
-    td = NULL;
-
-    if (td) {
-        sz += sizeof(gc_alloc);
-    }
-
-    void *mem = local_region.malloc(sz, tag);
-    if (!mem)
-        return mem;
-    if (td) {
-        gc_alloc *gcm = (gc_alloc*) mem;
-        DLOG(sched, task, "task %s @0x%" PRIxPTR
-             " allocated %d GC bytes = 0x%" PRIxPTR,
-             name, (uintptr_t)this, sz, gcm);
-        memset((void*) gcm, 0, sizeof(gc_alloc));
-        link_gc(gcm);
-        gcm->ctrl_word = (uintptr_t)td;
-        gc_alloc_accum += sz;
-        mem = (void*) &(gcm->data);
-    }
-    return mem;;
+    return local_region.malloc(sz, tag);
 }
 
 void *
 rust_task::realloc(void *data, size_t sz, bool is_gc)
 {
-    // FIXME: GC is disabled for now.
-    // Effects, GC-memory classification is all wrong.
-    is_gc = false;
-    if (is_gc) {
-        gc_alloc *gcm = (gc_alloc*)(((char *)data) - sizeof(gc_alloc));
-        unlink_gc(gcm);
-        sz += sizeof(gc_alloc);
-        gcm = (gc_alloc*) local_region.realloc((void*)gcm, sz);
-        DLOG(sched, task, "task %s @0x%" PRIxPTR
-             " reallocated %d GC bytes = 0x%" PRIxPTR,
-             name, (uintptr_t)this, sz, gcm);
-        if (!gcm)
-            return gcm;
-        link_gc(gcm);
-        data = (void*) &(gcm->data);
-    } else {
-        data = local_region.realloc(data, sz);
-    }
-    return data;
+    return local_region.realloc(data, sz);
 }
 
 void
 rust_task::free(void *p, bool is_gc)
 {
-    // FIXME: GC is disabled for now.
-    // GC-memory classification is all wrong.
-    is_gc = false;
-    if (is_gc) {
-        gc_alloc *gcm = (gc_alloc*)(((char *)p) - sizeof(gc_alloc));
-        unlink_gc(gcm);
-        DLOG(sched, mem,
-             "task %s @0x%" PRIxPTR " freeing GC memory = 0x%" PRIxPTR,
-             name, (uintptr_t)this, gcm);
-        DLOG(sched, mem, "rust_task::free(0x%" PRIxPTR ")", gcm);
-        local_region.free(gcm);
-    } else {
-        DLOG(sched, mem, "rust_task::free(0x%" PRIxPTR ")", p);
-        local_region.free(p);
-    }
+    local_region.free(p);
 }
 
 void