From b970563fe3f36853250f4cef65a8425431789e8b Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Wed, 29 Sep 2010 17:22:07 -0700 Subject: Patchwork of attempted fixes to effect system and gc system; eventually give up and disable it entirely in the runtime. Will need extensive reworking. --- src/rt/rust_task.cpp | 10 ++++++++++ src/rt/rust_upcall.cpp | 13 +++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) (limited to 'src/rt') diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp index 3bc41b93..97eeb4bf 100644 --- a/src/rt/rust_task.cpp +++ b/src/rt/rust_task.cpp @@ -488,6 +488,10 @@ rust_task::unlink_gc(gc_alloc *gcm) { void * rust_task::malloc(size_t sz, type_desc *td) { + // FIXME: GC is disabled for now. + // Effects, GC-memory classification are all wrong. + td = NULL; + if (td) { sz += sizeof(gc_alloc); } @@ -512,6 +516,9 @@ rust_task::malloc(size_t sz, type_desc *td) void * rust_task::realloc(void *data, size_t sz, bool is_gc) { + // FIXME: GC is disabled for now. + // Effects, GC-memory classification are all wrong. + is_gc = false; if (is_gc) { gc_alloc *gcm = (gc_alloc*)(((char *)data) - sizeof(gc_alloc)); unlink_gc(gcm); @@ -534,6 +541,9 @@ rust_task::realloc(void *data, size_t sz, bool is_gc) void rust_task::free(void *p, bool is_gc) { + // FIXME: GC is disabled for now. + // Effects, GC-memory classification are all wrong. + is_gc = false; if (is_gc) { gc_alloc *gcm = (gc_alloc*)(((char *)p) - sizeof(gc_alloc)); unlink_gc(gcm); diff --git a/src/rt/rust_upcall.cpp b/src/rt/rust_upcall.cpp index 9a5e73f8..9742b22a 100644 --- a/src/rt/rust_upcall.cpp +++ b/src/rt/rust_upcall.cpp @@ -312,8 +312,8 @@ upcall_free(rust_task *task, void* ptr, uintptr_t is_gc) { LOG_UPCALL_ENTRY(task); rust_dom *dom = task->dom; dom->log(rust_log::UPCALL|rust_log::MEM, - "upcall free(0x%" PRIxPTR ")", - (uintptr_t)ptr); + "upcall free(0x%" PRIxPTR ", is_gc=%" PRIdPTR ")", + (uintptr_t)ptr, is_gc); task->free(ptr, (bool) is_gc); } @@ -338,7 +338,7 @@ upcall_new_str(rust_task *task, char const *s, size_t fill) { LOG_UPCALL_ENTRY(task); rust_dom *dom = task->dom; size_t alloc = next_power_of_two(sizeof(rust_str) + fill); - void *mem = dom->malloc(alloc); + void *mem = task->malloc(alloc); if (!mem) { task->fail(3); return NULL; @@ -373,7 +373,8 @@ extern "C" CDECL rust_vec * upcall_vec_grow(rust_task *task, rust_vec *v, size_t n_bytes, - uintptr_t *need_copy) + uintptr_t *need_copy, + type_desc *td) { LOG_UPCALL_ENTRY(task); rust_dom *dom = task->dom; @@ -396,7 +397,7 @@ upcall_vec_grow(rust_task *task, // Second-fastest path: can at least realloc. task->log(rust_log::UPCALL | rust_log::MEM, "realloc path"); - v = (rust_vec*) dom->realloc(v, alloc); + v = (rust_vec*) task->realloc(v, alloc, td->is_stateful); if (!v) { task->fail(4); return NULL; @@ -418,7 +419,7 @@ upcall_vec_grow(rust_task *task, * that we need the copies performed for us. */ task->log(rust_log::UPCALL | rust_log::MEM, "new vec path"); - void *mem = dom->malloc(alloc); + void *mem = task->malloc(alloc, td); if (!mem) { task->fail(4); return NULL; -- cgit v1.2.3