vm: add gc_event
parent
e793a72060
commit
a60bf14673
81
vm/gc.cpp
81
vm/gc.cpp
|
@ -7,6 +7,87 @@ gc_state::gc_state(gc_op op_) : op(op_), start_time(current_micros()) {}
|
||||||
|
|
||||||
gc_state::~gc_state() {}
|
gc_state::~gc_state() {}
|
||||||
|
|
||||||
|
gc_event::gc_event(gc_op op_, factor_vm *parent) :
|
||||||
|
op(op_),
|
||||||
|
start_time(current_micros()),
|
||||||
|
card_scan_time(0),
|
||||||
|
data_sweep_time(0),
|
||||||
|
code_sweep_time(0),
|
||||||
|
compaction_time(0)
|
||||||
|
{
|
||||||
|
nursery_size_before = parent->nursery.occupied_space();
|
||||||
|
aging_size_before = parent->data->aging->occupied_space();
|
||||||
|
tenured_size_before = parent->data->tenured->occupied_space();
|
||||||
|
tenured_free_block_count_before = parent->data->tenured->free_blocks.free_block_count;
|
||||||
|
code_size_before = parent->code->allocator->occupied_space();
|
||||||
|
code_free_block_count_before = parent->code->allocator->free_blocks.free_block_count;
|
||||||
|
start_time = current_micros();
|
||||||
|
}
|
||||||
|
|
||||||
|
void gc_event::started_card_scan()
|
||||||
|
{
|
||||||
|
card_scan_time = current_micros();
|
||||||
|
}
|
||||||
|
|
||||||
|
void gc_event::ended_card_scan(cell cards_scanned_, cell decks_scanned_)
|
||||||
|
{
|
||||||
|
cards_scanned += cards_scanned_;
|
||||||
|
decks_scanned += decks_scanned_;
|
||||||
|
card_scan_time = (card_scan_time - current_micros());
|
||||||
|
}
|
||||||
|
|
||||||
|
void gc_event::started_code_scan()
|
||||||
|
{
|
||||||
|
code_scan_time = current_micros();
|
||||||
|
}
|
||||||
|
|
||||||
|
void gc_event::ended_code_scan(cell code_blocks_scanned_)
|
||||||
|
{
|
||||||
|
code_blocks_scanned += code_blocks_scanned_;
|
||||||
|
code_scan_time = (code_scan_time - current_micros());
|
||||||
|
}
|
||||||
|
|
||||||
|
void gc_event::started_data_sweep()
|
||||||
|
{
|
||||||
|
data_sweep_time = current_micros();
|
||||||
|
}
|
||||||
|
|
||||||
|
void gc_event::ended_data_sweep()
|
||||||
|
{
|
||||||
|
data_sweep_time = (data_sweep_time - current_micros());
|
||||||
|
}
|
||||||
|
|
||||||
|
void gc_event::started_code_sweep()
|
||||||
|
{
|
||||||
|
code_sweep_time = current_micros();
|
||||||
|
}
|
||||||
|
|
||||||
|
void gc_event::ended_code_sweep()
|
||||||
|
{
|
||||||
|
code_sweep_time = (code_sweep_time - current_micros());
|
||||||
|
}
|
||||||
|
|
||||||
|
void gc_event::started_compaction()
|
||||||
|
{
|
||||||
|
compaction_time = current_micros();
|
||||||
|
}
|
||||||
|
|
||||||
|
void gc_event::ended_compaction()
|
||||||
|
{
|
||||||
|
compaction_time = (compaction_time - current_micros());
|
||||||
|
}
|
||||||
|
|
||||||
|
void gc_event::ended_gc(factor_vm *parent)
|
||||||
|
{
|
||||||
|
nursery_size_after = parent->nursery.occupied_space();
|
||||||
|
aging_size_after = parent->data->aging->occupied_space();
|
||||||
|
tenured_size_after = parent->data->tenured->occupied_space();
|
||||||
|
tenured_free_block_count_after = parent->data->tenured->free_blocks.free_block_count;
|
||||||
|
code_size_after = parent->code->allocator->occupied_space();
|
||||||
|
code_free_block_count_after = parent->code->allocator->free_blocks.free_block_count;
|
||||||
|
total_time = current_micros() - start_time;
|
||||||
|
}
|
||||||
|
|
||||||
void factor_vm::update_code_heap_for_minor_gc(std::set<code_block *> *remembered_set)
|
void factor_vm::update_code_heap_for_minor_gc(std::set<code_block *> *remembered_set)
|
||||||
{
|
{
|
||||||
/* The youngest generation that any code block can now reference */
|
/* The youngest generation that any code block can now reference */
|
||||||
|
|
39
vm/gc.hpp
39
vm/gc.hpp
|
@ -19,6 +19,45 @@ struct gc_state {
|
||||||
~gc_state();
|
~gc_state();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct gc_event {
|
||||||
|
gc_op op;
|
||||||
|
cell nursery_size_before;
|
||||||
|
cell aging_size_before;
|
||||||
|
cell tenured_size_before;
|
||||||
|
cell tenured_free_block_count_before;
|
||||||
|
cell code_size_before;
|
||||||
|
cell code_free_block_count_before;
|
||||||
|
cell nursery_size_after;
|
||||||
|
cell aging_size_after;
|
||||||
|
cell tenured_size_after;
|
||||||
|
cell tenured_free_block_count_after;
|
||||||
|
cell code_size_after;
|
||||||
|
cell code_free_block_count_after;
|
||||||
|
cell cards_scanned;
|
||||||
|
cell decks_scanned;
|
||||||
|
cell code_blocks_scanned;
|
||||||
|
u64 start_time;
|
||||||
|
cell total_time;
|
||||||
|
cell card_scan_time;
|
||||||
|
cell code_scan_time;
|
||||||
|
cell data_sweep_time;
|
||||||
|
cell code_sweep_time;
|
||||||
|
cell compaction_time;
|
||||||
|
|
||||||
|
explicit gc_event(gc_op op_, factor_vm *parent);
|
||||||
|
void started_card_scan();
|
||||||
|
void ended_card_scan(cell cards_scanned_, cell decks_scanned_);
|
||||||
|
void started_code_scan();
|
||||||
|
void ended_code_scan(cell code_blocks_scanned_);
|
||||||
|
void started_data_sweep();
|
||||||
|
void ended_data_sweep();
|
||||||
|
void started_code_sweep();
|
||||||
|
void ended_code_sweep();
|
||||||
|
void started_compaction();
|
||||||
|
void ended_compaction();
|
||||||
|
void ended_gc(factor_vm *parent);
|
||||||
|
};
|
||||||
|
|
||||||
VM_C_API void inline_gc(cell *gc_roots_base, cell gc_roots_size, factor_vm *parent);
|
VM_C_API void inline_gc(cell *gc_roots_base, cell gc_roots_size, factor_vm *parent);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue