1.1 --- a/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp Thu Jun 10 08:27:35 2010 -0700 1.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp Wed Jun 23 08:35:31 2010 -0700 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -566,14 +566,14 @@ 1.11 #endif 1.12 1.13 // Commit new or uncommit old pages, if necessary. 1.14 - resize_commit_uncommit(changed_region, new_region); 1.15 + if (resize_commit_uncommit(changed_region, new_region)) { 1.16 + // Set the new start of the committed region 1.17 + resize_update_committed_table(changed_region, new_region); 1.18 + } 1.19 1.20 // Update card table entries 1.21 resize_update_card_table_entries(changed_region, new_region); 1.22 1.23 - // Set the new start of the committed region 1.24 - resize_update_committed_table(changed_region, new_region); 1.25 - 1.26 // Update the covered region 1.27 resize_update_covered_table(changed_region, new_region); 1.28 1.29 @@ -604,8 +604,9 @@ 1.30 debug_only(verify_guard();) 1.31 } 1.32 1.33 -void CardTableExtension::resize_commit_uncommit(int changed_region, 1.34 +bool CardTableExtension::resize_commit_uncommit(int changed_region, 1.35 MemRegion new_region) { 1.36 + bool result = false; 1.37 // Commit new or uncommit old pages, if necessary. 1.38 MemRegion cur_committed = _committed[changed_region]; 1.39 assert(_covered[changed_region].end() == new_region.end(), 1.40 @@ -675,20 +676,31 @@ 1.41 "card table expansion"); 1.42 } 1.43 } 1.44 + result = true; 1.45 } else if (new_start_aligned > cur_committed.start()) { 1.46 // Shrink the committed region 1.47 +#if 0 // uncommitting space is currently unsafe because of the interactions 1.48 + // of growing and shrinking regions. One region A can uncommit space 1.49 + // that it owns but which is being used by another region B (maybe). 1.50 + // Region B has not committed the space because it was already 1.51 + // committed by region A. 1.52 MemRegion uncommit_region = committed_unique_to_self(changed_region, 1.53 MemRegion(cur_committed.start(), new_start_aligned)); 1.54 if (!uncommit_region.is_empty()) { 1.55 if (!os::uncommit_memory((char*)uncommit_region.start(), 1.56 uncommit_region.byte_size())) { 1.57 - vm_exit_out_of_memory(uncommit_region.byte_size(), 1.58 - "card table contraction"); 1.59 + // If the uncommit fails, ignore it. Let the 1.60 + // committed table resizing go even though the committed 1.61 + // table will over state the committed space. 1.62 } 1.63 } 1.64 +#else 1.65 + assert(!result, "Should be false with current workaround"); 1.66 +#endif 1.67 } 1.68 assert(_committed[changed_region].end() == cur_committed.end(), 1.69 "end should not change"); 1.70 + return result; 1.71 } 1.72 1.73 void CardTableExtension::resize_update_committed_table(int changed_region,