vm: flush icache after GC

db4
Slava Pestov 2009-11-24 21:36:35 -06:00
parent 69b4e8e2c3
commit 73e105bfc4
5 changed files with 14 additions and 10 deletions

View File

@ -3,11 +3,6 @@
namespace factor namespace factor
{ {
void factor_vm::flush_icache_for(code_block *block)
{
flush_icache((cell)block,block->size());
}
void *factor_vm::object_xt(cell obj) void *factor_vm::object_xt(cell obj)
{ {
switch(tagged<object>(obj).type()) switch(tagged<object>(obj).type())
@ -196,7 +191,7 @@ void factor_vm::update_word_references(code_block *compiled)
{ {
word_references_updater updater(this); word_references_updater updater(this);
iterate_relocations(compiled,updater); iterate_relocations(compiled,updater);
flush_icache_for(compiled); compiled->flush_icache();
} }
} }
@ -224,7 +219,7 @@ void factor_vm::relocate_code_block(code_block *compiled)
code->needs_fixup.erase(compiled); code->needs_fixup.erase(compiled);
code_block_relocator relocator(this); code_block_relocator relocator(this);
iterate_relocations(compiled,relocator); iterate_relocations(compiled,relocator);
flush_icache_for(compiled); compiled->flush_icache();
} }
/* Fixup labels. This is done at compile time, not image load time */ /* Fixup labels. This is done at compile time, not image load time */

View File

@ -43,6 +43,11 @@ struct code_block
{ {
return (void *)(this + 1); return (void *)(this + 1);
} }
void flush_icache()
{
factor::flush_icache((cell)this,size());
}
}; };
} }

View File

@ -145,8 +145,10 @@ struct collector {
for(; iter != end; iter++) for(; iter != end; iter++)
{ {
trace_code_block_objects(*iter); code_block *compiled = *iter;
trace_embedded_literals(*iter); trace_code_block_objects(compiled);
trace_embedded_literals(compiled);
compiled->flush_icache();
code_blocks_scanned++; code_blocks_scanned++;
} }
} }

View File

@ -149,12 +149,14 @@ void factor_vm::collect_full(bool trace_contexts_p)
current_gc->event->op = collect_compact_op; current_gc->event->op = collect_compact_op;
collect_compact_impl(trace_contexts_p); collect_compact_impl(trace_contexts_p);
} }
flush_icache(code->seg->start,code->seg->size);
} }
void factor_vm::collect_compact(bool trace_contexts_p) void factor_vm::collect_compact(bool trace_contexts_p)
{ {
collect_mark_impl(trace_contexts_p); collect_mark_impl(trace_contexts_p);
collect_compact_impl(trace_contexts_p); collect_compact_impl(trace_contexts_p);
flush_icache(code->seg->start,code->seg->size);
} }
void factor_vm::collect_growing_heap(cell requested_bytes, bool trace_contexts_p) void factor_vm::collect_growing_heap(cell requested_bytes, bool trace_contexts_p)
@ -164,6 +166,7 @@ void factor_vm::collect_growing_heap(cell requested_bytes, bool trace_contexts_p
set_data_heap(data->grow(requested_bytes)); set_data_heap(data->grow(requested_bytes));
collect_mark_impl(trace_contexts_p); collect_mark_impl(trace_contexts_p);
collect_compact_code_impl(trace_contexts_p); collect_compact_code_impl(trace_contexts_p);
flush_icache(code->seg->start,code->seg->size);
delete old; delete old;
} }

View File

@ -500,7 +500,6 @@ struct factor_vm
void primitive_fclose(); void primitive_fclose();
//code_block //code_block
void flush_icache_for(code_block *block);
void *object_xt(cell obj); void *object_xt(cell obj);
void *xt_pic(word *w, cell tagged_quot); void *xt_pic(word *w, cell tagged_quot);
void *word_xt_pic(word *w); void *word_xt_pic(word *w);