diff options
Diffstat (limited to 'src/rt')
| -rw-r--r-- | src/rt/rust_builtin.cpp | 10 | ||||
| -rw-r--r-- | src/rt/rust_internal.h | 1 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp index 0b492de8..99fa9535 100644 --- a/src/rt/rust_builtin.cpp +++ b/src/rt/rust_builtin.cpp @@ -92,15 +92,15 @@ unsupervise(rust_task *task) { } extern "C" CDECL rust_vec* -vec_alloc(rust_task *task, type_desc *t, size_t n_elts) +vec_alloc(rust_task *task, type_desc *t, type_desc *elem_t, size_t n_elts) { rust_dom *dom = task->dom; task->log(rust_log::MEM, - "vec_alloc %" PRIdPTR " elements of size %" PRIdPTR, - n_elts, t->size); - size_t fill = n_elts * t->size; + "vec_alloc %" PRIdPTR " elements of size %" PRIdPTR, + n_elts, elem_t->size); + size_t fill = n_elts * elem_t->size; size_t alloc = next_power_of_two(sizeof(rust_vec) + fill); - void *mem = dom->malloc(alloc); + void *mem = task->malloc(alloc, t->is_stateful ? t : NULL); if (!mem) { task->fail(3); return NULL; diff --git a/src/rt/rust_internal.h b/src/rt/rust_internal.h index d962e894..78ba85e8 100644 --- a/src/rt/rust_internal.h +++ b/src/rt/rust_internal.h @@ -274,6 +274,7 @@ struct type_desc { uintptr_t sever_glue_off; // For GC. uintptr_t mark_glue_off; // For GC. uintptr_t obj_drop_glue_off; // For custom destructors. + uintptr_t is_stateful; // Residual fields past here are known only to runtime. UT_hash_handle hh; |