equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2001, 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. |
171 assert(!_is_par || |
171 assert(!_is_par || |
172 (SharedHeap::heap()->n_par_threads() == |
172 (SharedHeap::heap()->n_par_threads() == |
173 SharedHeap::heap()->workers()->active_workers()), "Mismatch"); |
173 SharedHeap::heap()->workers()->active_workers()), "Mismatch"); |
174 } |
174 } |
175 |
175 |
|
176 bool ClearNoncleanCardWrapper::is_word_aligned(jbyte* entry) { |
|
177 return (((intptr_t)entry) & (BytesPerWord-1)) == 0; |
|
178 } |
|
179 |
176 void ClearNoncleanCardWrapper::do_MemRegion(MemRegion mr) { |
180 void ClearNoncleanCardWrapper::do_MemRegion(MemRegion mr) { |
177 assert(mr.word_size() > 0, "Error"); |
181 assert(mr.word_size() > 0, "Error"); |
178 assert(_ct->is_aligned(mr.start()), "mr.start() should be card aligned"); |
182 assert(_ct->is_aligned(mr.start()), "mr.start() should be card aligned"); |
179 // mr.end() may not necessarily be card aligned. |
183 // mr.end() may not necessarily be card aligned. |
180 jbyte* cur_entry = _ct->byte_for(mr.last()); |
184 jbyte* cur_entry = _ct->byte_for(mr.last()); |
192 // "dirty" range accumulated so far. |
196 // "dirty" range accumulated so far. |
193 if (start_of_non_clean < end_of_non_clean) { |
197 if (start_of_non_clean < end_of_non_clean) { |
194 const MemRegion mrd(start_of_non_clean, end_of_non_clean); |
198 const MemRegion mrd(start_of_non_clean, end_of_non_clean); |
195 _dirty_card_closure->do_MemRegion(mrd); |
199 _dirty_card_closure->do_MemRegion(mrd); |
196 } |
200 } |
|
201 |
|
202 // fast forward through potential continuous whole-word range of clean cards beginning at a word-boundary |
|
203 if (is_word_aligned(cur_entry)) { |
|
204 jbyte* cur_row = cur_entry - BytesPerWord; |
|
205 while (cur_row >= limit && *((intptr_t*)cur_row) == CardTableRS::clean_card_row()) { |
|
206 cur_row -= BytesPerWord; |
|
207 } |
|
208 cur_entry = cur_row + BytesPerWord; |
|
209 cur_hw = _ct->addr_for(cur_entry); |
|
210 } |
|
211 |
197 // Reset the dirty window, while continuing to look |
212 // Reset the dirty window, while continuing to look |
198 // for the next dirty card that will start a |
213 // for the next dirty card that will start a |
199 // new dirty window. |
214 // new dirty window. |
200 end_of_non_clean = cur_hw; |
215 end_of_non_clean = cur_hw; |
201 start_of_non_clean = cur_hw; |
216 start_of_non_clean = cur_hw; |