Skip to content

Commit bfb7a12

Browse files
committed
---
yaml --- r: 4858 b: refs/heads/master c: d017191 h: refs/heads/master v: v3
1 parent 37d287d commit bfb7a12

File tree

7 files changed

+7
-127
lines changed

7 files changed

+7
-127
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 8fa86672ab21a3ef437bbf3af17972091fb9e146
2+
refs/heads/master: d0171913aad1b50c0f5d58ca014965b805d16eef

trunk/src/rt/rust_builtin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ refcount(rust_task *task, type_desc *t, intptr_t *v) {
118118

119119
extern "C" CDECL void
120120
do_gc(rust_task *task) {
121-
task->gc();
121+
// TODO
122122
}
123123

124124
extern "C" CDECL void

trunk/src/rt/rust_gc.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ gc::mark(std::vector<root> &roots) {
137137
shape::log log(task, ri->tydesc->shape, params,
138138
ri->tydesc->shape_tables, ri->data, std::cerr);
139139
log.walk(true);
140+
DPRINT("\n");
140141

141142
++ri;
142143
}

trunk/src/rt/rust_task.cpp

Lines changed: 3 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -258,14 +258,6 @@ rust_task::fail() {
258258
failed = true;
259259
}
260260

261-
void
262-
rust_task::gc()
263-
{
264-
// FIXME: not presently implemented; was broken by rustc.
265-
DLOG(sched, task,
266-
"task %s @0x%" PRIxPTR " garbage collecting", name, this);
267-
}
268-
269261
void
270262
rust_task::unsupervise()
271263
{
@@ -320,99 +312,22 @@ rust_task::dead()
320312
return state == &sched->dead_tasks;
321313
}
322314

323-
void
324-
rust_task::link_gc(gc_alloc *gcm) {
325-
I(sched, gcm->prev == NULL);
326-
I(sched, gcm->next == NULL);
327-
gcm->prev = NULL;
328-
gcm->next = gc_alloc_chain;
329-
gc_alloc_chain = gcm;
330-
if (gcm->next)
331-
gcm->next->prev = gcm;
332-
}
333-
334-
void
335-
rust_task::unlink_gc(gc_alloc *gcm) {
336-
if (gcm->prev)
337-
gcm->prev->next = gcm->next;
338-
if (gcm->next)
339-
gcm->next->prev = gcm->prev;
340-
if (gc_alloc_chain == gcm)
341-
gc_alloc_chain = gcm->next;
342-
gcm->prev = NULL;
343-
gcm->next = NULL;
344-
}
345-
346315
void *
347316
rust_task::malloc(size_t sz, const char *tag, type_desc *td)
348317
{
349-
// FIXME: GC is disabled for now.
350-
// GC-memory classification is all wrong.
351-
td = NULL;
352-
353-
if (td) {
354-
sz += sizeof(gc_alloc);
355-
}
356-
357-
void *mem = local_region.malloc(sz, tag);
358-
if (!mem)
359-
return mem;
360-
if (td) {
361-
gc_alloc *gcm = (gc_alloc*) mem;
362-
DLOG(sched, task, "task %s @0x%" PRIxPTR
363-
" allocated %d GC bytes = 0x%" PRIxPTR,
364-
name, (uintptr_t)this, sz, gcm);
365-
memset((void*) gcm, 0, sizeof(gc_alloc));
366-
link_gc(gcm);
367-
gcm->ctrl_word = (uintptr_t)td;
368-
gc_alloc_accum += sz;
369-
mem = (void*) &(gcm->data);
370-
}
371-
return mem;;
318+
return local_region.malloc(sz, tag);
372319
}
373320

374321
void *
375322
rust_task::realloc(void *data, size_t sz, bool is_gc)
376323
{
377-
// FIXME: GC is disabled for now.
378-
// Effects, GC-memory classification is all wrong.
379-
is_gc = false;
380-
if (is_gc) {
381-
gc_alloc *gcm = (gc_alloc*)(((char *)data) - sizeof(gc_alloc));
382-
unlink_gc(gcm);
383-
sz += sizeof(gc_alloc);
384-
gcm = (gc_alloc*) local_region.realloc((void*)gcm, sz);
385-
DLOG(sched, task, "task %s @0x%" PRIxPTR
386-
" reallocated %d GC bytes = 0x%" PRIxPTR,
387-
name, (uintptr_t)this, sz, gcm);
388-
if (!gcm)
389-
return gcm;
390-
link_gc(gcm);
391-
data = (void*) &(gcm->data);
392-
} else {
393-
data = local_region.realloc(data, sz);
394-
}
395-
return data;
324+
return local_region.realloc(data, sz);
396325
}
397326

398327
void
399328
rust_task::free(void *p, bool is_gc)
400329
{
401-
// FIXME: GC is disabled for now.
402-
// GC-memory classification is all wrong.
403-
is_gc = false;
404-
if (is_gc) {
405-
gc_alloc *gcm = (gc_alloc*)(((char *)p) - sizeof(gc_alloc));
406-
unlink_gc(gcm);
407-
DLOG(sched, mem,
408-
"task %s @0x%" PRIxPTR " freeing GC memory = 0x%" PRIxPTR,
409-
name, (uintptr_t)this, gcm);
410-
DLOG(sched, mem, "rust_task::free(0x%" PRIxPTR ")", gcm);
411-
local_region.free(gcm);
412-
} else {
413-
DLOG(sched, mem, "rust_task::free(0x%" PRIxPTR ")", p);
414-
local_region.free(p);
415-
}
330+
local_region.free(p);
416331
}
417332

418333
void

trunk/src/rt/rust_task.h

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,6 @@ struct frame_glue_fns {
2222
uintptr_t reloc_glue_off;
2323
};
2424

25-
struct gc_alloc {
26-
gc_alloc *prev;
27-
gc_alloc *next;
28-
uintptr_t ctrl_word;
29-
uint8_t data[];
30-
bool mark() {
31-
if (ctrl_word & 1)
32-
return false;
33-
ctrl_word |= 1;
34-
return true;
35-
}
36-
};
37-
3825
// portions of the task structure that are accessible from the standard
3926
// library. This struct must agree with the std::task::rust_task record.
4027
struct rust_task_user {
@@ -69,7 +56,7 @@ rust_task : public kernel_owned<rust_task>, rust_cond
6956
// Fields known to the compiler.
7057
stk_seg *stk;
7158
uintptr_t runtime_sp; // Runtime sp while task running.
72-
gc_alloc *gc_alloc_chain; // Linked list of GC allocations.
59+
void *gc_alloc_chain; // Linked list of GC allocations.
7360
rust_scheduler *sched;
7461
rust_crate_cache *cache;
7562

@@ -81,8 +68,6 @@ rust_task : public kernel_owned<rust_task>, rust_cond
8168
const char *cond_name;
8269
rust_task *supervisor; // Parent-link for failure propagation.
8370
int32_t list_index;
84-
size_t gc_alloc_thresh;
85-
size_t gc_alloc_accum;
8671

8772
rust_port_id next_port_id;
8873

@@ -141,8 +126,6 @@ rust_task : public kernel_owned<rust_task>, rust_cond
141126
bool blocked_on(rust_cond *cond);
142127
bool dead();
143128

144-
void link_gc(gc_alloc *gcm);
145-
void unlink_gc(gc_alloc *gcm);
146129
void *malloc(size_t sz, const char *tag, type_desc *td=0);
147130
void *realloc(void *data, size_t sz, bool gc_mem=false);
148131
void free(void *p, bool gc_mem=false);
@@ -169,9 +152,6 @@ rust_task : public kernel_owned<rust_task>, rust_cond
169152
// Fail self, assuming caller-on-stack is this task.
170153
void fail();
171154

172-
// Run the gc glue on the task stack.
173-
void gc();
174-
175155
// Disconnect from our supervisor.
176156
void unsupervise();
177157

trunk/src/rt/rust_upcall.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -189,21 +189,6 @@ upcall_shared_free(rust_task *task, void* ptr) {
189189
task->kernel->free(ptr);
190190
}
191191

192-
extern "C" CDECL uintptr_t
193-
upcall_mark(rust_task *task, void* ptr) {
194-
LOG_UPCALL_ENTRY(task);
195-
196-
rust_scheduler *sched = task->sched;
197-
if (ptr) {
198-
gc_alloc *gcm = (gc_alloc*) (((char*)ptr) - sizeof(gc_alloc));
199-
uintptr_t marked = (uintptr_t) gcm->mark();
200-
DLOG(sched, gc, "upcall mark(0x%" PRIxPTR ") = %" PRIdPTR,
201-
(uintptr_t)gcm, marked);
202-
return marked;
203-
}
204-
return 0;
205-
}
206-
207192
rust_str *make_str(rust_task *task, char const *s, size_t fill) {
208193
size_t alloc = next_power_of_two(sizeof(rust_str) + fill);
209194
void *mem = task->malloc(alloc, "rust_str (make_str)");

trunk/src/rt/rustrt.def.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ upcall_log_istr
9797
upcall_log_str
9898
upcall_log_type
9999
upcall_malloc
100-
upcall_mark
101100
upcall_new_str
102101
upcall_shared_malloc
103102
upcall_shared_free

0 commit comments

Comments
 (0)