Fixing arena chunk reuse.
This commit is contained in:
parent
2a1d1d55d7
commit
00d878c62a
|
@ -45,13 +45,14 @@ void Arena::DebugFill() {
|
||||||
|
|
||||||
void* Arena::Alloc(size_t size) {
|
void* Arena::Alloc(size_t size) {
|
||||||
if (active_chunk_) {
|
if (active_chunk_) {
|
||||||
if (active_chunk_->capacity - active_chunk_->offset < size) {
|
if (active_chunk_->capacity - active_chunk_->offset < size + 4096) {
|
||||||
Chunk* next = active_chunk_->next;
|
Chunk* next = active_chunk_->next;
|
||||||
if (!next) {
|
if (!next) {
|
||||||
XEASSERT(size < chunk_size_); // need to support larger chunks
|
XEASSERT(size < chunk_size_); // need to support larger chunks
|
||||||
next = new Chunk(chunk_size_);
|
next = new Chunk(chunk_size_);
|
||||||
active_chunk_->next = next;
|
active_chunk_->next = next;
|
||||||
}
|
}
|
||||||
|
next->offset = 0;
|
||||||
active_chunk_ = next;
|
active_chunk_ = next;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -72,6 +72,7 @@ int HIRBuilder::Finalize() {
|
||||||
// Sometimes VC++ generates functions with bl at the end even if they
|
// Sometimes VC++ generates functions with bl at the end even if they
|
||||||
// will never return. Just add a return to satisfy things.
|
// will never return. Just add a return to satisfy things.
|
||||||
XELOGW("Fall-through out of the function.");
|
XELOGW("Fall-through out of the function.");
|
||||||
|
Trap();
|
||||||
Return();
|
Return();
|
||||||
current_block_ = NULL;
|
current_block_ = NULL;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue