Fixing arena chunk reuse.

This commit is contained in:
Ben Vanik 2014-01-04 14:34:49 -08:00
parent 2a1d1d55d7
commit 00d878c62a
2 changed files with 3 additions and 1 deletions

View File

@ -45,13 +45,14 @@ void Arena::DebugFill() {
void* Arena::Alloc(size_t size) {
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;
if (!next) {
XEASSERT(size < chunk_size_); // need to support larger chunks
next = new Chunk(chunk_size_);
active_chunk_->next = next;
}
next->offset = 0;
active_chunk_ = next;
}
} else {

View File

@ -72,6 +72,7 @@ int HIRBuilder::Finalize() {
// Sometimes VC++ generates functions with bl at the end even if they
// will never return. Just add a return to satisfy things.
XELOGW("Fall-through out of the function.");
Trap();
Return();
current_block_ = NULL;
break;