Resetting the builder arena. May be a bug or two here still.
This commit is contained in:
@@ -42,6 +42,10 @@ void HIRBuilder::Reset() {
|
||||
next_value_ordinal_ = 0;
|
||||
block_head_ = block_tail_ = NULL;
|
||||
current_block_ = NULL;
|
||||
#if XE_DEBUG
|
||||
arena_->DebugFill();
|
||||
#endif
|
||||
arena_->Reset();
|
||||
}
|
||||
|
||||
int HIRBuilder::Finalize() {
|
||||
@@ -319,6 +323,19 @@ void HIRBuilder::InsertLabel(Label* label, Instr* prev_instr) {
|
||||
}
|
||||
}
|
||||
|
||||
void HIRBuilder::ResetLabelTags() {
|
||||
// TODO(benvanik): make this faster?
|
||||
auto block = block_head_;
|
||||
while (block) {
|
||||
auto label = block->label_head;
|
||||
while (label) {
|
||||
label->tag = 0;
|
||||
label = label->next;
|
||||
}
|
||||
block = block->next;
|
||||
}
|
||||
}
|
||||
|
||||
Block* HIRBuilder::AppendBlock() {
|
||||
Block* block = arena_->Alloc<Block>();
|
||||
block->arena = arena_;
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <alloy/core.h>
|
||||
#include <alloy/hir/block.h>
|
||||
#include <alloy/hir/instr.h>
|
||||
#include <alloy/hir/label.h>
|
||||
#include <alloy/hir/opcodes.h>
|
||||
#include <alloy/hir/value.h>
|
||||
|
||||
@@ -47,6 +48,7 @@ public:
|
||||
Label* NewLabel();
|
||||
void MarkLabel(Label* label, Block* block = 0);
|
||||
void InsertLabel(Label* label, Instr* prev_instr);
|
||||
void ResetLabelTags();
|
||||
|
||||
// static allocations:
|
||||
// Value* AllocStatic(size_t length);
|
||||
|
||||
Reference in New Issue
Block a user