about summary refs log tree commit diff
path: root/src/rt
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
parent8fa86672ab21a3ef437bbf3af17972091fb9e146 (diff)
downloadrust-d0171913aad1b50c0f5d58ca014965b805d16eef.tar.gz
rust-d0171913aad1b50c0f5d58ca014965b805d16eef.zip
rt: Remove rustboot's GC infrastructure
Diffstat (limited to 'src/rt')
-rw-r--r--src/rt/rust_builtin.cpp2
-rw-r--r--src/rt/rust_gc.cpp1
-rw-r--r--src/rt/rust_task.cpp91
-rw-r--r--src/rt/rust_task.h22
-rw-r--r--src/rt/rust_upcall.cpp15
-rw-r--r--src/rt/rustrt.def.in1
6 files changed, 6 insertions, 126 deletions
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp
index ac4491f1588..044239065e9 100644
--- a/src/rt/rust_builtin.cpp
+++ b/src/rt/rust_builtin.cpp
@@ -118,7 +118,7 @@ refcount(rust_task *task, type_desc *t, intptr_t *v) {
 
 extern "C" CDECL void
 do_gc(rust_task *task) {
-    task->gc();
+    // TODO
 }
 
 extern "C" CDECL void
diff --git a/src/rt/rust_gc.cpp b/src/rt/rust_gc.cpp
index ff6ca86f854..b83c54ed73c 100644
--- a/src/rt/rust_gc.cpp
+++ b/src/rt/rust_gc.cpp
@@ -137,6 +137,7 @@ gc::mark(std::vector<root> &roots) {
         shape::log log(task, ri->tydesc->shape, params,
                        ri->tydesc->shape_tables, ri->data, std::cerr);
         log.walk(true);
+        DPRINT("\n");
 
         ++ri;
     }
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
diff --git a/src/rt/rust_task.h b/src/rt/rust_task.h
index ea155687d98..4fc37ca1ee9 100644
--- a/src/rt/rust_task.h
+++ b/src/rt/rust_task.h
@@ -22,19 +22,6 @@ struct frame_glue_fns {
     uintptr_t reloc_glue_off;
 };
 
-struct gc_alloc {
-    gc_alloc *prev;
-    gc_alloc *next;
-    uintptr_t ctrl_word;
-    uint8_t data[];
-    bool mark() {
-        if (ctrl_word & 1)
-            return false;
-        ctrl_word |= 1;
-        return true;
-    }
-};
-
 // portions of the task structure that are accessible from the standard
 // library. This struct must agree with the std::task::rust_task record.
 struct rust_task_user {
@@ -69,7 +56,7 @@ rust_task : public kernel_owned<rust_task>, rust_cond
     // Fields known to the compiler.
     stk_seg *stk;
     uintptr_t runtime_sp;      // Runtime sp while task running.
-    gc_alloc *gc_alloc_chain;  // Linked list of GC allocations.
+    void *gc_alloc_chain;      // Linked list of GC allocations.
     rust_scheduler *sched;
     rust_crate_cache *cache;
 
@@ -81,8 +68,6 @@ rust_task : public kernel_owned<rust_task>, rust_cond
     const char *cond_name;
     rust_task *supervisor;     // Parent-link for failure propagation.
     int32_t list_index;
-    size_t gc_alloc_thresh;
-    size_t gc_alloc_accum;
 
     rust_port_id next_port_id;
 
@@ -141,8 +126,6 @@ rust_task : public kernel_owned<rust_task>, rust_cond
     bool blocked_on(rust_cond *cond);
     bool dead();
 
-    void link_gc(gc_alloc *gcm);
-    void unlink_gc(gc_alloc *gcm);
     void *malloc(size_t sz, const char *tag, type_desc *td=0);
     void *realloc(void *data, size_t sz, bool gc_mem=false);
     void free(void *p, bool gc_mem=false);
@@ -169,9 +152,6 @@ rust_task : public kernel_owned<rust_task>, rust_cond
     // Fail self, assuming caller-on-stack is this task.
     void fail();
 
-    // Run the gc glue on the task stack.
-    void gc();
-
     // Disconnect from our supervisor.
     void unsupervise();
 
diff --git a/src/rt/rust_upcall.cpp b/src/rt/rust_upcall.cpp
index 9462db80af1..775b4b54a0f 100644
--- a/src/rt/rust_upcall.cpp
+++ b/src/rt/rust_upcall.cpp
@@ -189,21 +189,6 @@ upcall_shared_free(rust_task *task, void* ptr) {
     task->kernel->free(ptr);
 }
 
-extern "C" CDECL uintptr_t
-upcall_mark(rust_task *task, void* ptr) {
-    LOG_UPCALL_ENTRY(task);
-
-    rust_scheduler *sched = task->sched;
-    if (ptr) {
-        gc_alloc *gcm = (gc_alloc*) (((char*)ptr) - sizeof(gc_alloc));
-        uintptr_t marked = (uintptr_t) gcm->mark();
-        DLOG(sched, gc, "upcall mark(0x%" PRIxPTR ") = %" PRIdPTR,
-                 (uintptr_t)gcm, marked);
-        return marked;
-    }
-    return 0;
-}
-
 rust_str *make_str(rust_task *task, char const *s, size_t fill) {
     size_t alloc = next_power_of_two(sizeof(rust_str) + fill);
     void *mem = task->malloc(alloc, "rust_str (make_str)");
diff --git a/src/rt/rustrt.def.in b/src/rt/rustrt.def.in
index ec3cb60c6c2..58aa681f633 100644
--- a/src/rt/rustrt.def.in
+++ b/src/rt/rustrt.def.in
@@ -97,7 +97,6 @@ upcall_log_istr
 upcall_log_str
 upcall_log_type
 upcall_malloc
-upcall_mark
 upcall_new_str
 upcall_shared_malloc
 upcall_shared_free