Skip to content

Commit 9bbb7ab

Browse files
committed
---
yaml --- r: 5398 b: refs/heads/master c: 77f0101 h: refs/heads/master v: v3
1 parent 0eae100 commit 9bbb7ab

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
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: 5209b192558e4adf0baa0981c463dcff61ec0636
2+
refs/heads/master: 77f0101edb85c574a94e15aa862ca075ed2fb886

trunk/src/rt/rust_task.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
#ifndef RUST_TASK_H
66
#define RUST_TASK_H
77

8+
#include <map>
9+
810
#include "util/array_list.h"
911

1012
#include "context.h"
@@ -113,6 +115,8 @@ rust_task : public kernel_owned<rust_task>, rust_cond
113115

114116
rust_obstack dynastack;
115117

118+
std::map<void *,type_desc *> local_allocs;
119+
116120
// Only a pointer to 'name' is kept, so it must live as long as this task.
117121
rust_task(rust_scheduler *sched,
118122
rust_task_list *state,

trunk/src/rt/rust_upcall.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ upcall_malloc(rust_task *task, size_t nbytes, type_desc *td) {
6767

6868
void *p = task->malloc(nbytes, "tdesc", td);
6969

70+
task->local_allocs[p] = td;
71+
7072
LOG(task, mem,
7173
"upcall malloc(%" PRIdPTR ", 0x%" PRIxPTR ") = 0x%" PRIxPTR,
7274
nbytes, td, (uintptr_t)p);
@@ -84,6 +86,8 @@ upcall_free(rust_task *task, void* ptr, uintptr_t is_gc) {
8486
DLOG(sched, mem,
8587
"upcall free(0x%" PRIxPTR ", is_gc=%" PRIdPTR ")",
8688
(uintptr_t)ptr, is_gc);
89+
90+
task->local_allocs.erase(ptr);
8791
task->free(ptr, (bool) is_gc);
8892
}
8993

0 commit comments

Comments
 (0)