2011-08-16 19:48:47 -07:00
|
|
|
// Object stacks, used in lieu of dynamically-sized frames.
|
|
|
|
|
|
|
|
#ifndef RUST_OBSTACK_H
|
|
|
|
#define RUST_OBSTACK_H
|
|
|
|
|
|
|
|
struct rust_obstack_chunk;
|
|
|
|
struct rust_task;
|
2011-08-31 19:19:05 -07:00
|
|
|
struct type_desc;
|
2011-08-16 19:48:47 -07:00
|
|
|
|
|
|
|
class rust_obstack {
|
|
|
|
rust_obstack_chunk *chunk;
|
|
|
|
rust_task *task;
|
|
|
|
|
|
|
|
// Allocates the given number of bytes in a new chunk.
|
2011-08-31 19:19:05 -07:00
|
|
|
void *alloc_new(size_t len, type_desc *tydesc);
|
2011-08-16 19:48:47 -07:00
|
|
|
|
|
|
|
public:
|
|
|
|
rust_obstack(rust_task *in_task) : chunk(NULL), task(in_task) {}
|
2011-08-17 13:15:04 -07:00
|
|
|
~rust_obstack();
|
2011-08-16 19:48:47 -07:00
|
|
|
|
2011-08-31 19:19:05 -07:00
|
|
|
void *alloc(size_t len, type_desc *tydesc);
|
2011-08-16 19:48:47 -07:00
|
|
|
void free(void *ptr);
|
2011-08-31 19:19:05 -07:00
|
|
|
void *mark();
|
2011-08-16 19:48:47 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|