X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2Fsm%2FGC.h;h=5a9cb98c48bf624fd98081bde961180d3fe527be;hb=27a28cf6bc2196ee1690ac1fcc4d4c59d9b0d50f;hp=d45efb96e495c0127269837da3fcbf4ccfd558b0;hpb=c357244371ca5eeaa0d56a6bd349e26a3b16b7dc;p=ghc-hetmet.git diff --git a/rts/sm/GC.h b/rts/sm/GC.h index d45efb9..5a9cb98 100644 --- a/rts/sm/GC.h +++ b/rts/sm/GC.h @@ -73,28 +73,30 @@ ------------------------------------------------------------------------- */ typedef struct step_workspace_ { - step * stp; // the step for this workspace + step * step; // the step for this workspace struct gc_thread_ * gct; // the gc_thread that contains this workspace // block that is currently being scanned bdescr * scan_bd; - StgPtr scan; // the scan pointer // where objects to be scavenged go bdescr * todo_bd; + StgPtr todo_free; // free ptr for todo_bd + StgPtr todo_lim; // lim for todo_bd + bdescr * buffer_todo_bd; // buffer to reduce contention // on the step's todos list // where large objects to be scavenged go bdescr * todo_large_objects; - // Objects that need not be, or have already been, scavenged. The - // block at the front of the list is special: objects that don't - // need to be scavenged are copied directly to this block. - // Completed scan blocks also go on this list; but we put them - // after the head block. + // Objects that have already been, scavenged. bdescr * scavd_list; - lnat n_scavd_blocks; // count of blocks in this list + nat n_scavd_blocks; // count of blocks in this list + + // Partially-full, scavenged, blocks + bdescr * part_list; + unsigned int n_part_blocks; // count of above } step_workspace; @@ -117,12 +119,13 @@ typedef struct gc_thread_ { #endif nat thread_index; // a zero based index identifying the thread - step_workspace ** steps; // 2-d array (gen,step) of workspaces - bdescr * free_blocks; // a buffer of free blocks for this thread // during GC without accessing the block // allocators spin lock. + StgClosure* static_objects; // live static objects + StgClosure* scavenged_static_objects; // static objects scavenged so far + lnat gc_count; // number of gc's this thread has done // -------------------- @@ -136,9 +139,9 @@ typedef struct gc_thread_ { // optimise it into a per-thread // variable). - rtsBool failed_to_evac; // failue to evacuate an object typically - // causes it to be recorded in the mutable - // object list + rtsBool failed_to_evac; // failure to evacuate an object typically + // Causes it to be recorded in the mutable + // object list rtsBool eager_promotion; // forces promotion to the evac gen // instead of the to-space @@ -146,18 +149,37 @@ typedef struct gc_thread_ { lnat thunk_selector_depth; // ummm.... not used as of now +#ifdef USE_PAPI + int papi_events; +#endif + + // ------------------- + // stats + + lnat copied; + lnat any_work; + lnat no_work; + lnat scav_find_work; + + // ------------------- + // workspaces + + // array of workspaces, indexed by stp->abs_no. This is placed + // directly at the end of the gc_thread structure so that we can get from + // the gc_thread pointer to a workspace using only pointer + // arithmetic, no memory access. This happens in the inner loop + // of the GC, see Evac.c:alloc_for_copy(). + step_workspace steps[]; } gc_thread; extern nat N; extern rtsBool major_gc; +extern nat n_gc_threads; -extern gc_thread *gc_threads; +extern gc_thread **gc_threads; register gc_thread *gct __asm__("%rbx"); // extern gc_thread *gct; // this thread's gct TODO: make thread-local -extern StgClosure* static_objects; -extern StgClosure* scavenged_static_objects; - extern bdescr *mark_stack_bdescr; extern StgPtr *mark_stack; extern StgPtr *mark_sp; @@ -168,11 +190,6 @@ extern bdescr *oldgen_scan_bd; extern StgPtr oldgen_scan; extern long copied; -extern long scavd_copied; - -#ifdef THREADED_RTS -extern SpinLock static_objects_sync; -#endif #ifdef DEBUG extern nat mutlist_MUTVARS, mutlist_MUTARRS, mutlist_MVARS, mutlist_OTHERS; @@ -180,4 +197,6 @@ extern nat mutlist_MUTVARS, mutlist_MUTARRS, mutlist_MVARS, mutlist_OTHERS; StgClosure * isAlive(StgClosure *p); +#define WORK_UNIT_WORDS 128 + #endif /* GC_H */