2 #include "objstack.hpp"
8 void ObjStack::setup_chunk()
10 bottom = first_free->data;
11 align_bottom(min_align);
12 top = (byte *)first_free + chunk_size;
17 ObjStack::ObjStack(size_t chunk_s, size_t align)
18 : chunk_size(chunk_s), min_align(align), temp_end(0)
20 first_free = first = (Node *)malloc(chunk_size);
29 Node * tmp = first->next;
36 size_t ObjStack::calc_size()
39 for (Node * p = first; p; p = p->next)
44 void ObjStack::new_chunk()
47 first_free->next = reserve;
48 reserve = reserve->next;
49 first_free = first_free->next;
52 first_free->next = (Node *)malloc(chunk_size);
53 first_free = first_free->next;
59 void ObjStack::reset()
61 assert(first_free->next == 0);
63 first_free->next = reserve;
64 reserve = first->next;
74 Node * tmp = reserve->next;