}
case ARRAY_TYPE:
{
- cell i;
array *names = untag<array>(symbol);
- for(i = 0; i < array_capacity(names); i++)
+ for(cell i = 0; i < array_capacity(names); i++)
{
symbol_char *name = alien_offset(array_nth(names,i));
void *sym = ffi_dlsym(d,name);
clear_decks(gen);
}
+bool data_heap::low_memory_p()
+{
+ return (tenured->free_space() <= nursery->size + aging->size);
+}
+
void factor_vm::set_data_heap(data_heap *data_)
{
data = data_;
void reset_generation(nursery_space *gen);
void reset_generation(aging_space *gen);
void reset_generation(tenured_space *gen);
+ bool low_memory_p();
};
struct data_heap_room {
current_gc->event->ended_data_sweep();
}
+void factor_vm::collect_full(bool trace_contexts_p)
+{
+ collect_mark_impl(trace_contexts_p);
+ collect_sweep_impl();
+ if(data->tenured->largest_free_block() <= data->nursery->size + data->aging->size)
+ collect_compact_impl(trace_contexts_p);
+ else
+ update_code_heap_words_and_literals();
+}
+
+void factor_vm::collect_compact(bool trace_contexts_p)
+{
+ collect_mark_impl(trace_contexts_p);
+ collect_compact_impl(trace_contexts_p);
+}
+
void factor_vm::collect_growing_heap(cell requested_bytes, bool trace_contexts_p)
{
/* Grow the data heap and copy all live objects to the new heap. */
start_gc_again();
}
- if(current_gc->op == collect_aging_op || current_gc->op == collect_to_tenured_op)
- {
- if(data->tenured->free_space() <= data->nursery->size + data->aging->size)
- current_gc->op = collect_full_op;
- }
-
current_gc->event->op = current_gc->op;
switch(current_gc->op)
break;
case collect_aging_op:
collect_aging();
+ if(data->low_memory_p())
+ {
+ current_gc->op = collect_full_op;
+ current_gc->event->op = collect_full_op;
+ collect_full(trace_contexts_p);
+ }
break;
case collect_to_tenured_op:
collect_to_tenured();
+ if(data->low_memory_p())
+ {
+ current_gc->op = collect_full_op;
+ current_gc->event->op = collect_full_op;
+ collect_full(trace_contexts_p);
+ }
break;
case collect_full_op:
- collect_mark_impl(trace_contexts_p);
- collect_sweep_impl();
- if(data->tenured->largest_free_block() <= data->nursery->size + data->aging->size)
- collect_compact_impl(trace_contexts_p);
- else
- update_code_heap_words_and_literals();
+ collect_full(trace_contexts_p);
break;
case collect_compact_op:
- collect_mark_impl(trace_contexts_p);
- collect_compact_impl(trace_contexts_p);
+ collect_compact(trace_contexts_p);
break;
case collect_growing_heap_op:
collect_growing_heap(requested_bytes,trace_contexts_p);
void update_code_roots_for_compaction();
void collect_mark_impl(bool trace_contexts_p);
void collect_sweep_impl();
+ void collect_full(bool trace_contexts_p);
void collect_compact_impl(bool trace_contexts_p);
void collect_compact_code_impl(bool trace_contexts_p);
+ void collect_compact(bool trace_contexts_p);
void collect_growing_heap(cell requested_bytes, bool trace_contexts_p);
void gc(gc_op op, cell requested_bytes, bool trace_contexts_p);
void primitive_minor_gc();