Example #1
0
os_word collect_rest(os_thread_info* self_info, os_word arg) {
  collect_args* args = (collect_args*)arg;
  gc_heap* heap = args->heap;
  int max_zone = args->max_zone;

  os_thread_info* other_info = 0;
  int other_info_count;
  os_other_thread_info(&other_info, &other_info_count);

  sync_thread_contexts(heap, other_info, other_info_count, self_info);

  gc_trace trace;
  initialize_trace(heap, &trace, max_zone);

  trace_heap(heap, &trace, self_info, other_info, other_info_count);

  if(trace.did_mark_objects) {
    gc_compaction cpt;
    initialize_compaction(heap, &cpt);
    compact_heap(heap, &trace, &cpt);
    finalize_compaction(&cpt);
  }

  finalize_trace(heap, &trace);

  return 0;
}
void CollectedHeap::trace_heap_after_gc(const GCTracer* gc_tracer) {
  trace_heap(GCWhen::AfterGC, gc_tracer);
}
void CollectedHeap::trace_heap_before_gc(const GCTracer* gc_tracer) {
  trace_heap(GCWhen::BeforeGC, gc_tracer);
}