diff options
| author | Brian Anderson <banderson@mozilla.com> | 2011-08-12 10:57:19 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2011-08-12 12:14:07 -0700 |
| commit | d1b3ed8c3f808182d74c4056eb8936943ad356fb (patch) | |
| tree | 725e90acf53b6e3278a271bd8b74015bb766958f /src/rt/rust_builtin.cpp | |
| parent | 533becef2f54a0cb0a4b386a3df308bf7ab4ea14 (diff) | |
| download | rust-d1b3ed8c3f808182d74c4056eb8936943ad356fb.tar.gz rust-d1b3ed8c3f808182d74c4056eb8936943ad356fb.zip | |
Remove runtime vector builtins
Diffstat (limited to 'src/rt/rust_builtin.cpp')
| -rw-r--r-- | src/rt/rust_builtin.cpp | 84 |
1 files changed, 0 insertions, 84 deletions
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp index c6a3c8c01d6..c9688f3cadb 100644 --- a/src/rt/rust_builtin.cpp +++ b/src/rt/rust_builtin.cpp @@ -120,74 +120,6 @@ unsupervise(rust_task *task) { task->unsupervise(); } -extern "C" CDECL rust_vec* -vec_alloc(rust_task *task, type_desc *t, type_desc *elem_t, size_t n_elts) -{ - LOG(task, mem, "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 = task->malloc(alloc, "rust_vec", t->is_stateful ? t : NULL); - if (!mem) { - task->fail(); - return NULL; - } - rust_vec *vec = new (mem) rust_vec(alloc, 0, NULL); - return vec; -} - -extern "C" CDECL rust_vec* -vec_alloc_mut(rust_task *task, type_desc *t, type_desc *elem_t, size_t n_elts) -{ - return vec_alloc(task, t, elem_t, n_elts); -} - -extern "C" CDECL void * -vec_buf(rust_task *task, type_desc *ty, rust_vec *v, size_t offset) -{ - return (void *)&v->data[ty->size * offset]; -} - -extern "C" CDECL size_t -vec_len(rust_task *task, type_desc *ty, rust_vec *v) -{ - return v->fill / ty->size; -} - -extern "C" CDECL void -vec_len_set(rust_task *task, type_desc *ty, rust_vec *v, size_t len) -{ - LOG(task, stdlib, "vec_len_set(0x%" PRIxPTR ", %" PRIdPTR ") on vec with " - "alloc = %" PRIdPTR - ", fill = %" PRIdPTR - ", len = %" PRIdPTR - ". New fill is %" PRIdPTR, - v, len, v->alloc, v->fill, v->fill / ty->size, len * ty->size); - v->fill = len * ty->size; -} - -extern "C" CDECL void -vec_print_debug_info(rust_task *task, type_desc *ty, rust_vec *v) -{ - LOG(task, stdlib, - "vec_print_debug_info(0x%" PRIxPTR ")" - " with tydesc 0x%" PRIxPTR - " (size = %" PRIdPTR ", align = %" PRIdPTR ")" - " alloc = %" PRIdPTR ", fill = %" PRIdPTR ", len = %" PRIdPTR - " , data = ...", - v, - ty, - ty->size, - ty->align, - v->alloc, - v->fill, - v->fill / ty->size); - - for (size_t i = 0; i < v->fill; ++i) { - LOG(task, stdlib, " %" PRIdPTR ": 0x%" PRIxPTR, i, v->data[i]); - } -} - /* Helper for str_alloc and str_from_vec. Returns NULL as failure. */ static rust_vec* vec_alloc_with_data(rust_task *task, @@ -202,22 +134,6 @@ vec_alloc_with_data(rust_task *task, return new (mem) rust_vec(alloc, fill * elt_size, (uint8_t*)d); } -extern "C" CDECL rust_vec* -vec_from_vbuf(rust_task *task, type_desc *ty, void *vbuf, size_t n_elts) -{ - return vec_alloc_with_data(task, n_elts, n_elts * ty->size, ty->size, - vbuf); -} - -extern "C" CDECL rust_vec* -unsafe_vec_to_mut(rust_task *task, type_desc *ty, rust_vec *v) -{ - if (v->ref_count != CONST_REFCOUNT) { - v->ref(); - } - return v; -} - extern "C" CDECL rust_str* str_alloc(rust_task *task, size_t n_bytes) { |
