38 Region::Pool::Pool(
void)
39 :
c(new Chunk), n_c(2U) {
40 c->next =
new Chunk;
c->next->next =
nullptr;
43 Region::Pool::chunk(
void) {
49 n =
c;
c =
c->next; n_c--;
51 n =
new Region::Chunk;
58 Region::Pool::chunk(Chunk*
u) {
60 if (n_c == Kernel::MemoryConfig::n_hc_cache) {
67 Region::Pool::~Pool(
void) {
75 }
while (c !=
nullptr);
78 Region::Pool& Region::pool(
void) {
79 static Region::Pool _p;
84 Region::heap_alloc(
size_t s) {
88 assert(!Support::marked(hi));
89 }
else if (!Support::marked(hi)) {
90 HeapInfo* h =
static_cast<HeapInfo*
>
91 (
heap.
ralloc(
sizeof(HeapInfo)+(4-1)*
sizeof(
void*)));
93 h->blocks[0]=hi; h->blocks[1]=
p;
94 hi = Support::mark(h);
96 HeapInfo* h =
static_cast<HeapInfo*
>(Support::unmark(hi));
97 if (h->n == h->size) {
98 HeapInfo*
n =
static_cast<HeapInfo*
>
99 (
heap.
ralloc(
sizeof(HeapInfo)+(2*h->n-1)*
sizeof(
void*)));
102 memcpy(&
n->blocks[0], &h->blocks[0], h->n*
sizeof(
void*));
103 hi = Support::mark(
n);
107 h->blocks[h->n++] =
p;
113 Region::heap_free(
void) {
114 assert(hi !=
nullptr);
115 if (Support::marked(hi)) {
116 HeapInfo* h =
static_cast<HeapInfo*
>(Support::unmark(hi));
117 for (
unsigned int i=0U;
i<h->
n;
i++)
union Gecode::@603::NNF::@65 u
Union depending on nodetype t.
int p
Number of positive literals for node type.
int n
Number of negative literals for node type.
void rfree(void *p)
Free memory block starting at p.
void * ralloc(size_t s)
Allocate s bytes from heap.
Heap heap
The single global heap.
Gecode toplevel namespace
Gecode::FloatVal c(-8, 8)
Gecode::IntArgs i({1, 2, 3, 4})