comparison src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp @ 4709:fd2b426c30db

7119908: G1: Cache CSet start region for each worker for subsequent reuse Summary: Cache workers' calculated starting heap region, used for parallel iteration over the collcection set, for subsequent reuse. Reviewed-by: tonyp, brutisso
author johnc
date Wed, 14 Dec 2011 17:43:55 -0800
parents 3c648b9ad052
children 441e946dc1af
comparison
equal deleted inserted replaced
4708:3c648b9ad052 4709:fd2b426c30db
941 // _is_alive_non_header field is optional but doing so prevents 941 // _is_alive_non_header field is optional but doing so prevents
942 // unnecessary additions to the discovered lists during reference 942 // unnecessary additions to the discovered lists during reference
943 // discovery. 943 // discovery.
944 G1CMIsAliveClosure _is_alive_closure_cm; 944 G1CMIsAliveClosure _is_alive_closure_cm;
945 945
946 // Cache used by G1CollectedHeap::start_cset_region_for_worker().
947 HeapRegion** _worker_cset_start_region;
948
949 // Time stamp to validate the regions recorded in the cache
950 // used by G1CollectedHeap::start_cset_region_for_worker().
951 // The heap region entry for a given worker is valid iff
952 // the associated time stamp value matches the current value
953 // of G1CollectedHeap::_gc_time_stamp.
954 unsigned int* _worker_cset_start_region_time_stamp;
955
946 enum G1H_process_strong_roots_tasks { 956 enum G1H_process_strong_roots_tasks {
947 G1H_PS_mark_stack_oops_do, 957 G1H_PS_mark_stack_oops_do,
948 G1H_PS_refProcessor_oops_do, 958 G1H_PS_refProcessor_oops_do,
949 // Leave this one last. 959 // Leave this one last.
950 G1H_PS_NumElements 960 G1H_PS_NumElements
1028 } 1038 }
1029 1039
1030 void reset_gc_time_stamp() { 1040 void reset_gc_time_stamp() {
1031 _gc_time_stamp = 0; 1041 _gc_time_stamp = 0;
1032 OrderAccess::fence(); 1042 OrderAccess::fence();
1043 // Clear the cached CSet starting regions and time stamps.
1044 // Their validity is dependent on the GC timestamp.
1045 clear_cset_start_regions();
1033 } 1046 }
1034 1047
1035 void increment_gc_time_stamp() { 1048 void increment_gc_time_stamp() {
1036 ++_gc_time_stamp; 1049 ++_gc_time_stamp;
1037 OrderAccess::fence(); 1050 OrderAccess::fence();
1298 // Same as the routine above but only checks regions in the 1311 // Same as the routine above but only checks regions in the
1299 // current collection set. 1312 // current collection set.
1300 bool check_cset_heap_region_claim_values(jint claim_value); 1313 bool check_cset_heap_region_claim_values(jint claim_value);
1301 #endif // ASSERT 1314 #endif // ASSERT
1302 1315
1303 // Given the id of a worker, calculate a suitable 1316 // Clear the cached cset start regions and (more importantly)
1304 // starting region for iterating over the current 1317 // the time stamps. Called when we reset the GC time stamp.
1305 // collection set. 1318 void clear_cset_start_regions();
1319
1320 // Given the id of a worker, obtain or calculate a suitable
1321 // starting region for iterating over the current collection set.
1306 HeapRegion* start_cset_region_for_worker(int worker_i); 1322 HeapRegion* start_cset_region_for_worker(int worker_i);
1307 1323
1308 // Iterate over the regions (if any) in the current collection set. 1324 // Iterate over the regions (if any) in the current collection set.
1309 void collection_set_iterate(HeapRegionClosure* blk); 1325 void collection_set_iterate(HeapRegionClosure* blk);
1310 1326