comparison 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
comparison
equal deleted inserted replaced
10130:6f817ce50129 10135:5a9fa2ba85f0
1 /* 1 /*
2 * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
76 assert((uintptr_t(low_bound) & (card_size - 1)) == 0, "heap must start at card boundary"); 76 assert((uintptr_t(low_bound) & (card_size - 1)) == 0, "heap must start at card boundary");
77 assert((uintptr_t(high_bound) & (card_size - 1)) == 0, "heap must end at card boundary"); 77 assert((uintptr_t(high_bound) & (card_size - 1)) == 0, "heap must end at card boundary");
78 78
79 assert(card_size <= 512, "card_size must be less than 512"); // why? 79 assert(card_size <= 512, "card_size must be less than 512"); // why?
80 80
81 NEW_C_HEAP_OBJECT_ARRAY(_covered, MemRegion, max_covered_regions, mtGC, 0, AllocFailStrategy::RETURN_NULL); 81 _covered = new MemRegion[max_covered_regions];
82 NEW_C_HEAP_OBJECT_ARRAY(_committed, MemRegion, max_covered_regions, mtGC, 0, AllocFailStrategy::RETURN_NULL); 82 _committed = new MemRegion[max_covered_regions];
83 if (_covered == NULL || _committed == NULL) { 83 if (_covered == NULL || _committed == NULL)
84 vm_exit_during_initialization("couldn't alloc card table covered region set."); 84 vm_exit_during_initialization("couldn't alloc card table covered region set.");
85 } 85 int i;
86 86 for (i = 0; i < max_covered_regions; i++) {
87 _covered[i].set_word_size(0);
88 _committed[i].set_word_size(0);
89 }
87 _cur_covered_regions = 0; 90 _cur_covered_regions = 0;
91
88 const size_t rs_align = _page_size == (size_t) os::vm_page_size() ? 0 : 92 const size_t rs_align = _page_size == (size_t) os::vm_page_size() ? 0 :
89 MAX2(_page_size, (size_t) os::vm_allocation_granularity()); 93 MAX2(_page_size, (size_t) os::vm_allocation_granularity());
90 ReservedSpace heap_rs(_byte_map_size, rs_align, false); 94 ReservedSpace heap_rs(_byte_map_size, rs_align, false);
91 95
92 MemTracker::record_virtual_memory_type((address)heap_rs.base(), mtGC); 96 MemTracker::record_virtual_memory_type((address)heap_rs.base(), mtGC);
128 if (_lowest_non_clean == NULL 132 if (_lowest_non_clean == NULL
129 || _lowest_non_clean_chunk_size == NULL 133 || _lowest_non_clean_chunk_size == NULL
130 || _lowest_non_clean_base_chunk_index == NULL 134 || _lowest_non_clean_base_chunk_index == NULL
131 || _last_LNC_resizing_collection == NULL) 135 || _last_LNC_resizing_collection == NULL)
132 vm_exit_during_initialization("couldn't allocate an LNC array."); 136 vm_exit_during_initialization("couldn't allocate an LNC array.");
133 for (int i = 0; i < max_covered_regions; i++) { 137 for (i = 0; i < max_covered_regions; i++) {
134 _lowest_non_clean[i] = NULL; 138 _lowest_non_clean[i] = NULL;
135 _lowest_non_clean_chunk_size[i] = 0; 139 _lowest_non_clean_chunk_size[i] = 0;
136 _last_LNC_resizing_collection[i] = -1; 140 _last_LNC_resizing_collection[i] = -1;
137 } 141 }
138 142
144 &_byte_map[0], 148 &_byte_map[0],
145 &_byte_map[_last_valid_index]); 149 &_byte_map[_last_valid_index]);
146 gclog_or_tty->print_cr(" " 150 gclog_or_tty->print_cr(" "
147 " byte_map_base: " INTPTR_FORMAT, 151 " byte_map_base: " INTPTR_FORMAT,
148 byte_map_base); 152 byte_map_base);
149 }
150 }
151
152 CardTableModRefBS::~CardTableModRefBS() {
153 if (_covered) {
154 FREE_C_HEAP_OBJECT_ARRAY(MemRegion, _covered, _max_covered_regions, mtGC);
155 _covered = NULL;
156 }
157 if (_committed) {
158 FREE_C_HEAP_OBJECT_ARRAY(MemRegion, _committed, _max_covered_regions, mtGC);
159 _committed = NULL;
160 }
161 if (_lowest_non_clean) {
162 FREE_C_HEAP_ARRAY(CardArr, _lowest_non_clean, mtGC);
163 _lowest_non_clean = NULL;
164 }
165 if (_lowest_non_clean_chunk_size) {
166 FREE_C_HEAP_ARRAY(size_t, _lowest_non_clean_chunk_size, mtGC);
167 _lowest_non_clean_chunk_size = NULL;
168 }
169 if (_lowest_non_clean_base_chunk_index) {
170 FREE_C_HEAP_ARRAY(uintptr_t, _lowest_non_clean_base_chunk_index, mtGC);
171 _lowest_non_clean_base_chunk_index = NULL;
172 }
173 if (_last_LNC_resizing_collection) {
174 FREE_C_HEAP_ARRAY(int, _last_LNC_resizing_collection, mtGC);
175 _last_LNC_resizing_collection = NULL;
176 } 153 }
177 } 154 }
178 155
179 int CardTableModRefBS::find_covering_region_by_base(HeapWord* base) { 156 int CardTableModRefBS::find_covering_region_by_base(HeapWord* base) {
180 int i; 157 int i;