diff src/share/vm/memory/cardTableModRefBS.cpp @ 10135:5a9fa2ba85f0

8012907: anti-delta fix for 8010992 Summary: anti-delta fix for 8010992 until 8012902 can be fixed Reviewed-by: acorn, minqi, rdurbin
author dcubed
date Sun, 21 Apr 2013 20:41:04 -0700
parents 6f817ce50129
children 746b070f5022
line wrap: on
line diff
--- a/src/share/vm/memory/cardTableModRefBS.cpp	Fri Apr 19 11:08:52 2013 -0700
+++ b/src/share/vm/memory/cardTableModRefBS.cpp	Sun Apr 21 20:41:04 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -78,13 +78,17 @@
 
   assert(card_size <= 512, "card_size must be less than 512"); // why?
 
-  NEW_C_HEAP_OBJECT_ARRAY(_covered, MemRegion, max_covered_regions, mtGC, 0, AllocFailStrategy::RETURN_NULL);
-  NEW_C_HEAP_OBJECT_ARRAY(_committed, MemRegion, max_covered_regions, mtGC, 0, AllocFailStrategy::RETURN_NULL);
-  if (_covered == NULL || _committed == NULL) {
+  _covered   = new MemRegion[max_covered_regions];
+  _committed = new MemRegion[max_covered_regions];
+  if (_covered == NULL || _committed == NULL)
     vm_exit_during_initialization("couldn't alloc card table covered region set.");
+  int i;
+  for (i = 0; i < max_covered_regions; i++) {
+    _covered[i].set_word_size(0);
+    _committed[i].set_word_size(0);
   }
+  _cur_covered_regions = 0;
 
-  _cur_covered_regions = 0;
   const size_t rs_align = _page_size == (size_t) os::vm_page_size() ? 0 :
     MAX2(_page_size, (size_t) os::vm_allocation_granularity());
   ReservedSpace heap_rs(_byte_map_size, rs_align, false);
@@ -130,7 +134,7 @@
       || _lowest_non_clean_base_chunk_index == NULL
       || _last_LNC_resizing_collection == NULL)
     vm_exit_during_initialization("couldn't allocate an LNC array.");
-  for (int i = 0; i < max_covered_regions; i++) {
+  for (i = 0; i < max_covered_regions; i++) {
     _lowest_non_clean[i] = NULL;
     _lowest_non_clean_chunk_size[i] = 0;
     _last_LNC_resizing_collection[i] = -1;
@@ -149,33 +153,6 @@
   }
 }
 
-CardTableModRefBS::~CardTableModRefBS() {
-  if (_covered) {
-    FREE_C_HEAP_OBJECT_ARRAY(MemRegion, _covered, _max_covered_regions, mtGC);
-    _covered = NULL;
-  }
-  if (_committed) {
-    FREE_C_HEAP_OBJECT_ARRAY(MemRegion, _committed, _max_covered_regions, mtGC);
-    _committed = NULL;
-  }
-  if (_lowest_non_clean) {
-    FREE_C_HEAP_ARRAY(CardArr, _lowest_non_clean, mtGC);
-    _lowest_non_clean = NULL;
-  }
-  if (_lowest_non_clean_chunk_size) {
-    FREE_C_HEAP_ARRAY(size_t, _lowest_non_clean_chunk_size, mtGC);
-    _lowest_non_clean_chunk_size = NULL;
-  }
-  if (_lowest_non_clean_base_chunk_index) {
-    FREE_C_HEAP_ARRAY(uintptr_t, _lowest_non_clean_base_chunk_index, mtGC);
-    _lowest_non_clean_base_chunk_index = NULL;
-  }
-  if (_last_LNC_resizing_collection) {
-    FREE_C_HEAP_ARRAY(int, _last_LNC_resizing_collection, mtGC);
-    _last_LNC_resizing_collection = NULL;
-  }
-}
-
 int CardTableModRefBS::find_covering_region_by_base(HeapWord* base) {
   int i;
   for (i = 0; i < _cur_covered_regions; i++) {