diff options
| author | Marijn Haverbeke <marijnh@gmail.com> | 2012-03-15 17:34:57 +0100 |
|---|---|---|
| committer | Marijn Haverbeke <marijnh@gmail.com> | 2012-03-16 00:44:06 +0100 |
| commit | 76d07f405675ab8eb636bdb9cb1fbfec6f3ed805 (patch) | |
| tree | 82ce909be5ff62aa63299ba022fcf500ba41d6b2 /src/rt/rust_obstack.h | |
| parent | 146b61189a5c206d744a09b9336c26e3dc1637c4 (diff) | |
| download | rust-76d07f405675ab8eb636bdb9cb1fbfec6f3ed805.tar.gz rust-76d07f405675ab8eb636bdb9cb1fbfec6f3ed805.zip | |
Remove dynastack support from runtime
Issue #1982
Diffstat (limited to 'src/rt/rust_obstack.h')
| -rw-r--r-- | src/rt/rust_obstack.h | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/src/rt/rust_obstack.h b/src/rt/rust_obstack.h deleted file mode 100644 index 99d9ba801b4..00000000000 --- a/src/rt/rust_obstack.h +++ /dev/null @@ -1,75 +0,0 @@ -// Object stacks, used in lieu of dynamically-sized frames. - -#ifndef RUST_OBSTACK_H -#define RUST_OBSTACK_H - -#include <utility> - -struct rust_obstack_alloc; -struct rust_task; -struct type_desc; - -// A contiguous set of allocations. -struct rust_obstack_chunk { - rust_obstack_chunk *prev; - size_t size; - size_t alen; - size_t pad; - uint8_t data[]; - - rust_obstack_chunk(rust_obstack_chunk *in_prev, size_t in_size) - : prev(in_prev), size(in_size), alen(0) {} - - void *alloc(size_t len, type_desc *tydesc); - bool free(void *ptr); - void *mark(); -}; - -class rust_obstack { - rust_obstack_chunk *chunk; - rust_task *task; - - // Allocates the given number of bytes in a new chunk. - void *alloc_new(size_t len, type_desc *tydesc); - -public: - class iterator { - rust_obstack_chunk *chunk; - rust_obstack_alloc *alloc; - - public: - iterator(rust_obstack_chunk *in_chunk) - : chunk(in_chunk), - alloc(in_chunk - ? reinterpret_cast<rust_obstack_alloc *>(in_chunk->data) - : NULL) {} - - std::pair<const type_desc *,void *> operator*() const; - iterator &operator++(); - bool operator==(const iterator &other) const; - bool operator!=(const iterator &other) const; - }; - - rust_obstack(rust_task *in_task) : chunk(NULL), task(in_task) {} - ~rust_obstack(); - - inline iterator begin() const { - iterator it(chunk); - return it; - } - - inline iterator end() const { - iterator it(NULL); - return it; - } - - void *alloc(size_t len, type_desc *tydesc); - void free(void *ptr); - void *mark(); - - /** Debugging tool: dumps the contents of this obstack to stderr. */ - void dump() const; -}; - -#endif - |
