changeset 8558:f26a2f504e28

8098815: Assertion failure in CDS shared string archive support on Windows Summary: check for a zero length before calling the G1 fill_archive_regions routine Reviewed-by: coleenp, iklam, dcubed Contributed-by: tom.benson@oracle.com
author iklam
date Wed, 17 Jun 2015 13:22:38 -0700
parents ee0c45f5e977
children 7128e27f94fb
files src/share/vm/memory/filemap.cpp
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/memory/filemap.cpp	Wed Jun 17 14:44:54 2015 +0200
+++ b/src/share/vm/memory/filemap.cpp	Wed Jun 17 13:22:38 2015 -0700
@@ -647,8 +647,8 @@
   return base;
 }
 
-MemRegion *string_ranges = NULL;
-int num_ranges = 0;
+static MemRegion *string_ranges = NULL;
+static int num_ranges = 0;
 bool FileMapInfo::map_string_regions() {
 #if INCLUDE_ALL_GCS
   if (UseG1GC && UseCompressedOops && UseCompressedClassPointers) {
@@ -737,7 +737,10 @@
 }
 
 void FileMapInfo::fixup_string_regions() {
-  if (string_ranges != NULL) {
+  // If any string regions were found, call the fill routine to make them parseable.
+  // Note that string_ranges may be non-NULL even if no ranges were found.
+  if (num_ranges != 0) {
+    assert(string_ranges != NULL, "Null string_ranges array with non-zero count");
     G1CollectedHeap::heap()->fill_archive_regions(string_ranges, num_ranges);
   }
 }